public final class Annotations
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static org.objectweb.asm.tree.AnnotationNode |
get(java.util.List<org.objectweb.asm.tree.AnnotationNode> annotations,
java.lang.String annotationType)
Search for and return an annotation node matching the specified type
within the supplied
collection of annotation nodes
|
static org.objectweb.asm.tree.AnnotationNode |
getInvisible(org.objectweb.asm.tree.ClassNode classNode,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Get an invisible annotation of the specified class from the supplied
class node
|
static org.objectweb.asm.tree.AnnotationNode |
getInvisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Get an invisible annotation of the specified class from the supplied
field node
|
static org.objectweb.asm.tree.AnnotationNode |
getInvisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Get an invisible annotation of the specified class from the supplied
method node
|
static org.objectweb.asm.tree.AnnotationNode |
getInvisibleParameter(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
int paramIndex)
Get an invisible parameter annotation of the specified class from the
supplied method node
|
static org.objectweb.asm.tree.AnnotationNode |
getParameter(java.util.List<org.objectweb.asm.tree.AnnotationNode>[] parameterAnnotations,
java.lang.String annotationType,
int paramIndex)
Get a parameter annotation of the specified class from the supplied
method node
|
static org.objectweb.asm.tree.AnnotationNode |
getSingleInvisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotationClasses)
Get an invisible annotation of the specified class from the supplied
method node
|
static org.objectweb.asm.tree.AnnotationNode |
getSingleVisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotationClasses)
Get a runtime-visible annotation of the specified class from the supplied
method node
|
static <T> T |
getValue(org.objectweb.asm.tree.AnnotationNode annotation)
Duck type the "value" entry (if any) of the specified annotation node
|
static <T> T |
getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key)
Get the value of an annotation node and do pseudo-duck-typing via Java's
crappy generics
|
static <T> java.util.List<T> |
getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
boolean notNull)
Return the specified annotation node value as a list of nodes
|
static <T extends java.lang.Enum<T>> |
getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
boolean notNull,
java.lang.Class<T> enumClass)
Return the specified annotation node value as a list of enums
|
static <T> T |
getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
java.lang.Class<?> annotationClass)
Gets an annotation value or returns the default value of the annotation
if the annotation value is not present
|
static <T extends java.lang.Enum<T>> |
getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
java.lang.Class<T> enumClass,
T defaultValue)
Get the value of an annotation node as the specified enum, returns
defaultValue if the annotation value is not set
|
static <T> T |
getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
T defaultValue)
Get the value of an annotation node and do pseudo-duck-typing via Java's
crappy generics
|
static org.objectweb.asm.tree.AnnotationNode |
getVisible(org.objectweb.asm.tree.ClassNode classNode,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Get a runtime-visible annotation of the specified class from the supplied
class node
|
static org.objectweb.asm.tree.AnnotationNode |
getVisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Get a runtime-visible annotation of the specified class from the supplied
field node
|
static org.objectweb.asm.tree.AnnotationNode |
getVisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Get a runtime-visible annotation of the specified class from the supplied
method node
|
static org.objectweb.asm.tree.AnnotationNode |
getVisibleParameter(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
int paramIndex)
Get a runtime-visible parameter annotation of the specified class from
the supplied method node
|
static void |
merge(org.objectweb.asm.tree.ClassNode from,
org.objectweb.asm.tree.ClassNode to)
Merge annotations from the specified source ClassNode to the destination
ClassNode, replaces annotations of the equivalent type on the target with
annotations from the source.
|
static void |
merge(org.objectweb.asm.tree.FieldNode from,
org.objectweb.asm.tree.FieldNode to)
Merge annotations from the specified source FieldNode to the destination
FieldNode, replaces annotations of the equivalent type on the target with
annotations from the source.
|
static void |
merge(org.objectweb.asm.tree.MethodNode from,
org.objectweb.asm.tree.MethodNode to)
Merge annotations from the specified source MethodNode to the destination
MethodNode, replaces annotations of the equivalent type on the target
with annotations from the source.
|
static void |
setInvisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
Set an invisible annotation of the specified class on the supplied field
node
|
static void |
setInvisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
Set a invisible annotation of the specified class on the supplied method
node
|
static void |
setValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
java.lang.Object value)
Set the value of an annotation node and do pseudo-duck-typing via Java's
crappy generics
|
static void |
setVisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
Set a runtime-visible annotation of the specified class on the supplied
field node
|
static void |
setVisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
Set a runtime-visible annotation of the specified class on the supplied
method node
|
public static void setVisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
field - Target fieldannotationClass - Type of annotation to search forvalue - Values (interleaved key/value pairs) to setpublic static void setInvisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
field - Target fieldannotationClass - Type of annotation to search forvalue - Values (interleaved key/value pairs) to setpublic static void setVisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
method - Target methodannotationClass - Type of annotation to search forvalue - Values (interleaved key/value pairs) to setpublic static void setInvisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
java.lang.Object... value)
method - Target methodannotationClass - Type of annotation to search forvalue - Values (interleaved key/value pairs) to setpublic static org.objectweb.asm.tree.AnnotationNode getVisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
field - Source fieldannotationClass - Type of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getInvisible(org.objectweb.asm.tree.FieldNode field,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
field - Source fieldannotationClass - Type of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getVisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
method - Source methodannotationClass - Type of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getInvisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
method - Source methodannotationClass - Type of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getSingleVisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotationClasses)
method - Source methodannotationClasses - Types of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getSingleInvisible(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation>... annotationClasses)
method - Source methodannotationClasses - Types of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getVisible(org.objectweb.asm.tree.ClassNode classNode,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
classNode - Source ClassNodeannotationClass - Type of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getInvisible(org.objectweb.asm.tree.ClassNode classNode,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
classNode - Source ClassNodeannotationClass - Type of annotation to search forpublic static org.objectweb.asm.tree.AnnotationNode getVisibleParameter(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
int paramIndex)
method - Source methodannotationClass - Type of annotation to search forparamIndex - Index of the parameter to fetch annotation for, or the
method itself if less than zeropublic static org.objectweb.asm.tree.AnnotationNode getInvisibleParameter(org.objectweb.asm.tree.MethodNode method,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
int paramIndex)
method - Source methodannotationClass - Type of annotation to search forparamIndex - Index of the parameter to fetch annotation for, or the
method itself if less than zeropublic static org.objectweb.asm.tree.AnnotationNode getParameter(java.util.List<org.objectweb.asm.tree.AnnotationNode>[] parameterAnnotations,
java.lang.String annotationType,
int paramIndex)
parameterAnnotations - Annotations for the parameterannotationType - Type of annotation to search forparamIndex - Index of the parameter to fetch annotation forpublic static org.objectweb.asm.tree.AnnotationNode get(java.util.List<org.objectweb.asm.tree.AnnotationNode> annotations,
java.lang.String annotationType)
annotations - HaystackannotationType - Needlepublic static <T> T getValue(org.objectweb.asm.tree.AnnotationNode annotation)
T - duck typeannotation - Annotation node to queryClassCastException if your duck is actually a roosterpublic static <T> T getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
T defaultValue)
T - duck typeannotation - Annotation node to querykey - Key to search fordefaultValue - Value to return if the specified key is not found or
is nullClassCastException if your duck is actually a roosterpublic static <T> T getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
java.lang.Class<?> annotationClass)
T - duck typeannotation - Annotation node to querykey - Key to search forannotationClass - Annotation class to query reflectively for the
default valuepublic static <T> T getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key)
T - duck typeannotation - Annotation node to querykey - Key to search forClassCastException if your duck is actually a roosterpublic static <T extends java.lang.Enum<T>> T getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
java.lang.Class<T> enumClass,
T defaultValue)
T - duck typeannotation - Annotation node to querykey - Key to search forenumClass - Class of enum containing the enum constant to search fordefaultValue - Value to return if the specified key isn't foundpublic static <T> java.util.List<T> getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
boolean notNull)
T - list element typeannotation - Annotation node to querykey - Key to search fornotNull - if true, return an empty list instead of null if the
annotation value is absentpublic static <T extends java.lang.Enum<T>> java.util.List<T> getValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
boolean notNull,
java.lang.Class<T> enumClass)
T - list element typeannotation - Annotation node to querykey - Key to search fornotNull - if true, return an empty list instead of null if the
annotation value is absentenumClass - Class of enum containing the enum constant to usepublic static void setValue(org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String key,
java.lang.Object value)
annotation - Annotation node to modifykey - Key to setvalue - Value to set
ClassCastException if your duck is actually a roosterpublic static void merge(org.objectweb.asm.tree.ClassNode from,
org.objectweb.asm.tree.ClassNode to)
from - ClassNode to merge annotations fromto - ClassNode to merge annotations topublic static void merge(org.objectweb.asm.tree.MethodNode from,
org.objectweb.asm.tree.MethodNode to)
from - MethodNode to merge annotations fromto - MethodNode to merge annotations topublic static void merge(org.objectweb.asm.tree.FieldNode from,
org.objectweb.asm.tree.FieldNode to)
from - FieldNode to merge annotations fromto - FieldNode to merge annotations to