public interface TypeInfo extends Serializable
Modifier and Type | Method and Description |
---|---|
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
|
TypeInfo |
getArrayType()
Get an array type
|
<T> T |
getAttachment(Class<T> expectedType)
Get an attachment from the type,
uses the expected type as both the name
and to cast the resulting object.
|
Object |
getAttachment(String name)
Get an attachment from the type
|
String |
getName()
Get the type name
|
String |
getSimpleName()
Get the simple name
|
Class<?> |
getType()
Deprecated.
I'm not sure this should be here?
|
TypeInfoFactory |
getTypeInfoFactory()
Get the TypeInfoFactory that created this type info
|
boolean |
isAnnotation()
Whether this type is an annotation
|
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 |
isInstance(Object object)
Is object instance of this type info.
|
boolean |
isMap()
Whether this type is a map
|
boolean |
isPrimitive()
Whether this type is a primitive
|
Object |
newArrayInstance(int size)
Create a new array
|
void |
setAttachment(String name,
Object attachment)
Set an attachment against the type.
|
String getName()
String getSimpleName()
Class<?> getType()
Object convertValue(Object value) throws Throwable
value
- the original valueThrowable
- for any errorObject convertValue(Object value, boolean replaceProperties) throws Throwable
value
- the original valuereplaceProperties
- whether to replace propertiesThrowable
- for any errorObject convertValue(Object value, boolean replaceProperties, boolean trim) throws Throwable
value
- the original valuereplaceProperties
- whether to replace propertiestrim
- do we trim before conversionThrowable
- for any errorboolean isArray()
boolean isCollection()
boolean isMap()
boolean isAnnotation()
boolean isEnum()
boolean isPrimitive()
TypeInfo getArrayType()
Object newArrayInstance(int size) throws Throwable
size
- the sizeThrowable
- for any errorboolean isAssignableFrom(TypeInfo info)
info
- type infoNullPointerException
- if the specified TypeInfo parameter is
null.PrimitiveInfo tests for progression
boolean isInstance(Object object)
object
- the object to checkobject
is an instance of this classPrimitiveInfo tests for progression
TypeInfoFactory getTypeInfoFactory()
Object getAttachment(String name)
name
- the name<T> T getAttachment(Class<T> expectedType)
T
- the expected typeexpectedType
- the expected typeClassCastException
- when the object is not of the expected typevoid setAttachment(String name, Object attachment)
If you add a future object, subsequent gets will wait for the result
WARNING: Be careful about what you put in here. Don't create references across classloaders, if you are not sure add a WeakReference to the information.
name
- the nameattachment
- the attachment, pass null to remove an attachmentIllegalArgumentException
- for a null nameCopyright © 2017 JBoss by Red Hat. All rights reserved.