Package org.spongepowered.asm.util
Class Annotations.Handle
- java.lang.Object
-
- org.spongepowered.asm.util.Annotations.Handle
-
- All Implemented Interfaces:
IAnnotationHandle
- Enclosing class:
- Annotations
public static class Annotations.Handle extends java.lang.Object implements IAnnotationHandle
Wrapper forAnnotationNodeto support access via common interface
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()Get whether the annotation inside the handle actually exists, if the contained element is null, returns false.IAnnotationHandlegetAnnotation(java.lang.String key)Get an annotation value as an annotation handlejava.util.List<IAnnotationHandle>getAnnotationList(java.lang.String key)Retrieve an annotation key as a list of annotation handlesbooleangetBoolean(java.lang.String key, boolean defaultValue)Get the primitive boolean value with the specified key or return null if not present or not setjava.lang.StringgetDesc()Get the annotation descriptor<T> java.util.List<T>getList()Retrieve the annotation value as a list with values of the specified type.<T> java.util.List<T>getList(java.lang.String key)Retrieve the annotation value with the specified key as a list with values of the specified type.org.objectweb.asm.tree.AnnotationNodegetNode()java.util.List<org.objectweb.asm.Type>getTypeList(java.lang.String key)Retrieve an annotation key as a list of Types.org.objectweb.asm.TypegetTypeValue(java.lang.String key)Get an annotation value as an ASMType.<T> TgetValue()Get the annotation value or return null if not present or not set<T> TgetValue(java.lang.String key)Get the annotation value with the specified key or return null if not present or not set<T> TgetValue(java.lang.String key, T defaultValue)Get a value with the specified key from this annotation, return the specified default value if the key is not set or is not presentjava.lang.StringtoString()
-
-
-
Method Detail
-
exists
public boolean exists()
Description copied from interface:IAnnotationHandleGet whether the annotation inside the handle actually exists, if the contained element is null, returns false.- Specified by:
existsin interfaceIAnnotationHandle- Returns:
- true if the annotation exists
-
getNode
public org.objectweb.asm.tree.AnnotationNode getNode()
-
getDesc
public java.lang.String getDesc()
Description copied from interface:IAnnotationHandleGet the annotation descriptor- Specified by:
getDescin interfaceIAnnotationHandle
-
getAnnotationList
public java.util.List<IAnnotationHandle> getAnnotationList(java.lang.String key)
Description copied from interface:IAnnotationHandleRetrieve an annotation key as a list of annotation handles- Specified by:
getAnnotationListin interfaceIAnnotationHandle- Parameters:
key- key to fetch- Returns:
- list of annotations
-
getTypeValue
public org.objectweb.asm.Type getTypeValue(java.lang.String key)
Description copied from interface:IAnnotationHandleGet an annotation value as an ASMType. This is special-cased because the different APIs return class literals in different ways. Under ASM we will receieveTypeinstances, but at compile time we will getTypeMirrors instead. This overload is provided so that subclasses have to marshal everything intoTypefor consistency.- Specified by:
getTypeValuein interfaceIAnnotationHandle- Parameters:
key- key to fetch- Returns:
- value
-
getTypeList
public java.util.List<org.objectweb.asm.Type> getTypeList(java.lang.String key)
Description copied from interface:IAnnotationHandleRetrieve an annotation key as a list of Types. This is special-cased because the different APIs return class literals in different ways. Under ASM we will receieveTypeinstances, but at compile time we will getTypeMirrors instead. This overload is provided so that subclasses have to marshal everything intoTypefor consistency.- Specified by:
getTypeListin interfaceIAnnotationHandle- Parameters:
key- key to fetch- Returns:
- list of types
-
getAnnotation
public IAnnotationHandle getAnnotation(java.lang.String key)
Description copied from interface:IAnnotationHandleGet an annotation value as an annotation handle- Specified by:
getAnnotationin interfaceIAnnotationHandle- Parameters:
key- key to search for in the value map- Returns:
- value or null if not set
-
getValue
public <T> T getValue(java.lang.String key, T defaultValue)Description copied from interface:IAnnotationHandleGet a value with the specified key from this annotation, return the specified default value if the key is not set or is not present- Specified by:
getValuein interfaceIAnnotationHandle- Type Parameters:
T- duck type- Parameters:
key- keydefaultValue- value to return if the key is not set or not present- Returns:
- value or default if not set
-
getValue
public <T> T getValue()
Description copied from interface:IAnnotationHandleGet the annotation value or return null if not present or not set- Specified by:
getValuein interfaceIAnnotationHandle- Type Parameters:
T- duck type- Returns:
- value or null if not present or not set
-
getValue
public <T> T getValue(java.lang.String key)
Description copied from interface:IAnnotationHandleGet the annotation value with the specified key or return null if not present or not set- Specified by:
getValuein interfaceIAnnotationHandle- Type Parameters:
T- duck type- Parameters:
key- key to fetch- Returns:
- value or null if not present or not set
-
getBoolean
public boolean getBoolean(java.lang.String key, boolean defaultValue)Description copied from interface:IAnnotationHandleGet the primitive boolean value with the specified key or return null if not present or not set- Specified by:
getBooleanin interfaceIAnnotationHandle- Parameters:
key- key to fetchdefaultValue- default value to return if value is not present- Returns:
- value or default if not present or not set
-
getList
public <T> java.util.List<T> getList()
Description copied from interface:IAnnotationHandleRetrieve the annotation value as a list with values of the specified type. Returns an empty list if the value is not present or not set.- Specified by:
getListin interfaceIAnnotationHandle- Type Parameters:
T- list element duck type- Returns:
- list of values
-
getList
public <T> java.util.List<T> getList(java.lang.String key)
Description copied from interface:IAnnotationHandleRetrieve the annotation value with the specified key as a list with values of the specified type. Returns an empty list if the value is not present or not set.- Specified by:
getListin interfaceIAnnotationHandle- Type Parameters:
T- list element duck type- Parameters:
key- key to fetch- Returns:
- list of values
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-