org.jboss.reflect.spi
Class PrimitiveInfo

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.reflect.spi.AbstractTypeInfo
          extended by org.jboss.reflect.spi.PrimitiveInfo
All Implemented Interfaces:
Serializable, Cloneable, TypeInfo, org.jboss.util.JBossInterface
Direct Known Subclasses:
NumberInfo

public class PrimitiveInfo
extends AbstractTypeInfo

Primitive info TODO JBMICROCONT-118 fix the introspection assumption

Author:
Bill Burke, Adrian Brock
See Also:
Serialized Form

Field Summary
static PrimitiveInfo BOOLEAN
          The boolean info
static PrimitiveInfo BYTE
          The byte info
static PrimitiveInfo CHAR
          The char info
static PrimitiveInfo DOUBLE
          The double info
static PrimitiveInfo FLOAT
          The float info
static PrimitiveInfo INT
          The int info
static PrimitiveInfo LONG
          The long info
protected  String name
          The name
protected  int ordinal
          The ordinal
static PrimitiveInfo SHORT
          The short info
protected  Class<? extends Object> type
          The type
protected static TypeInfoFactory typeInfoFactory
          The type info factory
static PrimitiveInfo VOID
          The void info
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
protected PrimitiveInfo(String name, int ordinal, Class<? extends Object> type)
          Create a new primitive info
 
Method Summary
protected  boolean canProgress(Class<?> clazz)
          Can we progress class param to this type info.
 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)
           
 TypeInfo getArrayType()
          Get an array type
 String getName()
          Get the type name
static Class<?> getPrimativeArrayComponentType(String name)
          Get the primtive array type class map for a name
static String getPrimativeArrayType(String name)
          Get a primtive array type
static Class<?> getPrimativeType(String name)
          Get the primtive type for a name
 String getSimpleName()
          Get the simple name
 Class<?> getType()
          Deprecated. 
 TypeInfoFactory getTypeInfoFactory()
          Get the TypeInfoFactory that created this type info
 int hashCode()
           
 boolean isAssignableFrom(TypeInfo info)
          Mostly using
 boolean isInstance(Object object)
          Is object instance of this type info.
 boolean isPrimitive()
          Whether this type is a primitive
 Object newArrayInstance(int size)
          Create a new array
 int ordinal()
          Get the ordinal
 String toShortString()
           
 String toString()
           
static PrimitiveInfo valueOf(String name)
          Get the primitive info for a type
 
Methods inherited from class org.jboss.reflect.spi.AbstractTypeInfo
getAttachment, getAttachment, isAnnotation, isArray, isCollection, isEnum, isMap, setAttachment
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, getHashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BOOLEAN

public static final PrimitiveInfo BOOLEAN
The boolean info


BYTE

public static final PrimitiveInfo BYTE
The byte info


CHAR

public static final PrimitiveInfo CHAR
The char info


DOUBLE

public static final PrimitiveInfo DOUBLE
The double info


FLOAT

public static final PrimitiveInfo FLOAT
The float info


INT

public static final PrimitiveInfo INT
The int info


LONG

public static final PrimitiveInfo LONG
The long info


SHORT

public static final PrimitiveInfo SHORT
The short info


VOID

public static final PrimitiveInfo VOID
The void info


typeInfoFactory

protected static final TypeInfoFactory typeInfoFactory
The type info factory


name

protected final transient String name
The name


ordinal

protected final int ordinal
The ordinal


type

protected final transient Class<? extends Object> type
The type

Constructor Detail

PrimitiveInfo

protected PrimitiveInfo(String name,
                        int ordinal,
                        Class<? extends Object> type)
Create a new primitive info

Parameters:
name - the name
ordinal - the oridinal
type - the class
Method Detail

valueOf

public static PrimitiveInfo valueOf(String name)
Get the primitive info for a type

Parameters:
name - the name
Returns:
the info

getPrimativeArrayType

public static String getPrimativeArrayType(String name)
Get a primtive array type

Parameters:
name - the primtive type name
Returns:
the array type or null if not found

getPrimativeType

public static Class<?> getPrimativeType(String name)
Get the primtive type for a name

Parameters:
name - the primtive type name
Returns:
the primitive type

getPrimativeArrayComponentType

public static Class<?> getPrimativeArrayComponentType(String name)
Get the primtive array type class map for a name

Parameters:
name - the array type name
Returns:
the component type

ordinal

public int ordinal()
Get the ordinal

Returns:
the oridinal

getName

public String getName()
Description copied from interface: TypeInfo
Get the type name

Returns:
the name

getSimpleName

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

Returns:
the simple name

getType

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

Description copied from interface: TypeInfo
Get the class

Returns:
the class

convertValue

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

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

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

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

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

getArrayType

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

Returns:
the array type

newArrayInstance

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

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

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.

Parameters:
object - the object to check
Returns:
true if object is an instance of this class
See Also:
PrimitiveInfo tests for progression

canProgress

protected boolean canProgress(Class<?> clazz)
Can we progress class param to this type info.

Parameters:
clazz - the class to progress
Returns:
true if we can progress, false otherwise

getTypeInfoFactory

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

Returns:
type info factory

toString

public String toString()
Overrides:
toString in class org.jboss.util.JBossObject

toShortString

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

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class org.jboss.util.JBossObject


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