Package com.google.common.reflect
Class Element
- java.lang.Object
-
- java.lang.reflect.AccessibleObject
-
- com.google.common.reflect.Element
-
- All Implemented Interfaces:
java.lang.reflect.AnnotatedElement,java.lang.reflect.Member
- Direct Known Subclasses:
Invokable
class Element extends java.lang.reflect.AccessibleObject implements java.lang.reflect.MemberRepresents either aField, aMethodor aConstructor. Provides convenience methods such asisPublic()andisPackagePrivate().
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.AccessibleObjectaccessibleObjectprivate java.lang.reflect.Membermember
-
Constructor Summary
Constructors Constructor Description Element(M member)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)<A extends java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<A> annotationClass)java.lang.annotation.Annotation[]getAnnotations()java.lang.annotation.Annotation[]getDeclaredAnnotations()java.lang.Class<?>getDeclaringClass()intgetModifiers()java.lang.StringgetName()TypeToken<?>getOwnerType()inthashCode()booleanisAbstract()Returns true if the method is abstract.booleanisAccessible()booleanisAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)booleanisFinal()Returnstrueif this method is final, perModifier.isFinal(getModifiers()).booleanisNative()Returns true if the element is native.booleanisPackagePrivate()Returns true if the element is package-private.booleanisPrivate()Returns true if the element is private.booleanisProtected()Returns true if the element is protected.booleanisPublic()Returns true if the element is public.booleanisStatic()Returns true if the element is static.booleanisSynchronized()Returns true if the method is synchronized.booleanisSynthetic()(package private) booleanisTransient()Returns true if the field is transient.(package private) booleanisVolatile()Returns true if the field is volatile.voidsetAccessible(boolean flag)java.lang.StringtoString()
-
-
-
Method Detail
-
getOwnerType
public TypeToken<?> getOwnerType()
-
isAnnotationPresent
public final boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
- Specified by:
isAnnotationPresentin interfacejava.lang.reflect.AnnotatedElement- Overrides:
isAnnotationPresentin classjava.lang.reflect.AccessibleObject
-
getAnnotation
public final <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationClass)
- Specified by:
getAnnotationin interfacejava.lang.reflect.AnnotatedElement- Overrides:
getAnnotationin classjava.lang.reflect.AccessibleObject
-
getAnnotations
public final java.lang.annotation.Annotation[] getAnnotations()
- Specified by:
getAnnotationsin interfacejava.lang.reflect.AnnotatedElement- Overrides:
getAnnotationsin classjava.lang.reflect.AccessibleObject
-
getDeclaredAnnotations
public final java.lang.annotation.Annotation[] getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotationsin interfacejava.lang.reflect.AnnotatedElement- Overrides:
getDeclaredAnnotationsin classjava.lang.reflect.AccessibleObject
-
setAccessible
public final void setAccessible(boolean flag) throws java.lang.SecurityException- Overrides:
setAccessiblein classjava.lang.reflect.AccessibleObject- Throws:
java.lang.SecurityException
-
isAccessible
public final boolean isAccessible()
- Overrides:
isAccessiblein classjava.lang.reflect.AccessibleObject
-
getDeclaringClass
public java.lang.Class<?> getDeclaringClass()
- Specified by:
getDeclaringClassin interfacejava.lang.reflect.Member
-
getName
public final java.lang.String getName()
- Specified by:
getNamein interfacejava.lang.reflect.Member
-
getModifiers
public final int getModifiers()
- Specified by:
getModifiersin interfacejava.lang.reflect.Member
-
isSynthetic
public final boolean isSynthetic()
- Specified by:
isSyntheticin interfacejava.lang.reflect.Member
-
isPublic
public final boolean isPublic()
Returns true if the element is public.
-
isProtected
public final boolean isProtected()
Returns true if the element is protected.
-
isPackagePrivate
public final boolean isPackagePrivate()
Returns true if the element is package-private.
-
isPrivate
public final boolean isPrivate()
Returns true if the element is private.
-
isStatic
public final boolean isStatic()
Returns true if the element is static.
-
isFinal
public final boolean isFinal()
Returnstrueif this method is final, perModifier.isFinal(getModifiers()).Note that a method may still be effectively "final", or non-overridable when it has no
finalkeyword. For example, it could be private, or it could be declared by a final class. To tell whether a method is overridable, useInvokable.isOverridable().
-
isAbstract
public final boolean isAbstract()
Returns true if the method is abstract.
-
isNative
public final boolean isNative()
Returns true if the element is native.
-
isSynchronized
public final boolean isSynchronized()
Returns true if the method is synchronized.
-
isVolatile
final boolean isVolatile()
Returns true if the field is volatile.
-
isTransient
final boolean isTransient()
Returns true if the field is transient.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-