Skip navigation links
${project.title}
version 1.4
junitx.util

Class PrivateAccessor

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.Object getField(java.lang.Class cls, java.lang.String name)
      Returns the value of the field on the specified class.
      static java.lang.Object getField(java.lang.Object object, java.lang.String name)
      Returns the value of the field on the specified object.
      static java.lang.Object invoke(java.lang.Class cls, java.lang.String name, java.lang.Class[] parameterTypes, java.lang.Object[] args)
      Invokes the method represented by the name value on the specified class with the specified parameters.
      static java.lang.Object invoke(java.lang.Object object, java.lang.String name, java.lang.Class[] parameterTypes, java.lang.Object[] args)
      Invokes the method represented by the name value on the specified object with the specified parameters.
      static void setField(java.lang.Class cls, java.lang.String name, java.lang.Object value)
      Sets the field represented by the name value on the specified class argument to the specified new value.
      static void setField(java.lang.Object object, java.lang.String name, java.lang.Object value)
      Sets the field represented by the name value on the specified object argument to the specified new value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getField

        public static java.lang.Object getField(java.lang.Object object,
                                                java.lang.String name)
                                         throws java.lang.NoSuchFieldException
        Returns the value of the field on the specified object. The name parameter is a String specifying the simple name of the desired field.

        The object is first searched for any matching field. If no matching field is found, the superclasses are recursively searched.

        Throws:
        java.lang.NoSuchFieldException - if a field with the specified name is not found.
      • getField

        public static java.lang.Object getField(java.lang.Class cls,
                                                java.lang.String name)
                                         throws java.lang.NoSuchFieldException
        Returns the value of the field on the specified class. The name parameter is a String specifying the simple name of the desired field.

        The class is first searched for any matching field. If no matching field is found, the superclasses are recursively searched.

        Throws:
        java.lang.NoSuchFieldException - if a field with the specified name is not found.
      • setField

        public static void setField(java.lang.Object object,
                                    java.lang.String name,
                                    java.lang.Object value)
                             throws java.lang.NoSuchFieldException
        Sets the field represented by the name value on the specified object argument to the specified new value. The new value is automatically unwrapped if the underlying field has a primitive type.

        The object is first searched for any matching field. If no matching field is found, the superclasses are recursively searched.

        Throws:
        java.lang.NoSuchFieldException - if a field with the specified name is not found.
      • setField

        public static void setField(java.lang.Class cls,
                                    java.lang.String name,
                                    java.lang.Object value)
                             throws java.lang.NoSuchFieldException
        Sets the field represented by the name value on the specified class argument to the specified new value. The new value is automatically unwrapped if the underlying field has a primitive type.

        The class is first searched for any matching field. If no matching field is found, the superclasses are recursively searched.

        Throws:
        java.lang.NoSuchFieldException - if a field with the specified name is not found.
      • invoke

        public static java.lang.Object invoke(java.lang.Object object,
                                              java.lang.String name,
                                              java.lang.Class[] parameterTypes,
                                              java.lang.Object[] args)
                                       throws java.lang.Throwable
        Invokes the method represented by the name value on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to widening conversions as necessary. The value returned by the method is automatically wrapped in an object if it has a primitive type.

        The object is first searched for any matching method. If no matching method is found, the superclasses are recursively searched.

        Throws:
        java.lang.NoSuchMethodException - if a matching method is not found or if the name is ""or "".
        java.lang.Throwable
      • invoke

        public static java.lang.Object invoke(java.lang.Class cls,
                                              java.lang.String name,
                                              java.lang.Class[] parameterTypes,
                                              java.lang.Object[] args)
                                       throws java.lang.Throwable
        Invokes the method represented by the name value on the specified class with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to widening conversions as necessary. The value returned by the method is automatically wrapped in an object if it has a primitive type.

        The class is first searched for any matching method. If no matching class is found, the superclasses are recursively searched.

        Throws:
        java.lang.NoSuchMethodException - if a matching method is not found or if the name is ""or "".
        java.lang.Throwable

Copyright © ${project.year} ${project.holder}. All Rights Reserved.