Package sootup.java.core
Class JavaSootField
- All Implemented Interfaces:
Field,HasPosition,SootField,HasAnnotation
public class JavaSootField
extends SootClassMember<FieldSignature>
implements SootField, HasAnnotation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefines aSootFieldbuilder to provide a fluent API. -
Field Summary
Fields inherited from class sootup.core.model.SootClassMember
position, signature -
Constructor Summary
ConstructorsConstructorDescriptionJavaSootField(@NonNull FieldSignature signature, @NonNull Iterable<FieldModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Position position) Constructs a Soot field with the given name, type and modifiers.JavaSootField(@NonNull FieldSignature signature, @NonNull Iterable<FieldModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Position position, @Nullable Constant constantValue) Constructs a field with an optional classfile ConstantValue attribute.JavaSootField(@NonNull FieldSignature signature, @NonNull Iterable<FieldModifier> modifiers, @NonNull Position position) Constructs a Soot field with the given name, type and modifiers. -
Method Summary
Modifier and TypeMethodDescriptionintReturns a hash code for this method consistent with structural equality.@NonNull Iterable<AnnotationUsage>Returns the classfile ConstantValue attribute, or an empty optional if absent.@NonNull ClassTypeReturns the SootClass declaring this one.@NonNull Set<FieldModifier>Gets the modifiers of this class member in an immutable set.@NonNull TypegetType()booleanisFinal()Convenience method returning true if this field is final.booleanConvenience method returning true if this class member is private.booleanConvenience method returning true if this class member is protected.booleanisPublic()Convenience method returning true if this class member is public.booleanisStatic()Convenience method returning true if this class member is static.@NonNull JavaSootFieldwithAnnotations(@NonNull Iterable<AnnotationUsage> annotations) @NonNull JavaSootFieldwithModifiers(@NonNull Iterable<FieldModifier> modifiers) @NonNull JavaSootFieldwithSignature(@NonNull FieldSignature signature) Methods inherited from class sootup.core.model.SootClassMember
getName, getPosition, getSignature, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface sootup.core.model.Field
getSignature
-
Constructor Details
-
JavaSootField
public JavaSootField(@NonNull FieldSignature signature, @NonNull Iterable<FieldModifier> modifiers, @NonNull Position position) Constructs a Soot field with the given name, type and modifiers. -
JavaSootField
public JavaSootField(@NonNull FieldSignature signature, @NonNull Iterable<FieldModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Position position) Constructs a Soot field with the given name, type and modifiers.- Parameters:
signature- the signature of the fieldmodifiers- modifier of the fieldannotations- annotations of the fieldposition- position of the field
-
JavaSootField
public JavaSootField(@NonNull FieldSignature signature, @NonNull Iterable<FieldModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Position position, @Nullable Constant constantValue) Constructs a field with an optional classfile ConstantValue attribute.- Parameters:
signature- the erased field signaturemodifiers- the field modifiersannotations- the field annotationsposition- the source positionconstantValue- the ConstantValue attribute, ornullif absent
-
-
Method Details
-
getConstantValue
Returns the classfile ConstantValue attribute, or an empty optional if absent. This does not infer values from field initializers. Boolean, byte, char and short attributes are represented as integer constants, matching their classfile representation. -
isProtected
public boolean isProtected()Description copied from class:SootClassMemberConvenience method returning true if this class member is protected.- Specified by:
isProtectedin interfaceSootField- Specified by:
isProtectedin classSootClassMember<FieldSignature>
-
isPrivate
public boolean isPrivate()Description copied from class:SootClassMemberConvenience method returning true if this class member is private.- Specified by:
isPrivatein interfaceSootField- Specified by:
isPrivatein classSootClassMember<FieldSignature>
-
isPublic
public boolean isPublic()Description copied from class:SootClassMemberConvenience method returning true if this class member is public.- Specified by:
isPublicin interfaceSootField- Specified by:
isPublicin classSootClassMember<FieldSignature>
-
isStatic
public boolean isStatic()Description copied from class:SootClassMemberConvenience method returning true if this class member is static.- Specified by:
isStaticin interfaceSootField- Specified by:
isStaticin classSootClassMember<FieldSignature>
-
isFinal
public boolean isFinal()Description copied from class:SootClassMemberConvenience method returning true if this field is final.- Specified by:
isFinalin interfaceSootField- Specified by:
isFinalin classSootClassMember<FieldSignature>
-
getModifiers
Gets the modifiers of this class member in an immutable set.- Specified by:
getModifiersin interfaceSootField- See Also:
-
equivHashCode
public int equivHashCode()Description copied from class:SootClassMemberReturns a hash code for this method consistent with structural equality.- Specified by:
equivHashCodein classSootClassMember<FieldSignature>
-
getType
-
withSignature
- Specified by:
withSignaturein interfaceSootField
-
withModifiers
- Specified by:
withModifiersin interfaceSootField
-
getDeclaringClassType
Returns the SootClass declaring this one.- Specified by:
getDeclaringClassTypein interfaceSootField- Overrides:
getDeclaringClassTypein classSootClassMember<FieldSignature>
-
getAnnotations
- Specified by:
getAnnotationsin interfaceHasAnnotation
-
withAnnotations
-