Top Description Fields Constructors Methods
io.github.classgraph

public Class AnnotationParameterValue

extends ScanResultObject
implements HasName, Comparable<AnnotationParameterValue>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, io.github.classgraph.HasName
Imports
java.lang.reflect.Array, java.util.Map, .Objects, .Set, nonapi.io.github.classgraph.utils.LogNode

A wrapper used to pair annotation parameter names with annotation parameter values.

Field Summary

Modifier and TypeField and Description
private String
name

The the parameter name.

private ObjectTypedValueWrapper
value

The parameter value.

Inherited from io.github.classgraph.ScanResultObject:
classRefscanResult

Constructor Summary

AccessConstructor and Description
pack-priv
AnnotationParameterValue()

Default constructor for deserialization.

pack-priv
AnnotationParameterValue(final String
The annotation paramater name.
name
,
final Object
The annotation parameter value.
value
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(final AnnotationParameterValue
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

pack-priv void
convertWrapperArraysToPrimitiveArrays(final ClassInfo
the annotation class info
annotationClassInfo
)

For primitive array type params, replace Object[] arrays containing boxed types with primitive arrays (need to check the type of each method of the annotation class to determine if it is a primitive array type).

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

protected void
findReferencedClassInfo(final Map<String, ClassInfo>
the map from class name to ClassInfo.
classNameToClassInfo
,
final Set<ClassInfo>
the referenced class info
refdClassInfo
,
final LogNode
the log
log
)

Overrides io.github.classgraph.ScanResultObject.findReferencedClassInfo.

Get ClassInfo objects for any classes referenced in the annotation parameters.

protected ClassInfo
getClassInfo()

Overrides io.github.classgraph.ScanResultObject.getClassInfo.

Get the ClassInfo object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. no ClassInfo object was created for the class during scanning).

protected String
getClassName()

Implements abstract io.github.classgraph.ScanResultObject.getClassName.

The name of the class (used by getClassInfo() to fetch the ClassInfo object for the class).

public String

Returns:

The annotation parameter name.
getName
()

Implements io.github.classgraph.HasName.getName.

Get the annotation parameter name.

public Object

Returns:

The annotation parameter value. May be one of the following types:
  • String for string constants
  • String[] for arrays of strings
  • A boxed type, e.g. Integer or Character, for primitive-typed constants
  • A 1-dimensional primitive-typed array (i.e. int[], long[], short[], char[], byte[], boolean[], float[], or double[]), for arrays of primitives
  • A 1-dimensional Object[] array for array types (and then the array element type may be one of the types in this list)
  • AnnotationEnumValue, for enum constants (this wraps the enum class and the string name of the constant)
  • AnnotationClassRef, for Class references within annotations (this wraps the name of the referenced class)
  • AnnotationInfo, for nested annotations
getValue
()

Get the annotation parameter value.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv Object

Returns:

the instance
instantiate
(final ClassInfo
the annotation class info
annotationClassInfo
)

Instantiate an annotation parameter value.

pack-priv void
setScanResult(final ScanResult
the scan result
scanResult
)

Overrides io.github.classgraph.ScanResultObject.setScanResult.

Set ScanResult backreferences in info objects after scan has completed.

pack-priv void
setValue(final Object
the new value
newValue
)

Set (update) the value of the annotation parameter.

protected void
toString(final boolean
if true, use just the simple name of each class.
useSimpleNames
,
final StringBuilder
the buf
buf
)

Implements abstract io.github.classgraph.ScanResultObject.toString.

Render to string.

private static void
toString(final Object
the value
val
,
final boolean
the use simple names
useSimpleNames
,
final StringBuilder
the buffer
buf
)

Write an annotation parameter value's string representation to the buffer.

pack-priv void
toStringParamValueOnly(final boolean useSimpleNames, final StringBuilder
the buf
buf
)

To string, param value only.

private String

Returns:

the string.
toStringParamValueOnly
()

To string, param value only.

Inherited from io.github.classgraph.ScanResultObject:
findReferencedClassInfoloadClassloadClassloadClassloadClasstoStringtoStringtoStringWithSimpleNames

Field Detail

nameback to summary
private String name

The the parameter name.

valueback to summary
private ObjectTypedValueWrapper value

The parameter value.

Constructor Detail

AnnotationParameterValueback to summary
pack-priv AnnotationParameterValue()

Default constructor for deserialization.

AnnotationParameterValueback to summary
pack-priv AnnotationParameterValue(final String name, final Object value)

Constructor.

Parameters
name:String

The annotation paramater name.

value:Object

The annotation parameter value.

Method Detail

compareToback to summary
public int compareTo(final AnnotationParameterValue other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:AnnotationParameterValue

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
convertWrapperArraysToPrimitiveArraysback to summary
pack-priv void convertWrapperArraysToPrimitiveArrays(final ClassInfo annotationClassInfo)

For primitive array type params, replace Object[] arrays containing boxed types with primitive arrays (need to check the type of each method of the annotation class to determine if it is a primitive array type).

Parameters
annotationClassInfo:ClassInfo

the annotation class info

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
findReferencedClassInfoback to summary
protected void findReferencedClassInfo(final Map<String, ClassInfo> classNameToClassInfo, final Set<ClassInfo> refdClassInfo, final LogNode log)

Overrides io.github.classgraph.ScanResultObject.findReferencedClassInfo.

Get ClassInfo objects for any classes referenced in the annotation parameters.

Parameters
classNameToClassInfo:Map<String, ClassInfo>

the map from class name to ClassInfo.

refdClassInfo:Set<ClassInfo>

the referenced class info

log:LogNode

Doc from io.github.classgraph.ScanResultObject.findReferencedClassInfo.

the log

Annotations
@Override
getClassInfoback to summary
protected ClassInfo getClassInfo()

Overrides io.github.classgraph.ScanResultObject.getClassInfo.

Doc from io.github.classgraph.ScanResultObject.getClassInfo.

Get the ClassInfo object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. no ClassInfo object was created for the class during scanning). N.B. even if this method returns null, loadClass() may be able to load the referenced class by name.

Returns:ClassInfo

The ClassInfo object for the referenced class.

Annotations
@Override
getClassNameback to summary
protected String getClassName()

Implements abstract io.github.classgraph.ScanResultObject.getClassName.

Doc from io.github.classgraph.ScanResultObject.getClassName.

The name of the class (used by getClassInfo() to fetch the ClassInfo object for the class).

Returns:String

The class name.

Annotations
@Override
getNameback to summary
public String getName()

Implements io.github.classgraph.HasName.getName.

Get the annotation parameter name.

Returns:String

The annotation parameter name.

Annotations
@Override
getValueback to summary
public Object getValue()

Get the annotation parameter value.

Returns:Object

The annotation parameter value. May be one of the following types:

  • String for string constants
  • String[] for arrays of strings
  • A boxed type, e.g. Integer or Character, for primitive-typed constants
  • A 1-dimensional primitive-typed array (i.e. int[], long[], short[], char[], byte[], boolean[], float[], or double[]), for arrays of primitives
  • A 1-dimensional Object[] array for array types (and then the array element type may be one of the types in this list)
  • AnnotationEnumValue, for enum constants (this wraps the enum class and the string name of the constant)
  • AnnotationClassRef, for Class references within annotations (this wraps the name of the referenced class)
  • AnnotationInfo, for nested annotations
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
instantiateback to summary
pack-priv Object instantiate(final ClassInfo annotationClassInfo)

Instantiate an annotation parameter value.

Parameters
annotationClassInfo:ClassInfo

the annotation class info

Returns:Object

the instance

setScanResultback to summary
pack-priv void setScanResult(final ScanResult scanResult)

Overrides io.github.classgraph.ScanResultObject.setScanResult.

Doc from io.github.classgraph.ScanResultObject.setScanResult.

Set ScanResult backreferences in info objects after scan has completed.

Parameters
scanResult:ScanResult

the scan result

Annotations
@Override
setValueback to summary
pack-priv void setValue(final Object newValue)

Set (update) the value of the annotation parameter. Used to replace Object[] arrays containing boxed types into primitive arrays.

Parameters
newValue:Object

the new value

toStringback to summary
protected void toString(final boolean useSimpleNames, final StringBuilder buf)

Implements abstract io.github.classgraph.ScanResultObject.toString.

Doc from io.github.classgraph.ScanResultObject.toString.

Render to string.

Parameters
useSimpleNames:boolean

if true, use just the simple name of each class.

buf:StringBuilder

the buf

Annotations
@Override
toStringback to summary
private static void toString(final Object val, final boolean useSimpleNames, final StringBuilder buf)

Write an annotation parameter value's string representation to the buffer.

Parameters
val:Object

the value

useSimpleNames:boolean

the use simple names

buf:StringBuilder

the buffer

toStringParamValueOnlyback to summary
pack-priv void toStringParamValueOnly(final boolean useSimpleNames, final StringBuilder buf)

To string, param value only.

Parameters
buf:StringBuilder

the buf

toStringParamValueOnlyback to summary
private String toStringParamValueOnly()

To string, param value only.

Returns:String

the string.