|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.glassfish.hk2.utilities.reflection.ReflectionHelper
public class ReflectionHelper
| Constructor Summary | |
|---|---|
ReflectionHelper()
|
|
| Method Summary | |
|---|---|
static void |
addMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas,
java.lang.String key,
java.lang.String value)
Adds a value to the list of values associated with this key |
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
deepCopyMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> copyMe)
This method does a deep copy of the incoming meta-data, (which basically means we will also make copies of the value list) |
static java.util.Set<java.lang.reflect.Type> |
getAdvertisedTypesFromClass(java.lang.reflect.Type type,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation)
Returns the set of types this class advertises |
static java.util.Set<java.lang.reflect.Type> |
getAdvertisedTypesFromObject(java.lang.Object t,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation)
Returns the set of types this class advertises |
static java.util.Set<java.lang.String> |
getContractsFromClass(java.lang.Class<?> clazz,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation)
Returns the set of types this class advertises |
static java.lang.String |
getName(java.lang.Class<?> implClass)
Returns the name that should be associated with this class |
static java.util.Set<java.lang.annotation.Annotation> |
getQualifierAnnotations(java.lang.reflect.AnnotatedElement annotatedGuy)
Gets all the qualifier annotations from the object |
static java.util.Set<java.lang.String> |
getQualifiersFromClass(java.lang.Class<?> clazz)
Gets all the qualifiers from the object |
static java.util.Set<java.lang.annotation.Annotation> |
getQualifiersFromObject(java.lang.Object t)
Gets all the qualifiers from the object |
static java.lang.Class<?> |
getRawClass(java.lang.reflect.Type type)
Given the type parameter gets the raw type represented by the type, or null if this has no associated raw class |
static java.lang.annotation.Annotation |
getScopeAnnotationFromClass(java.lang.Class<?> clazz)
Gets the scope annotation from the object |
static java.lang.annotation.Annotation |
getScopeAnnotationFromObject(java.lang.Object t)
Gets the scope annotation from the object |
static java.lang.Class<? extends java.lang.annotation.Annotation> |
getScopeFromClass(java.lang.Class<?> clazz,
java.lang.Class<? extends java.lang.annotation.Annotation> annoDefault)
Gets the scope annotation from the object |
static java.lang.Class<? extends java.lang.annotation.Annotation> |
getScopeFromObject(java.lang.Object t,
java.lang.Class<? extends java.lang.annotation.Annotation> annoDefault)
Gets the scope annotation from the object |
static java.util.Set<java.lang.reflect.Type> |
getTypeClosure(java.lang.reflect.Type ofType,
java.util.Set<java.lang.String> contracts)
Returns the type closure, as restricted by the classes listed in the set of contracts implemented |
static java.lang.Object |
invoke(java.lang.Object o,
java.lang.reflect.Method m,
java.lang.Object[] args)
This version of invoke is CCL neutral (it will return with the same CCL as what it went in with) |
static boolean |
isAnnotationAQualifier(java.lang.annotation.Annotation anno)
Returns true if the given annotation is a qualifier |
static boolean |
isStatic(java.lang.reflect.Member member)
Returns true if the underlying member is static |
static void |
readMetadataMap(java.lang.String line,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> addToMe)
Writes a set in a way that can be read from an input stream as well |
static void |
readSet(java.lang.String line,
java.util.Collection<java.lang.String> addToMe)
Writes a set in a way that can be read from an input stream as well. |
static boolean |
removeAllMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas,
java.lang.String key)
Removes all the metadata values associated with key |
static boolean |
removeMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas,
java.lang.String key,
java.lang.String value)
Removes the given value from the given key |
static void |
setContextClassLoader(java.lang.Thread t,
java.lang.ClassLoader l)
Sets the context classloader under the privileged of this class |
static java.lang.String |
writeMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
Used to write the metadata out |
static java.lang.String |
writeSet(java.util.Set<?> set)
Writes a set in a way that can be read from an input stream as well |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionHelper()
| Method Detail |
|---|
public static java.lang.Class<?> getRawClass(java.lang.reflect.Type type)
type - The type to find the raw class on
public static java.lang.String getName(java.lang.Class<?> implClass)
implClass - The class to evaluate
public static java.util.Set<java.lang.reflect.Type> getTypeClosure(java.lang.reflect.Type ofType,
java.util.Set<java.lang.String> contracts)
ofType - The type to checkcontracts - The contracts this type is allowed to handle
public static java.util.Set<java.lang.reflect.Type> getAdvertisedTypesFromClass(java.lang.reflect.Type type,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation)
type - The outer type to analyzemarkerAnnotation - The annotation to use to discover the advertised types
public static java.util.Set<java.lang.reflect.Type> getAdvertisedTypesFromObject(java.lang.Object t,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation)
t - the object we are analyzingmarkerAnnotation - The annotation to use to discover the advertised types
public static java.util.Set<java.lang.String> getContractsFromClass(java.lang.Class<?> clazz,
java.lang.Class<? extends java.lang.annotation.Annotation> markerAnnotation)
clazz - the class we are analyzingmarkerAnnotation - The annotation to use to discover annotated types
public static java.lang.annotation.Annotation getScopeAnnotationFromObject(java.lang.Object t)
t - The object to analyze
public static java.lang.annotation.Annotation getScopeAnnotationFromClass(java.lang.Class<?> clazz)
clazz - The class to analyze
public static java.lang.Class<? extends java.lang.annotation.Annotation> getScopeFromObject(java.lang.Object t,
java.lang.Class<? extends java.lang.annotation.Annotation> annoDefault)
t - The object to analyzeannoDefault - The default that this should have if no scope could be found
public static java.lang.Class<? extends java.lang.annotation.Annotation> getScopeFromClass(java.lang.Class<?> clazz,
java.lang.Class<? extends java.lang.annotation.Annotation> annoDefault)
clazz - The class to analyzeannoDefault - The scope that should be returned if no scope could be found
public static boolean isAnnotationAQualifier(java.lang.annotation.Annotation anno)
anno - The annotation to check
public static java.util.Set<java.lang.annotation.Annotation> getQualifiersFromObject(java.lang.Object t)
t - The object to analyze
public static java.util.Set<java.lang.String> getQualifiersFromClass(java.lang.Class<?> clazz)
clazz - The class to analyze
public static java.util.Set<java.lang.annotation.Annotation> getQualifierAnnotations(java.lang.reflect.AnnotatedElement annotatedGuy)
annotatedGuy - The thing to analyze
public static java.lang.String writeSet(java.util.Set<?> set)
set - The set to write
public static void readSet(java.lang.String line,
java.util.Collection<java.lang.String> addToMe)
throws java.io.IOException
line - The line to readaddToMe - The set to add the strings to
java.io.IOException - On a failure
public static void readMetadataMap(java.lang.String line,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> addToMe)
throws java.io.IOException
line - The line to readaddToMe - The set to add the strings to
java.io.IOException - On a failurepublic static java.lang.String writeMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
metadata - The metadata to externalize
public static void addMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas,
java.lang.String key,
java.lang.String value)
metadatas - The base metadata objectkey - The key to which to add the value. May not be nullvalue - The value to add. May not be null
public static boolean removeMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas,
java.lang.String key,
java.lang.String value)
metadatas - The base metadata objectkey - The key of the value to remove. May not be nullvalue - The value to remove. May not be null
public static boolean removeAllMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas,
java.lang.String key)
metadatas - The base metadata objectkey - The key of the metadata values to remove
public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> deepCopyMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> copyMe)
copyMe - The guy to copy (if null, null will be returned)
public static java.lang.Object invoke(java.lang.Object o,
java.lang.reflect.Method m,
java.lang.Object[] args)
throws java.lang.Throwable
m - the method to invokeo - the object on which to invoke itargs - The arguments to invoke (may not be null)
java.lang.Throwable - The unwrapped throwable thrown by the methodpublic static boolean isStatic(java.lang.reflect.Member member)
member - The non-null member to test
public static void setContextClassLoader(java.lang.Thread t,
java.lang.ClassLoader l)
t - The thread on which to set the classloaderl - The classloader to set
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||