|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper
public final class JavaIntrospectionHelper
Implements various reflection-related operations
Method Summary | ||
---|---|---|
static boolean |
exactMethodMatch(java.lang.reflect.Method method1,
java.lang.reflect.Method method2)
Determines if two methods "match" - that is, they have the same method names and exact parameter types (one is not a supertype of the other) |
|
static java.lang.reflect.Field |
findClosestMatchingField(java.lang.String name,
java.lang.Class type,
java.util.Set<java.lang.reflect.Field> fields)
Finds the closest matching field with the given name, that is, a field of the exact specified type or, alternately, of a supertype. |
|
static java.lang.reflect.Method |
findClosestMatchingMethod(java.lang.String name,
java.lang.Class[] types,
java.util.Set<java.lang.reflect.Method> methods)
Finds the closest matching method with the given name, that is, a method taking the exact parameter types or, alternately, parameter supertypes. |
|
static java.util.Set<java.lang.Class> |
getAllInterfaces(java.lang.Class clazz)
Returns the set of interfaces implemented by the given class and its ancestors or a blank set if none |
|
static java.util.Set<java.lang.reflect.Field> |
getAllPublicAndProtectedFields(java.lang.Class clazz,
boolean validating)
Returns a collection of public, and protected fields declared by a class or one of its supertypes |
|
static java.util.Set<java.lang.reflect.Method> |
getAllUniquePublicProtectedMethods(java.lang.Class clazz,
boolean validating)
Returns a collection of public and protected methods declared by a class or one of its supertypes. |
|
static java.lang.Class<?> |
getArrayType(java.lang.Class<?> componentType,
int dims)
|
|
static java.lang.String |
getBaseName(java.lang.Class<?> implClass)
Returns the simple name of a class - i.e. |
|
static java.lang.Class<?> |
getBaseType(java.lang.Class<?> cls,
java.lang.reflect.Type genericType)
|
|
static java.lang.Class<?> |
getBusinessInterface(java.lang.Class<?> cls,
java.lang.reflect.Type callableReferenceType)
|
|
static
|
getDefaultConstructor(java.lang.Class<T> clazz)
|
|
static java.lang.Class<?> |
getErasure(java.lang.reflect.Type type)
|
|
static java.util.List<? extends java.lang.reflect.Type> |
getGenerics(java.lang.reflect.Type genericType)
Returns the generic types represented in the given type. |
|
static java.lang.reflect.Type |
getParameterType(java.lang.reflect.Type type)
|
|
static java.util.Set<java.lang.reflect.Field> |
getPrivateFields(java.lang.Class clazz)
|
|
static java.util.Set<java.lang.reflect.Method> |
getPrivateMethods(java.lang.Class clazz)
|
|
static java.lang.String |
getSignature(java.lang.Class<?> cls)
|
|
static java.lang.Class |
introspectGeneric(java.lang.Class<?> clazz,
int pos)
Returns the generic type specified by the class at the given position as in: public class Foo |
|
static boolean |
isGetter(java.lang.reflect.Method method)
|
|
static boolean |
isImmutable(java.lang.Class clazz)
|
|
static boolean |
isSetter(java.lang.reflect.Method method)
|
|
static java.lang.String |
toGetter(java.lang.String name)
Takes a property name and converts it to a getter method name according to JavaBean conventions. |
|
static java.lang.String |
toPropertyName(java.lang.String name)
Takes a setter or getter method name and converts it to a property name according to JavaBean conventions. |
|
static java.lang.String |
toSetter(java.lang.String name)
Takes a property name and converts it to a setter method name according to JavaBean conventions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.util.Set<java.lang.reflect.Field> getAllPublicAndProtectedFields(java.lang.Class clazz, boolean validating)
public static java.util.Set<java.lang.reflect.Method> getAllUniquePublicProtectedMethods(java.lang.Class clazz, boolean validating)
public static java.lang.reflect.Field findClosestMatchingField(java.lang.String name, java.lang.Class type, java.util.Set<java.lang.reflect.Field> fields)
name
- the name of the fieldtype
- the field typefields
- the collection of fields to search
public static java.lang.reflect.Method findClosestMatchingMethod(java.lang.String name, java.lang.Class[] types, java.util.Set<java.lang.reflect.Method> methods)
name
- the name of the methodtypes
- the method parameter typesmethods
- the collection of methods to search
public static boolean exactMethodMatch(java.lang.reflect.Method method1, java.lang.reflect.Method method2)
public static <T> java.lang.reflect.Constructor<T> getDefaultConstructor(java.lang.Class<T> clazz) throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException
public static java.lang.String getBaseName(java.lang.Class<?> implClass)
implClass
- the implementation classpublic static boolean isImmutable(java.lang.Class clazz)
public static java.lang.String toGetter(java.lang.String name)
foo is returned as getFoo
public static java.lang.String toPropertyName(java.lang.String name)
setFoo(var)
is returned as property foo
public static java.lang.Class<?> getErasure(java.lang.reflect.Type type)
public static java.lang.Class<?> getBaseType(java.lang.Class<?> cls, java.lang.reflect.Type genericType)
public static java.lang.reflect.Type getParameterType(java.lang.reflect.Type type)
public static java.lang.Class<?> getBusinessInterface(java.lang.Class<?> cls, java.lang.reflect.Type callableReferenceType)
public static java.lang.String toSetter(java.lang.String name)
foo is returned as setFoo(var)
public static java.util.List<? extends java.lang.reflect.Type> getGenerics(java.lang.reflect.Type genericType)
JavaIntrospectionHelper.getGenerics(field.getGenericType());
JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];);
public static java.lang.Class introspectGeneric(java.lang.Class<?> clazz, int pos)
public class Foo{ //.. }
JavaIntrospectionHelper.introspectGeneric(Foo.class,1);
will return Baz.
public static java.util.Set<java.lang.Class> getAllInterfaces(java.lang.Class clazz)
public static boolean isSetter(java.lang.reflect.Method method)
public static boolean isGetter(java.lang.reflect.Method method)
public static java.lang.String getSignature(java.lang.Class<?> cls)
public static java.lang.Class<?> getArrayType(java.lang.Class<?> componentType, int dims) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static java.util.Set<java.lang.reflect.Method> getPrivateMethods(java.lang.Class clazz)
public static java.util.Set<java.lang.reflect.Field> getPrivateFields(java.lang.Class clazz)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |