Class FieldInfo
- java.lang.Object
-
- edu.umd.cs.findbugs.classfile.FieldOrMethodDescriptor
-
- edu.umd.cs.findbugs.classfile.FieldDescriptor
-
- edu.umd.cs.findbugs.classfile.analysis.FieldInfo
-
- All Implemented Interfaces:
AccessibleEntity,ClassMember,ComparableField,XField,AnnotatedObject,FieldOrMethodName,java.io.Serializable,java.lang.Comparable<ComparableField>
public class FieldInfo extends FieldDescriptor implements XField
- Author:
- pugh
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFieldInfo.Builder
-
Field Summary
Fields Modifier and Type Field Description static FieldInfo[]EMPTY_ARRAY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(AnnotationValue annotationValue)Destructively add an annotation.intcompareTo(ComparableField rhs)static FieldInfocreateUnresolvedFieldInfo(java.lang.String className, java.lang.String name, java.lang.String signature, boolean isStatic)Create a FieldInfo object to represent an unresolved field.intgetAccessFlags()Get the entity's access flags.AnnotationValuegetAnnotation(ClassDescriptor desc)java.util.Collection<ClassDescriptor>getAnnotationDescriptors()java.util.Collection<AnnotationValue>getAnnotations()java.lang.StringgetClassName()Get the full (dotted) name of the class (if the object represents a class) or the class the entity is defined in (if a field or method).AnnotatedObjectgetContainingScope()java.lang.annotation.ElementTypegetElementType()FieldDescriptorgetFieldDescriptor()intgetNumParams()java.lang.StringgetPackageName()Get the (dotted) name of the package in which the entity is defined.java.lang.StringgetSourceSignature()Get the signature representing the field/method's type, including generic typebooleanisDeprecated()Is the entity deprecated?booleanisFinal()Is the entity final?booleanisNative()booleanisPrivate()Is the entity private?booleanisProtected()Is the entity protected?booleanisPublic()Is the entity public?booleanisReferenceType()Is the type of the field a reference type?booleanisResolved()Did we find a declaration of this entity?booleanisSynchronized()booleanisSynthetic()Is the entity synthetic?booleanisVolatile()Is this a volatile field?-
Methods inherited from class edu.umd.cs.findbugs.classfile.FieldDescriptor
equals, toString
-
Methods inherited from class edu.umd.cs.findbugs.classfile.FieldOrMethodDescriptor
compareTo, compareTo, getClassDescriptor, getName, getNameSigHashCode, getNameSigHashCode, getSignature, getSlashedClassName, hashCode, haveEqualFields, isStatic
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.umd.cs.findbugs.ba.AccessibleEntity
getClassDescriptor, isStatic
-
Methods inherited from interface edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject
getClassDescriptor
-
Methods inherited from interface edu.umd.cs.findbugs.ba.ClassMember
getName, getSignature
-
Methods inherited from interface edu.umd.cs.findbugs.classfile.FieldOrMethodName
getClassDescriptor, isStatic
-
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final FieldInfo[] EMPTY_ARRAY
-
-
Method Detail
-
getNumParams
public int getNumParams()
-
isNative
public boolean isNative()
-
isSynchronized
public boolean isSynchronized()
-
isDeprecated
public boolean isDeprecated()
Description copied from interface:AccessibleEntityIs the entity deprecated?- Specified by:
isDeprecatedin interfaceAccessibleEntity
-
getClassName
@DottedClassName public java.lang.String getClassName()
Description copied from interface:ClassMemberGet the full (dotted) name of the class (if the object represents a class) or the class the entity is defined in (if a field or method).- Specified by:
getClassNamein interfaceClassMember
-
getPackageName
@DottedClassName public java.lang.String getPackageName()
Description copied from interface:ClassMemberGet the (dotted) name of the package in which the entity is defined.- Specified by:
getPackageNamein interfaceClassMember
-
getSourceSignature
public java.lang.String getSourceSignature()
Description copied from interface:ClassMemberGet the signature representing the field/method's type, including generic type- Specified by:
getSourceSignaturein interfaceClassMember
-
compareTo
public int compareTo(ComparableField rhs)
- Specified by:
compareToin interfacejava.lang.Comparable<ComparableField>- Overrides:
compareToin classFieldDescriptor
-
getAccessFlags
public int getAccessFlags()
Description copied from interface:AccessibleEntityGet the entity's access flags.- Specified by:
getAccessFlagsin interfaceAccessibleEntity
-
isFinal
public boolean isFinal()
Description copied from interface:AccessibleEntityIs the entity final?- Specified by:
isFinalin interfaceAccessibleEntity
-
isPrivate
public boolean isPrivate()
Description copied from interface:AccessibleEntityIs the entity private?- Specified by:
isPrivatein interfaceAccessibleEntity
-
isProtected
public boolean isProtected()
Description copied from interface:AccessibleEntityIs the entity protected?- Specified by:
isProtectedin interfaceAccessibleEntity
-
isPublic
public boolean isPublic()
Description copied from interface:AccessibleEntityIs the entity public?- Specified by:
isPublicin interfaceAccessibleEntity
-
isResolved
public boolean isResolved()
Description copied from interface:ClassMemberDid we find a declaration of this entity?- Specified by:
isResolvedin interfaceClassMember
-
isReferenceType
public boolean isReferenceType()
Description copied from interface:XFieldIs the type of the field a reference type?- Specified by:
isReferenceTypein interfaceXField
-
isVolatile
public boolean isVolatile()
Description copied from interface:XFieldIs this a volatile field?- Specified by:
isVolatilein interfaceXField
-
isSynthetic
public boolean isSynthetic()
Description copied from interface:AccessibleEntityIs the entity synthetic?- Specified by:
isSyntheticin interfaceAccessibleEntity- Specified by:
isSyntheticin interfaceAnnotatedObject
-
getAnnotationDescriptors
public java.util.Collection<ClassDescriptor> getAnnotationDescriptors()
- Specified by:
getAnnotationDescriptorsin interfaceAnnotatedObject
-
getAnnotation
public AnnotationValue getAnnotation(ClassDescriptor desc)
- Specified by:
getAnnotationin interfaceAnnotatedObject
-
getAnnotations
public java.util.Collection<AnnotationValue> getAnnotations()
- Specified by:
getAnnotationsin interfaceAnnotatedObject
-
addAnnotation
public void addAnnotation(AnnotationValue annotationValue)
Destructively add an annotation. We do this for "built-in" annotations that might not be directly evident in the code. It's not a great idea in general, but we can get away with it as long as it's done early enough (i.e., before anyone asks what annotations this field has.)- Parameters:
annotationValue- an AnnotationValue representing a field annotation
-
getFieldDescriptor
public FieldDescriptor getFieldDescriptor()
- Specified by:
getFieldDescriptorin interfaceXField- Returns:
- FieldDescriptor referring to this field
-
createUnresolvedFieldInfo
public static FieldInfo createUnresolvedFieldInfo(java.lang.String className, java.lang.String name, java.lang.String signature, boolean isStatic)
Create a FieldInfo object to represent an unresolved field. Don't call this directly - use XFactory instead.- Parameters:
className- name of class containing the fieldname- name of fieldsignature- field signatureisStatic- true if field is static, false otherwise- Returns:
- FieldInfo object representing the unresolved field
-
getElementType
public java.lang.annotation.ElementType getElementType()
- Specified by:
getElementTypein interfaceAnnotatedObject
-
getContainingScope
@CheckForNull public AnnotatedObject getContainingScope()
- Specified by:
getContainingScopein interfaceAnnotatedObject
-
-