public class DefaultMetaValueFactory extends MetaValueFactory
Constructor and Description |
---|
DefaultMetaValueFactory() |
Modifier and Type | Method and Description |
---|---|
protected org.jboss.reflect.spi.TypeInfo |
checkTypeInfo(org.jboss.reflect.spi.TypeInfo type,
Object value,
MetaType metaType)
Do a simple check.
|
static Object[] |
convertPrimativeArray(Object value)
Transform a primitive array into an Object[].
|
static Object[] |
convertPrimativeArray(org.jboss.reflect.spi.TypeInfo type,
Object value)
Transform a primitive array into an Object[].
|
protected Object |
convertValue(Object value,
org.jboss.reflect.spi.TypeInfo typeInfo)
Convert the value.
|
MetaValue |
create(Object value)
Create a meta value
|
MetaValue |
create(Object value,
MetaType type)
Create a meta value given its MetaType
|
MetaValue |
create(Object value,
Type type)
Create a meta value
|
MetaValue |
create(Object value,
org.jboss.reflect.spi.TypeInfo type)
Create a meta value
|
protected Object[] |
createArray(MetaType elementType,
Class<?> componentType,
int dimension,
Object[] oldArray)
Create an array
|
ArrayValue |
createArrayValue(ArrayMetaType type,
Object value,
Map<Object,MetaValue> mapping)
Create an array value
|
CollectionValue |
createCollectionValue(CollectionMetaType type,
Object value,
Map<Object,MetaValue> mapping)
Create a collection value
|
CompositeValue |
createCompositeValue(CompositeMetaType type,
Object value,
Map<Object,MetaValue> mapping)
Create a composite value
|
protected InvocationHandler |
createCompositeValueInvocationHandler(CompositeValue compositeValue)
Create composite invocation handler.
|
static <T extends Enum<?>> |
createEnumValue(EnumMetaType type,
T value)
Create an enum value
|
static GenericValue |
createGenericValue(GenericMetaType type,
Object value,
Map<Object,MetaValue> mapping)
Create a generic value
|
protected Map<?,?> |
createMap(TableValue tableValue,
org.jboss.reflect.spi.TypeInfo keyType,
org.jboss.reflect.spi.TypeInfo valueType)
Create a map
|
protected Object |
createNewInstance(org.jboss.beans.info.spi.BeanInfo beanInfo)
Create new instance.
|
protected MetaValue |
createPropertiesValue(PropertiesMetaType metaType,
Object value,
Map<Object,MetaValue> mapping)
Create a PropertiesMetaValue
|
static SimpleValue |
createSimpleValue(SimpleMetaType type,
Serializable value)
Create a simple value
|
TableValue |
createTableValue(TableMetaType type,
Map value,
Map<Object,MetaValue> mapping)
Create a table value
|
protected org.jboss.reflect.spi.TypeInfo |
getTypeInfo(MetaType metaType,
ClassLoader cl)
Get the class info from meta type.
|
protected org.jboss.reflect.spi.TypeInfo |
getTypeInfo(MetaType metaType,
Object value)
Get the class info from meta type.
|
protected Object |
getValue(MetaType metaType,
org.jboss.reflect.spi.TypeInfo typeInfo,
Object value)
Get the value.
|
protected MetaValue |
internalCreate(Object value,
org.jboss.reflect.spi.TypeInfo type,
MetaType metaType)
Create a meta value from the object
|
protected Object |
internalUnwrap(MetaValue metaValue,
org.jboss.reflect.spi.TypeInfo type)
Unwrap value from meta value.
|
protected MetaValue |
isBuilder(MetaType metaType,
org.jboss.reflect.spi.TypeInfo type,
Object value,
Map<Object,MetaValue> mapping)
Check for a builder
|
static Object |
mapNullToPrimitive(org.jboss.reflect.spi.TypeInfo type)
Map null to primitive.
|
protected Object |
newArrayInstance(org.jboss.reflect.spi.TypeInfo typeInfo,
int size)
Get new array instance.
|
void |
setBuilder(Class<?> clazz,
MetaValueBuilder<?> builder)
Set a meta value builder.
|
<T> void |
setInstanceFactory(Class<T> clazz,
InstanceFactory<T> factory)
Set an instance factory.
|
Object |
unwrap(MetaValue metaValue)
Unwrap meta value.
|
Object |
unwrap(MetaValue metaValue,
Type type)
Unwrap meta value.
|
Object |
unwrap(MetaValue metaValue,
org.jboss.reflect.spi.TypeInfo type)
Unwrap meta value.
|
protected Object |
unwrapArray(Object array,
Object element)
Unwrap array.
|
protected Object |
unwrapCollection(CollectionValue collectionValue,
org.jboss.reflect.spi.TypeInfo type)
Unwrap collection meta value.
|
protected Object |
unwrapComposite(CompositeValue compositeValue,
org.jboss.reflect.spi.TypeInfo typeInfo)
Unwrap composite.
|
protected Map |
unwrapCompositeMap(CompositeValue compositeValue) |
protected Object |
unwrapMetaValue(MetaValue element,
org.jboss.reflect.spi.TypeInfo type,
Object array)
Unwrap MetaValue.
|
protected Object |
unwrapProperties(PropertiesMetaValue propsValue,
org.jboss.reflect.spi.TypeInfo type) |
protected Object |
unwrapTable(TableValue tableValue,
org.jboss.reflect.spi.TypeInfo type)
Unwrap table meta value.
|
getInstance
public void setBuilder(Class<?> clazz, MetaValueBuilder<?> builder)
MetaValueFactory
setBuilder
in class MetaValueFactory
clazz
- the classbuilder
- the builderpublic <T> void setInstanceFactory(Class<T> clazz, InstanceFactory<T> factory)
MetaValueFactory
setInstanceFactory
in class MetaValueFactory
T
- exact instance typeclazz
- the classfactory
- the factorypublic static SimpleValue createSimpleValue(SimpleMetaType type, Serializable value)
type
- the typevalue
- the valuepublic static <T extends Enum<?>> EnumValue createEnumValue(EnumMetaType type, T value)
T
- the enum typetype
- the typevalue
- the valuepublic static GenericValue createGenericValue(GenericMetaType type, Object value, Map<Object,MetaValue> mapping)
type
- the typevalue
- the valuemapping
- the mappingpublic CollectionValue createCollectionValue(CollectionMetaType type, Object value, Map<Object,MetaValue> mapping)
type
- the typevalue
- the valuemapping
- the mappingpublic static Object[] convertPrimativeArray(org.jboss.reflect.spi.TypeInfo type, Object value)
type
- - the primitive array class type info.value
- - the primitive array instance.public static Object mapNullToPrimitive(org.jboss.reflect.spi.TypeInfo type)
type
- the type infopublic static Object[] convertPrimativeArray(Object value)
value
- - the primitive array instance.public ArrayValue createArrayValue(ArrayMetaType type, Object value, Map<Object,MetaValue> mapping)
type
- the typevalue
- the valuemapping
- the mappingprotected Object[] createArray(MetaType elementType, Class<?> componentType, int dimension, Object[] oldArray)
elementType
- the element typecomponentType
- the component typedimension
- the dimensionoldArray
- the old arraypublic CompositeValue createCompositeValue(CompositeMetaType type, Object value, Map<Object,MetaValue> mapping)
type
- the typevalue
- the valuemapping
- the mappingpublic TableValue createTableValue(TableMetaType type, Map value, Map<Object,MetaValue> mapping)
type
- the typevalue
- the valuemapping
- the mappingpublic MetaValue create(Object value)
MetaValueFactory
create
in class MetaValueFactory
value
- the valuepublic MetaValue create(Object value, Type type)
MetaValueFactory
create
in class MetaValueFactory
value
- the valuetype
- the typepublic MetaValue create(Object value, org.jboss.reflect.spi.TypeInfo type)
MetaValueFactory
create
in class MetaValueFactory
value
- the valuetype
- the typepublic MetaValue create(Object value, MetaType type)
MetaValueFactory
create
in class MetaValueFactory
type
- the meta typepublic Object unwrap(MetaValue metaValue)
MetaValueFactory
unwrap
in class MetaValueFactory
metaValue
- meta valuepublic Object unwrap(MetaValue metaValue, Type type)
MetaValueFactory
unwrap
in class MetaValueFactory
metaValue
- meta valuetype
- the typepublic Object unwrap(MetaValue metaValue, org.jboss.reflect.spi.TypeInfo type)
MetaValueFactory
unwrap
in class MetaValueFactory
metaValue
- meta valuetype
- the typeprotected Object internalUnwrap(MetaValue metaValue, org.jboss.reflect.spi.TypeInfo type)
metaValue
- the meta valuetype
- expected type infoprotected org.jboss.reflect.spi.TypeInfo checkTypeInfo(org.jboss.reflect.spi.TypeInfo type, Object value, MetaType metaType)
type
- the type infovalue
- tester valuemetaType
- the meta typeprotected Object getValue(MetaType metaType, org.jboss.reflect.spi.TypeInfo typeInfo, Object value)
metaType
- the meta typetypeInfo
- the type infovalue
- the valueprotected Object unwrapMetaValue(MetaValue element, org.jboss.reflect.spi.TypeInfo type, Object array)
element
- the meta valuetype
- parent typearray
- parent arrayprotected Object unwrapArray(Object array, Object element)
array
- parent arrayelement
- current array elementprotected Object unwrapProperties(PropertiesMetaValue propsValue, org.jboss.reflect.spi.TypeInfo type)
protected Object unwrapComposite(CompositeValue compositeValue, org.jboss.reflect.spi.TypeInfo typeInfo)
compositeValue
- the composite valuetypeInfo
- expected type infoprotected Map unwrapCompositeMap(CompositeValue compositeValue)
protected InvocationHandler createCompositeValueInvocationHandler(CompositeValue compositeValue)
compositeValue
- the composite valueprotected Object unwrapCollection(CollectionValue collectionValue, org.jboss.reflect.spi.TypeInfo type)
collectionValue
- the collection valuetype
- the type infoprotected Object unwrapTable(TableValue tableValue, org.jboss.reflect.spi.TypeInfo type)
tableValue
- the table valuetype
- the type infoprotected Map<?,?> createMap(TableValue tableValue, org.jboss.reflect.spi.TypeInfo keyType, org.jboss.reflect.spi.TypeInfo valueType)
tableValue
- the table valuekeyType
- the key typevalueType
- the value typeprotected MetaValue createPropertiesValue(PropertiesMetaType metaType, Object value, Map<Object,MetaValue> mapping)
metaType
- value
- mapping
- protected Object createNewInstance(org.jboss.beans.info.spi.BeanInfo beanInfo) throws Throwable
beanInfo
- the bean infoThrowable
- for any errorprotected Object newArrayInstance(org.jboss.reflect.spi.TypeInfo typeInfo, int size)
typeInfo
- the type infosize
- the sizeprotected org.jboss.reflect.spi.TypeInfo getTypeInfo(MetaType metaType, Object value)
metaType
- the meta typevalue
- the value which can provide classloaderprotected org.jboss.reflect.spi.TypeInfo getTypeInfo(MetaType metaType, ClassLoader cl)
metaType
- the meta typecl
- the classloaderprotected MetaValue internalCreate(Object value, org.jboss.reflect.spi.TypeInfo type, MetaType metaType)
value
- the valuetype
- the typemetaType
- the metaTypeprotected Object convertValue(Object value, org.jboss.reflect.spi.TypeInfo typeInfo)
value
- the valuetypeInfo
- type infoUndeclaredThrowableException
- for any errorCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.