Errai 3.0.1-SNAPSHOT

org.jboss.errai.codegen.meta.impl
Class AbstractMetaClass<T>

java.lang.Object
  extended by org.jboss.errai.codegen.meta.MetaClass
      extended by org.jboss.errai.codegen.meta.impl.AbstractMetaClass<T>
All Implemented Interfaces:
HasAnnotations, MetaGenericDeclaration, MetaType
Direct Known Subclasses:
BuildMetaClass, GWTClass, JavaReflectionClass

public abstract class AbstractMetaClass<T>
extends MetaClass

Author:
Mike Brock , Christian Sadilek

Field Summary
protected  MetaParameterizedType genericSuperClass
           
protected  MetaParameterizedType parameterizedType
           
 
Constructor Summary
protected AbstractMetaClass(T enclosedMetaObject)
           
 
Method Summary
protected static MetaConstructor _getConstructor(MetaConstructor[] constructors, MetaClass... parmTypes)
           
protected static MetaMethod _getMethod(MetaMethod[] methods, String name, MetaClass... parmTypes)
           
 MetaClass asBoxed()
           
 Class<?> asClass()
           
 MetaClass asUnboxed()
           
 boolean equals(Object o)
           
<A extends Annotation>
A
getAnnotation(Class<A> annotation)
           
 BeanDescriptor getBeanDescriptor()
           
 MetaConstructor getBestMatchingConstructor(Class... parameters)
           
 MetaConstructor getBestMatchingConstructor(MetaClass... parameters)
           
 MetaMethod getBestMatchingMethod(String name, Class... parameters)
           
 MetaMethod getBestMatchingMethod(String name, MetaClass... parameters)
           
 MetaMethod getBestMatchingStaticMethod(String name, Class... parameters)
           
 MetaMethod getBestMatchingStaticMethod(String name, MetaClass... parameters)
           
 MetaConstructor getConstructor(Class... parameters)
           
 MetaConstructor getConstructor(MetaClass... parameters)
           
 MetaConstructor getDeclaredConstructor(Class... parameters)
           
 MetaMethod getDeclaredMethod(String name, Class... parmTypes)
           
 MetaMethod getDeclaredMethod(String name, MetaClass... parmTypes)
           
 T getEnclosedMetaObject()
           
 List<MetaField> getFieldsAnnotatedWith(Class<? extends Annotation> annotation)
          Returns all declared and inherited fields on this class that have the given annotation targeting them.
 List<MetaField> getFieldsWithMetaAnnotations(Class<? extends Annotation> annotation)
           
 String getFullyQualifiedNameWithTypeParms()
           
 MetaParameterizedType getGenericSuperClass()
           
 MetaField getInheritedField(String name)
          Searches for the named field in this type, its superinterfaces, and its superclasses.
 String getInternalName()
           
static String getInternalPrimitiveNameFrom(String name)
           
 MetaMethod getMethod(String name, Class... parmTypes)
           
 MetaMethod getMethod(String name, MetaClass... parameters)
           
 List<MetaMethod> getMethodsAnnotatedWith(Class<? extends Annotation> annotation)
          Returns all declared and inherited methods on this class that have the given annotation targeting them.
 List<MetaMethod> getMethodsWithMetaAnnotations(Class<? extends Annotation> annotation)
           
 MetaClass getOuterComponentType()
           
 MetaParameterizedType getParameterizedType()
           
 List<MetaParameter> getParametersAnnotatedWith(Class<? extends Annotation> annotation)
           
 int hashCode()
           
 boolean isAnnotationPresent(Class<? extends Annotation> annotation)
           
 boolean isAssignableFrom(Class clazz)
          Reports if the type represented by this MetaClass is a supertype of (or the same class as) the given class.
 boolean isAssignableFrom(MetaClass clazz)
          Reports if the type represented by this MetaClass is a supertype of (or the same class as) the type represented by the given MetaClass.
 boolean isAssignableTo(Class clazz)
           
 boolean isAssignableTo(MetaClass clazz)
           
 boolean isDefaultInstantiable()
           
 boolean isPrimitiveWrapper()
           
 String toString()
           
 
Methods inherited from class org.jboss.errai.codegen.meta.MetaClass
asArrayOf, getCanonicalName, getComponentType, getConstructors, getDeclaredClasses, getDeclaredConstructors, getDeclaredField, getDeclaredFields, getDeclaredMethods, getErased, getField, getFields, getFullyQualifiedName, getInterfaces, getMethods, getName, getPackageName, getSuperClass, isAbstract, isAnnotation, isAnonymousClass, isArray, isConcrete, isEnum, isFinal, isInterface, isPrimitive, isPrivate, isProtected, isPublic, isStatic, isSynthetic, isVoid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.errai.codegen.meta.HasAnnotations
getAnnotations
 
Methods inherited from interface org.jboss.errai.codegen.meta.MetaGenericDeclaration
getTypeParameters
 

Field Detail

parameterizedType

protected MetaParameterizedType parameterizedType

genericSuperClass

protected MetaParameterizedType genericSuperClass
Constructor Detail

AbstractMetaClass

protected AbstractMetaClass(T enclosedMetaObject)
Method Detail

getFullyQualifiedNameWithTypeParms

public String getFullyQualifiedNameWithTypeParms()
Specified by:
getFullyQualifiedNameWithTypeParms in class MetaClass

_getMethod

protected static MetaMethod _getMethod(MetaMethod[] methods,
                                       String name,
                                       MetaClass... parmTypes)

_getConstructor

protected static MetaConstructor _getConstructor(MetaConstructor[] constructors,
                                                 MetaClass... parmTypes)

getMethod

public MetaMethod getMethod(String name,
                            Class... parmTypes)
Specified by:
getMethod in class MetaClass

getMethod

public MetaMethod getMethod(String name,
                            MetaClass... parameters)
Specified by:
getMethod in class MetaClass

getDeclaredMethod

public MetaMethod getDeclaredMethod(String name,
                                    Class... parmTypes)
Specified by:
getDeclaredMethod in class MetaClass

getDeclaredMethod

public MetaMethod getDeclaredMethod(String name,
                                    MetaClass... parmTypes)
Specified by:
getDeclaredMethod in class MetaClass

getBestMatchingMethod

public MetaMethod getBestMatchingMethod(String name,
                                        Class... parameters)
Specified by:
getBestMatchingMethod in class MetaClass

getBestMatchingMethod

public MetaMethod getBestMatchingMethod(String name,
                                        MetaClass... parameters)
Specified by:
getBestMatchingMethod in class MetaClass

getBestMatchingStaticMethod

public MetaMethod getBestMatchingStaticMethod(String name,
                                              Class... parameters)
Specified by:
getBestMatchingStaticMethod in class MetaClass

getBestMatchingStaticMethod

public MetaMethod getBestMatchingStaticMethod(String name,
                                              MetaClass... parameters)
Specified by:
getBestMatchingStaticMethod in class MetaClass

getBestMatchingConstructor

public MetaConstructor getBestMatchingConstructor(Class... parameters)
Specified by:
getBestMatchingConstructor in class MetaClass

getBestMatchingConstructor

public MetaConstructor getBestMatchingConstructor(MetaClass... parameters)
Specified by:
getBestMatchingConstructor in class MetaClass

getConstructor

public MetaConstructor getConstructor(Class... parameters)
Specified by:
getConstructor in class MetaClass

getConstructor

public MetaConstructor getConstructor(MetaClass... parameters)
Specified by:
getConstructor in class MetaClass

getDeclaredConstructor

public MetaConstructor getDeclaredConstructor(Class... parameters)
Specified by:
getDeclaredConstructor in class MetaClass

getInheritedField

public MetaField getInheritedField(String name)
Description copied from class: MetaClass
Searches for the named field in this type, its superinterfaces, and its superclasses.

The search proceeds as in MetaClass.getField(String), but includes all public, protected, default accessibility, and private fields. Whether a field is static or not does not affect this search.

Specified by:
getInheritedField in class MetaClass
Parameters:
name - The name of the field to search for. Not null.
Returns:
The first field with the given name that was encountered by the search.

getAnnotation

public final <A extends Annotation> A getAnnotation(Class<A> annotation)

isAnnotationPresent

public final boolean isAnnotationPresent(Class<? extends Annotation> annotation)

getMethodsAnnotatedWith

public final List<MetaMethod> getMethodsAnnotatedWith(Class<? extends Annotation> annotation)
Description copied from class: MetaClass
Returns all declared and inherited methods on this class that have the given annotation targeting them.

TODO: the returned collection should not include overridden methods from superclasses.

Specified by:
getMethodsAnnotatedWith in class MetaClass
Parameters:
annotation - The annotation to scan this class's methods for. Must not be null.
Returns:
An unmodifiable list of all declared and inherited methods of this class that are annotated with the given annotation.

getMethodsWithMetaAnnotations

public List<MetaMethod> getMethodsWithMetaAnnotations(Class<? extends Annotation> annotation)
Specified by:
getMethodsWithMetaAnnotations in class MetaClass

getFieldsAnnotatedWith

public final List<MetaField> getFieldsAnnotatedWith(Class<? extends Annotation> annotation)
Description copied from class: MetaClass
Returns all declared and inherited fields on this class that have the given annotation targeting them.

Specified by:
getFieldsAnnotatedWith in class MetaClass
Parameters:
annotation - The annotation to scan this class's fields for. Must not be null.
Returns:
An unmodifiable list of all declared and inherited fields of this class that are annotated with the given annotation.

getFieldsWithMetaAnnotations

public List<MetaField> getFieldsWithMetaAnnotations(Class<? extends Annotation> annotation)
Specified by:
getFieldsWithMetaAnnotations in class MetaClass

getParametersAnnotatedWith

public List<MetaParameter> getParametersAnnotatedWith(Class<? extends Annotation> annotation)
Specified by:
getParametersAnnotatedWith in class MetaClass

getEnclosedMetaObject

public T getEnclosedMetaObject()

isAssignableFrom

public boolean isAssignableFrom(MetaClass clazz)
Description copied from class: MetaClass
Reports if the type represented by this MetaClass is a supertype of (or the same class as) the type represented by the given MetaClass. In other words, this method returns true if the following code would compile without error, where ThisType is the class represented by this MetaClass object, and GivenType is the class represented by the given "clazz" argument:
   GivenType given = ...;
   ThisType a = given;
 

Specified by:
isAssignableFrom in class MetaClass
Parameters:
clazz - The type to check for assignability to this MetaClass's type.
Returns:
True if the given type is assignable to this metaclass's type.

isAssignableTo

public boolean isAssignableTo(MetaClass clazz)
Specified by:
isAssignableTo in class MetaClass

isAssignableFrom

public boolean isAssignableFrom(Class clazz)
Description copied from class: MetaClass
Reports if the type represented by this MetaClass is a supertype of (or the same class as) the given class. In other words, this method returns true if the following code would compile without error, where ThisType is the class represented by this MetaClass object, and GivenType is the class represented by the given "clazz" argument:
   GivenType given = ...;
   ThisType a = given;
 

Specified by:
isAssignableFrom in class MetaClass
Parameters:
clazz - The type to check for assignability to this MetaClass's type.
Returns:
True if the given type is assignable to this metaclass's type.

isAssignableTo

public boolean isAssignableTo(Class clazz)
Specified by:
isAssignableTo in class MetaClass

isDefaultInstantiable

public boolean isDefaultInstantiable()
Specified by:
isDefaultInstantiable in class MetaClass

getParameterizedType

public MetaParameterizedType getParameterizedType()
Specified by:
getParameterizedType in class MetaClass

getGenericSuperClass

public MetaParameterizedType getGenericSuperClass()
Specified by:
getGenericSuperClass in class MetaClass

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

asClass

public Class<?> asClass()
Specified by:
asClass in class MetaClass

asBoxed

public MetaClass asBoxed()
Specified by:
asBoxed in class MetaClass

asUnboxed

public MetaClass asUnboxed()
Specified by:
asUnboxed in class MetaClass

isPrimitiveWrapper

public boolean isPrimitiveWrapper()
Specified by:
isPrimitiveWrapper in class MetaClass

getInternalName

public String getInternalName()
Specified by:
getInternalName in class MetaClass

getInternalPrimitiveNameFrom

public static String getInternalPrimitiveNameFrom(String name)

getBeanDescriptor

public BeanDescriptor getBeanDescriptor()
Specified by:
getBeanDescriptor in class MetaClass

getOuterComponentType

public MetaClass getOuterComponentType()
Specified by:
getOuterComponentType in class MetaClass

toString

public String toString()
Overrides:
toString in class Object

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.