JBoss Reflection 2.2.1.SP1

org.jboss.reflect.spi
Class DelegateClassInfo

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.reflect.spi.AbstractTypeInfo
          extended by org.jboss.reflect.spi.DelegateClassInfo
All Implemented Interfaces:
Serializable, Cloneable, AnnotatedInfo, ClassInfo, InterfaceInfo, ModifierInfo, TypeInfo, org.jboss.util.JBossInterface
Direct Known Subclasses:
BytecodeParameterizedClassInfo, JavassistParameterizedClassInfo, ParameterizedClassInfo

public class DelegateClassInfo
extends AbstractTypeInfo
implements ClassInfo, InterfaceInfo

Delegate ClassInfo

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Field Summary
protected  ClassInfo delegate
          The delegate
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Fields inherited from interface org.jboss.reflect.spi.ModifierInfo
ABSTRACT, CONSTANT, FINAL, PACKAGE, PACKAGE_ABSTRACT, PACKAGE_CONSTANT, PACKAGE_STATIC, PRIVATE, PRIVATE_CONSTANT, PRIVATE_STATIC, PROTECTED, PROTECTED_ABSTRACT, PROTECTED_CONSTANT, PROTECTED_STATIC, PUBLIC, PUBLIC_ABSTRACT, PUBLIC_CONSTANT, PUBLIC_STATIC, STATIC
 
Constructor Summary
DelegateClassInfo(ClassInfo delegate)
          Create delegate class info
DelegateClassInfo(ClassInfo delegate, boolean allowNull)
          Create delegate class info
 
Method Summary
 Object convertValue(Object value)
          Convert a value
 Object convertValue(Object value, boolean replaceProperties)
          Convert a value
 Object convertValue(Object value, boolean replaceProperties, boolean trim)
          Convert a value
 boolean equals(Object obj)
           
 boolean equals(Object obj, Set<String> doneTypeVariables)
           
 TypeInfo[] getActualTypeArguments()
          Get the actual type parameters
 AnnotationValue getAnnotation(String name)
          Get an annotation
 AnnotationValue[] getAnnotations()
          Get the annotations
 TypeInfo getArrayType()
          Get an array type
 ClassLoader getClassLoader()
          Get the classloader for this class info.
 TypeInfo getComponentType()
          Get the component type if it is a collection or an array
 ConstructorInfo getDeclaredConstructor(TypeInfo... parameters)
          Get a declared constructor
 ConstructorInfo[] getDeclaredConstructors()
          Get the declared constructors
 FieldInfo getDeclaredField(String name)
          Get the declared field
 FieldInfo[] getDeclaredFields()
          Get the declared fields
 MethodInfo getDeclaredMethod(String name, TypeInfo... parameters)
          Get the declared method
 MethodInfo[] getDeclaredMethods()
          Get the declared methods
 ClassInfo getDelegate()
           
 InterfaceInfo[] getGenericInterfaces()
          Get the generic interfaces
 ClassInfo getGenericSuperclass()
          Get the generic super class
protected  int getHashCode()
           
 InterfaceInfo[] getInterfaces()
          Get the interfaces
 TypeInfo getKeyType()
          Get the key type if it is a map
 int getModifiers()
          Get the modifiers
 String getName()
          Get the class name
 TypeInfo getOwnerType()
          Get the owner type
 PackageInfo getPackage()
          Get the package
 ClassInfo getRawType()
          Get the raw type
 String getSimpleName()
          Get the simple name
 ClassInfo getSuperclass()
          Get the super class
 Class<?> getType()
          Deprecated. 
 TypeInfoFactory getTypeInfoFactory()
          Get the TypeInfoFactory that created this type info
 String getTypeVariable()
          Gets the type variable if we are a parameterized type which is part of a parameterized type and there is a type variable for this type.
<T extends Annotation>
T
getUnderlyingAnnotation(Class<T> annotationType)
          Get an underlying annotation
 Annotation[] getUnderlyingAnnotations()
          Get the underlying annotations
 TypeInfo getValueType()
          Get the value type if it is a map
 boolean isAnnotation()
          Whether this type is an annotation
 boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
          Test whether an annotation is present
 boolean isAnnotationPresent(String name)
          Test whether an annotation is present
 boolean isArray()
          Whether this type is an array
 boolean isAssignableFrom(TypeInfo info)
          Mostly using
 boolean isCollection()
          Whether this type is a collection
 boolean isEnum()
          Whether this type is an enum
 boolean isInitialized()
          Whether the delegate is initialized
 boolean isInstance(Object object)
          Is object instance of this type info.
 boolean isInterface()
          Whether it is an interface
 boolean isMap()
          Whether this type is a map
 boolean isPrimitive()
          Whether this type is a primitive
 boolean isPublic()
           
 boolean isStatic()
          Whether it is static
 boolean isVolatile()
          Whether it is volatile
 Object newArrayInstance(int size)
          Create a new array
 void setDelegate(ClassInfo delegate)
          Set the delegate
 void setDelegate(TypeInfo delegate)
          Set the delegate
 void toShortString(org.jboss.util.JBossStringBuilder buffer)
           
protected  void toString(org.jboss.util.JBossStringBuilder buffer)
           
 
Methods inherited from class org.jboss.reflect.spi.AbstractTypeInfo
getAttachment, getAttachment, setAttachment
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, hashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.util.JBossInterface
clone, toShortString
 
Methods inherited from interface org.jboss.reflect.spi.TypeInfo
getAttachment, getAttachment, setAttachment
 

Field Detail

delegate

protected ClassInfo delegate
The delegate

Constructor Detail

DelegateClassInfo

public DelegateClassInfo(ClassInfo delegate)
Create delegate class info

Parameters:
delegate - the raw array info
Throws:
IllegalArgumentException - for a null delegate

DelegateClassInfo

public DelegateClassInfo(ClassInfo delegate,
                         boolean allowNull)
Create delegate class info

Parameters:
delegate - the raw array info
allowNull - whether to allow a null delegate
Throws:
IllegalArgumentException - when delegate is null and allowNull equals false
Method Detail

isInitialized

public boolean isInitialized()
Whether the delegate is initialized

Returns:
true when there is a delegate

setDelegate

public void setDelegate(TypeInfo delegate)
Set the delegate

Parameters:
delegate - the delegate
Throws:
IllegalArgumentException - for a null delegate or it is not a ClassInfo

setDelegate

public void setDelegate(ClassInfo delegate)
Set the delegate

Parameters:
delegate - the delegate
Throws:
IllegalArgumentException - for a null delegate

getDelegate

public ClassInfo getDelegate()

getTypeInfoFactory

public TypeInfoFactory getTypeInfoFactory()
Description copied from interface: TypeInfo
Get the TypeInfoFactory that created this type info

Specified by:
getTypeInfoFactory in interface TypeInfo
Returns:
type info factory

getDeclaredConstructor

public ConstructorInfo getDeclaredConstructor(TypeInfo... parameters)
Description copied from interface: ClassInfo
Get a declared constructor

Specified by:
getDeclaredConstructor in interface ClassInfo
Parameters:
parameters - the parameters
Returns:
the constructor

getDeclaredConstructors

public ConstructorInfo[] getDeclaredConstructors()
Description copied from interface: ClassInfo
Get the declared constructors

Specified by:
getDeclaredConstructors in interface ClassInfo
Returns:
the constructors

getDeclaredField

public FieldInfo getDeclaredField(String name)
Description copied from interface: ClassInfo
Get the declared field

Specified by:
getDeclaredField in interface ClassInfo
Parameters:
name - the field name
Returns:
the field

getDeclaredFields

public FieldInfo[] getDeclaredFields()
Description copied from interface: ClassInfo
Get the declared fields

Specified by:
getDeclaredFields in interface ClassInfo
Returns:
the fields

getDeclaredMethod

public MethodInfo getDeclaredMethod(String name,
                                    TypeInfo... parameters)
Description copied from interface: ClassInfo
Get the declared method

Specified by:
getDeclaredMethod in interface ClassInfo
Parameters:
name - the method name
parameters - the parameters
Returns:
the method info

getDeclaredMethods

public MethodInfo[] getDeclaredMethods()
Description copied from interface: ClassInfo
Get the declared methods

Specified by:
getDeclaredMethods in interface ClassInfo
Returns:
the methods

getGenericInterfaces

public InterfaceInfo[] getGenericInterfaces()
Description copied from interface: ClassInfo
Get the generic interfaces

Specified by:
getGenericInterfaces in interface ClassInfo
Returns:
the generic interfaces

getGenericSuperclass

public ClassInfo getGenericSuperclass()
Description copied from interface: ClassInfo
Get the generic super class

Specified by:
getGenericSuperclass in interface ClassInfo
Returns:
the super class

getInterfaces

public InterfaceInfo[] getInterfaces()
Description copied from interface: ClassInfo
Get the interfaces

Specified by:
getInterfaces in interface ClassInfo
Returns:
the interfaces

getName

public String getName()
Description copied from interface: ClassInfo
Get the class name

Specified by:
getName in interface ClassInfo
Specified by:
getName in interface TypeInfo
Returns:
the name

getSimpleName

public String getSimpleName()
Description copied from interface: TypeInfo
Get the simple name

Specified by:
getSimpleName in interface TypeInfo
Returns:
the simple name

getSuperclass

public ClassInfo getSuperclass()
Description copied from interface: ClassInfo
Get the super class

Specified by:
getSuperclass in interface ClassInfo
Returns:
the super class

isInterface

public boolean isInterface()
Description copied from interface: ClassInfo
Whether it is an interface

Specified by:
isInterface in interface ClassInfo
Returns:
true when an interface

getAnnotation

public AnnotationValue getAnnotation(String name)
Description copied from interface: AnnotatedInfo
Get an annotation

Specified by:
getAnnotation in interface AnnotatedInfo
Parameters:
name - the name
Returns:
the annotation or null if it is not there

getAnnotations

public AnnotationValue[] getAnnotations()
Description copied from interface: AnnotatedInfo
Get the annotations

Specified by:
getAnnotations in interface AnnotatedInfo
Returns:
the annotations. If there are no annotations a zero length array is returned

isAnnotationPresent

public boolean isAnnotationPresent(String name)
Description copied from interface: AnnotatedInfo
Test whether an annotation is present

Specified by:
isAnnotationPresent in interface AnnotatedInfo
Parameters:
name - the name
Returns:
true when the annotation is present

getUnderlyingAnnotation

public <T extends Annotation> T getUnderlyingAnnotation(Class<T> annotationType)
Description copied from interface: AnnotatedInfo
Get an underlying annotation

Specified by:
getUnderlyingAnnotation in interface AnnotatedInfo
Type Parameters:
T - the annotation type
Parameters:
annotationType - the annotationType
Returns:
the annotation or null if it is not there

getUnderlyingAnnotations

public Annotation[] getUnderlyingAnnotations()
Description copied from interface: AnnotatedInfo
Get the underlying annotations

Specified by:
getUnderlyingAnnotations in interface AnnotatedInfo
Returns:
the annotations. If there are no annotations a zero length array is returned

isAnnotationPresent

public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
Description copied from interface: AnnotatedInfo
Test whether an annotation is present

Specified by:
isAnnotationPresent in interface AnnotatedInfo
Returns:
true when the annotation is present

getModifiers

public int getModifiers()
Description copied from interface: ModifierInfo
Get the modifiers

Specified by:
getModifiers in interface ModifierInfo
Returns:
the modifiers

isPublic

public boolean isPublic()
Specified by:
isPublic in interface ModifierInfo

isStatic

public boolean isStatic()
Description copied from interface: ModifierInfo
Whether it is static

Specified by:
isStatic in interface ModifierInfo
Returns:
true when static

isVolatile

public boolean isVolatile()
Description copied from interface: ModifierInfo
Whether it is volatile

Specified by:
isVolatile in interface ModifierInfo
Returns:
true if volatile

convertValue

public Object convertValue(Object value)
                    throws Throwable
Description copied from interface: TypeInfo
Convert a value

Specified by:
convertValue in interface TypeInfo
Parameters:
value - the original value
Returns:
the converted value
Throws:
Throwable - for any error

convertValue

public Object convertValue(Object value,
                           boolean replaceProperties)
                    throws Throwable
Description copied from interface: TypeInfo
Convert a value

Specified by:
convertValue in interface TypeInfo
Parameters:
value - the original value
replaceProperties - whether to replace properties
Returns:
the converted value
Throws:
Throwable - for any error

convertValue

public Object convertValue(Object value,
                           boolean replaceProperties,
                           boolean trim)
                    throws Throwable
Description copied from interface: TypeInfo
Convert a value

Specified by:
convertValue in interface TypeInfo
Parameters:
value - the original value
replaceProperties - whether to replace properties
trim - do we trim before conversion
Returns:
the converted value
Throws:
Throwable - for any error

getArrayType

public TypeInfo getArrayType()
Description copied from interface: TypeInfo
Get an array type

Specified by:
getArrayType in interface TypeInfo
Returns:
the array type

getType

@Deprecated
public Class<?> getType()
Deprecated. 

Description copied from interface: TypeInfo
Get the class

Specified by:
getType in interface TypeInfo
Returns:
the class

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: TypeInfo
Get the classloader for this class info. Delay type creation if possible.

Specified by:
getClassLoader in interface TypeInfo
Returns:
class info's classloader

isAnnotation

public boolean isAnnotation()
Description copied from interface: TypeInfo
Whether this type is an annotation

Specified by:
isAnnotation in interface TypeInfo
Overrides:
isAnnotation in class AbstractTypeInfo
Returns:
true when an annotation

isCollection

public boolean isCollection()
Description copied from interface: TypeInfo
Whether this type is a collection

Specified by:
isCollection in interface TypeInfo
Overrides:
isCollection in class AbstractTypeInfo
Returns:
true when a collection

isMap

public boolean isMap()
Description copied from interface: TypeInfo
Whether this type is a map

Specified by:
isMap in interface TypeInfo
Overrides:
isMap in class AbstractTypeInfo
Returns:
true when a map

isArray

public boolean isArray()
Description copied from interface: TypeInfo
Whether this type is an array

Specified by:
isArray in interface TypeInfo
Overrides:
isArray in class AbstractTypeInfo
Returns:
true when an array

isEnum

public boolean isEnum()
Description copied from interface: TypeInfo
Whether this type is an enum

Specified by:
isEnum in interface TypeInfo
Overrides:
isEnum in class AbstractTypeInfo
Returns:
true when an enum

isPrimitive

public boolean isPrimitive()
Description copied from interface: TypeInfo
Whether this type is a primitive

Specified by:
isPrimitive in interface TypeInfo
Overrides:
isPrimitive in class AbstractTypeInfo
Returns:
true when a primtive

newArrayInstance

public Object newArrayInstance(int size)
                        throws Throwable
Description copied from interface: TypeInfo
Create a new array

Specified by:
newArrayInstance in interface TypeInfo
Parameters:
size - the size
Returns:
the converted value
Throws:
Throwable - for any error

isAssignableFrom

public boolean isAssignableFrom(TypeInfo info)
Description copied from interface: TypeInfo
Mostly using

Specified by:
isAssignableFrom in interface TypeInfo
Parameters:
info - type info
Returns:
the boolean value indicating whether objects of the TypeInfo info can be assigned to objects of this TypeInfo
See Also:
PrimitiveInfo tests for progression

isInstance

public boolean isInstance(Object object)
Description copied from interface: TypeInfo
Is object instance of this type info.

Specified by:
isInstance in interface TypeInfo
Parameters:
object - the object to check
Returns:
true if object is an instance of this class
See Also:
PrimitiveInfo tests for progression

getActualTypeArguments

public TypeInfo[] getActualTypeArguments()
Description copied from interface: ClassInfo
Get the actual type parameters

Specified by:
getActualTypeArguments in interface ClassInfo
Returns:
the type parameters. If there are none, a zero length array is returned

getOwnerType

public TypeInfo getOwnerType()
Description copied from interface: ClassInfo
Get the owner type

Specified by:
getOwnerType in interface ClassInfo
Returns:
the owner type

getRawType

public ClassInfo getRawType()
Description copied from interface: ClassInfo
Get the raw type

Specified by:
getRawType in interface ClassInfo
Returns:
the raw type

getComponentType

public TypeInfo getComponentType()
Description copied from interface: ClassInfo
Get the component type if it is a collection or an array

Specified by:
getComponentType in interface ClassInfo
Returns:
the component type

getKeyType

public TypeInfo getKeyType()
Description copied from interface: ClassInfo
Get the key type if it is a map

Specified by:
getKeyType in interface ClassInfo
Returns:
the key type

getValueType

public TypeInfo getValueType()
Description copied from interface: ClassInfo
Get the value type if it is a map

Specified by:
getValueType in interface ClassInfo
Returns:
the value type

getPackage

public PackageInfo getPackage()
Description copied from interface: ClassInfo
Get the package

Specified by:
getPackage in interface ClassInfo
Returns:
the package

getHashCode

protected int getHashCode()
Overrides:
getHashCode in class org.jboss.util.JBossObject

equals

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

equals

public boolean equals(Object obj,
                      Set<String> doneTypeVariables)

getTypeVariable

public String getTypeVariable()
Description copied from interface: ClassInfo
Gets the type variable if we are a parameterized type which is part of a parameterized type and there is a type variable for this type. This is useful in avoiding infinite recursion

Specified by:
getTypeVariable in interface ClassInfo
Returns:
the type variable

toShortString

public void toShortString(org.jboss.util.JBossStringBuilder buffer)
Specified by:
toShortString in interface org.jboss.util.JBossInterface
Overrides:
toShortString in class org.jboss.util.JBossObject

toString

protected void toString(org.jboss.util.JBossStringBuilder buffer)
Overrides:
toString in class org.jboss.util.JBossObject

JBoss Reflection 2.2.1.SP1

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.