reflection 相關

Class:

public Class<?> getComponentType ()

Returns a Class object which represents the component type if this class represents an array type. Returns null if this class does not represent an array type. The component type of an array type is the type of the elements of the array.html



public Annotation[] getDeclaredAnnotations ()

Returns the annotations that are directly defined on the class represented by this Class. Annotations that are inherited are not included in the result. If there are no annotations at all, an empty array is returned.java

Returns
  • an array of annotations declared for this elementandroid

public Annotation[] getAnnotations ()

Returns an array containing all the annotations of this class. If there are no annotations then an empty array is returned.this

Returns
  • an array of all annotations for this elementspa



public Field[] getDeclaredFields ()

Returns an array containing Field objects for all fields declared in the class represented by this Class. If there are no fields or if thisClass represents an array class, a primitive type or void then an empty array is returned.code

See Also

public Field[] getFields ()

Returns an array containing Field objects for all public fields for the class C represented by this Class. Fields may be declared in C, the interfaces it implements or in the superclasses of C. The elements in the returned array are in no particular order.htm

If there are no public fields or if this class represents an array class, a primitive type or void then an empty array is returned.ci


Filed:

public Annotation[] getDeclaredAnnotations ()

Returns, for this element, all annotations that are explicitly declared (not inherited). If there are no declared annotations present, this method returns a zero length array.element

Returns
  • an array of annotations declared for this element


public boolean isSynthetic ()

Indicates whether or not this field is synthetic.

Returns
  • true if this field is synthetic, false otherwise




Method:


public void setAccessible (boolean flag) inherits from AccessibleObject 

Attempts to set the accessible flag. Setting this to true prevents IllegalAccessExceptions


IllegalAccessException:

Thrown when a program attempts to access a field or method which is not accessible from the location where the reference is made.

相關文章
相關標籤/搜索