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 class
FieldInfo.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 void
addAnnotation(AnnotationValue annotationValue)
Destructively add an annotation.int
compareTo(ComparableField rhs)
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.int
getAccessFlags()
Get the entity's access flags.AnnotationValue
getAnnotation(ClassDescriptor desc)
java.util.Collection<ClassDescriptor>
getAnnotationDescriptors()
java.util.Collection<AnnotationValue>
getAnnotations()
java.lang.String
getClassName()
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).AnnotatedObject
getContainingScope()
java.lang.annotation.ElementType
getElementType()
FieldDescriptor
getFieldDescriptor()
int
getNumParams()
java.lang.String
getPackageName()
Get the (dotted) name of the package in which the entity is defined.java.lang.String
getSourceSignature()
Get the signature representing the field/method's type, including generic typeboolean
isDeprecated()
Is the entity deprecated?boolean
isEnum()
boolean
isFinal()
Is the entity final?boolean
isNative()
boolean
isPrivate()
Is the entity private?boolean
isProtected()
Is the entity protected?boolean
isPublic()
Is the entity public?boolean
isReferenceType()
Is the type of the field a reference type?boolean
isResolved()
Did we find a declaration of this entity?boolean
isSynchronized()
boolean
isSynthetic()
Is the entity synthetic?boolean
isVolatile()
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:AccessibleEntity
Is the entity deprecated?- Specified by:
isDeprecated
in interfaceAccessibleEntity
-
getClassName
@DottedClassName public java.lang.String getClassName()
Description copied from interface:ClassMember
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).- Specified by:
getClassName
in interfaceClassMember
-
getPackageName
@DottedClassName public java.lang.String getPackageName()
Description copied from interface:ClassMember
Get the (dotted) name of the package in which the entity is defined.- Specified by:
getPackageName
in interfaceClassMember
-
getSourceSignature
public java.lang.String getSourceSignature()
Description copied from interface:ClassMember
Get the signature representing the field/method's type, including generic type- Specified by:
getSourceSignature
in interfaceClassMember
-
compareTo
public int compareTo(ComparableField rhs)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ComparableField>
- Overrides:
compareTo
in classFieldDescriptor
-
getAccessFlags
public int getAccessFlags()
Description copied from interface:AccessibleEntity
Get the entity's access flags.- Specified by:
getAccessFlags
in interfaceAccessibleEntity
-
isFinal
public boolean isFinal()
Description copied from interface:AccessibleEntity
Is the entity final?- Specified by:
isFinal
in interfaceAccessibleEntity
-
isPrivate
public boolean isPrivate()
Description copied from interface:AccessibleEntity
Is the entity private?- Specified by:
isPrivate
in interfaceAccessibleEntity
-
isEnum
public boolean isEnum()
-
isProtected
public boolean isProtected()
Description copied from interface:AccessibleEntity
Is the entity protected?- Specified by:
isProtected
in interfaceAccessibleEntity
-
isPublic
public boolean isPublic()
Description copied from interface:AccessibleEntity
Is the entity public?- Specified by:
isPublic
in interfaceAccessibleEntity
-
isResolved
public boolean isResolved()
Description copied from interface:ClassMember
Did we find a declaration of this entity?- Specified by:
isResolved
in interfaceClassMember
-
isReferenceType
public boolean isReferenceType()
Description copied from interface:XField
Is the type of the field a reference type?- Specified by:
isReferenceType
in interfaceXField
-
isVolatile
public boolean isVolatile()
Description copied from interface:XField
Is this a volatile field?- Specified by:
isVolatile
in interfaceXField
-
isSynthetic
public boolean isSynthetic()
Description copied from interface:AccessibleEntity
Is the entity synthetic?- Specified by:
isSynthetic
in interfaceAccessibleEntity
- Specified by:
isSynthetic
in interfaceAnnotatedObject
-
getAnnotationDescriptors
public java.util.Collection<ClassDescriptor> getAnnotationDescriptors()
- Specified by:
getAnnotationDescriptors
in interfaceAnnotatedObject
-
getAnnotation
public AnnotationValue getAnnotation(ClassDescriptor desc)
- Specified by:
getAnnotation
in interfaceAnnotatedObject
-
getAnnotations
public java.util.Collection<AnnotationValue> getAnnotations()
- Specified by:
getAnnotations
in 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:
getFieldDescriptor
in 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:
getElementType
in interfaceAnnotatedObject
-
getContainingScope
@CheckForNull public AnnotatedObject getContainingScope()
- Specified by:
getContainingScope
in interfaceAnnotatedObject
-
-