|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.Morph
public abstract class Morph
A convenient static API for basic use of the Morph framework. This class does
not provide any means for customizing/changing its behavior so
that components can be guaranteed that calls to this static class will behave
consistently regardless of the environment they are executed in. If you need
customized behavior, use a
SimpleDelegatingTransformer
or
other customized Morph objects. This class is just a
static facade for accessing those classes directly. They are particularly
easy to configure using an Inversion of Control framework such as Spring.
net.sf.morph.transform.copiers.DelegatingCopier
,
net.sf.morph.transform.converters.DelegatingConverter
,
SimpleLanguage
Method Summary | |
---|---|
static boolean |
add(java.lang.Object container,
java.lang.Object value)
Adds a new value to the end of a container . |
static java.lang.Object |
convert(java.lang.Class destinationClass,
java.lang.Object source)
Converts the given source into an object of class
destinationClass . |
static java.lang.Object |
convert(java.lang.Class destinationClass,
java.lang.Object source,
java.util.Locale locale)
Converts the given source into an object of class
destinationClass . |
static java.math.BigDecimal |
convertToBigDecimal(java.lang.Object source)
Converts the given source into a BigDecimal . |
static java.math.BigDecimal |
convertToBigDecimal(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a BigDecimal . |
static java.math.BigInteger |
convertToBigInteger(java.lang.Object source)
Converts the given source into a BigInteger . |
static java.math.BigInteger |
convertToBigInteger(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a BigInteger . |
static boolean |
convertToBoolean(java.lang.Object source)
Converts the given source into a boolean . |
static java.lang.Boolean |
convertToBooleanObject(java.lang.Object source)
Converts the given source into a Boolean . |
static byte |
convertToByte(java.lang.Object source)
Converts the given source into a byte . |
static byte |
convertToByte(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a byte . |
static java.lang.Byte |
convertToByteObject(java.lang.Object source)
Converts the given source into a Byte . |
static java.lang.Byte |
convertToByteObject(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Byte . |
static java.util.Calendar |
convertToCalendar(java.lang.Object source)
Converts the given source into a Calendar . |
static java.util.Calendar |
convertToCalendar(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Calendar . |
static java.util.Date |
convertToDate(java.lang.Object source)
Converts the given source into a Date . |
static java.util.Date |
convertToDate(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Date . |
static double |
convertToDouble(java.lang.Object source)
Converts the given source into a double . |
static double |
convertToDouble(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a double . |
static java.lang.Double |
convertToDoubleObject(java.lang.Object source)
Converts the given source into a Double . |
static java.lang.Double |
convertToDoubleObject(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Double . |
static float |
convertToFloat(java.lang.Object source)
Converts the given source into a float . |
static float |
convertToFloat(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a float . |
static java.lang.Float |
convertToFloatObject(java.lang.Object source)
Converts the given source into a Float . |
static java.lang.Float |
convertToFloatObject(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Float . |
static int |
convertToInt(java.lang.Object source)
Converts the given source into a int . |
static int |
convertToInt(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a int . |
static java.lang.Integer |
convertToIntegerObject(java.lang.Object source)
Converts the given source into a Integer . |
static java.lang.Integer |
convertToIntegerObject(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Integer . |
static long |
convertToLong(java.lang.Object source)
Converts the given source into a long . |
static long |
convertToLong(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a long . |
static java.lang.Long |
convertToLongObject(java.lang.Object source)
Converts the given source into a Long . |
static java.lang.Long |
convertToLongObject(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a Long . |
static java.lang.String |
convertToPrettyString(java.lang.Object source)
Converts the given source into a String that displays
the information contained in the object in a format good for debugging. |
static java.lang.String |
convertToString(java.lang.Object source)
Converts the given source into a String . |
static java.lang.String |
convertToString(java.lang.Object source,
java.util.Locale locale)
Converts the given source into a String . |
static void |
copy(java.lang.Object destination,
java.lang.Object source)
Copies information from the given source to the given destination. |
static void |
copy(java.lang.Object destination,
java.lang.Object source,
java.util.Locale locale)
Copies information from the given source to the given destination. |
static java.lang.Object |
get(java.lang.Object container,
int index)
Gets the element at the specified index. |
static java.lang.Object |
get(java.lang.Object target,
java.lang.String expression)
Retrieve the property indicated by expression from
target . |
static java.lang.Object |
get(java.lang.Object target,
java.lang.String expression,
java.lang.Class destinationClass)
Retrieve the information indicated by expression from
target as the type indicated by
destinationClass . |
static java.lang.Object |
get(java.lang.Object target,
java.lang.String expression,
java.lang.Class destinationClass,
java.util.Locale locale)
Retrieve the information indicated by expression from
target as the type indicated by
destinationClass . |
static java.lang.Object |
get(java.lang.Object target,
java.lang.String expression,
java.util.Locale locale,
java.lang.Class destinationClass)
Retrieve the information indicated by expression from
target as the type indicated by
destinationClass . |
static Bean |
getBean(java.lang.Object object)
Returns the given object wrapped as a Bean. |
static java.math.BigDecimal |
getBigDecimal(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a BigDecimal . |
static java.math.BigInteger |
getBigInteger(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a BigInteger . |
static boolean |
getBoolean(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a boolean . |
static java.lang.Boolean |
getBooleanObject(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Boolean object. |
static byte |
getByte(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a byte . |
static java.lang.Byte |
getByteObject(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Byte object. |
static java.util.Calendar |
getCalendar(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Calendar . |
static java.lang.Class |
getContainedType(java.lang.Class clazz)
Returns the type of the elements that are contained in objects of the given class. |
static Container |
getContainer(java.lang.Object object)
Returns the given object wrapped as a Container. |
static java.util.Date |
getDate(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Date . |
static double |
getDouble(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a double . |
static java.lang.Double |
getDoubleObject(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Double object. |
static float |
getFloat(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a float . |
static java.lang.Float |
getFloatObject(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Float object. |
static GrowableContainer |
getGrowableContainer(java.lang.Object object)
Returns the given object wrapped as a GrowableContainer. |
static IndexedContainer |
getIndexedContainer(java.lang.Object object)
Returns the given object wrapped as an IndexedContainer. |
static int |
getInt(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a int . |
static java.lang.Integer |
getIntegerObject(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Integer object. |
static java.util.Iterator |
getIterator(java.lang.Object container)
Exposes an iterator over the contents of the container. |
static long |
getLong(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a long . |
static java.lang.Long |
getLongObject(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a Long object. |
static MutableIndexedContainer |
getMutableIndexedContainer(java.lang.Object object)
Returns the given object wrapped as a MutableIndexedContainer. |
static java.lang.String[] |
getPropertyNames(java.lang.Object bean)
Gets the names of the properties which are currently defined for the given bean. |
static int |
getSize(java.lang.Object object)
Returns the number of elements contained in a given object. |
static java.lang.String |
getString(java.lang.Object target,
java.lang.String expression)
Retrieve the information indicated by expression from
target as a String . |
static java.lang.String |
getString(java.lang.Object target,
java.lang.String expression,
java.util.Locale locale)
Retrieve the information indicated by expression from
target as a String . |
static java.lang.Class |
getType(java.lang.Class beanType,
java.lang.String propertyName)
Specifies the least restrictive type that may be assigned to the given property. |
static java.lang.Class |
getType(java.lang.Object bean,
java.lang.String propertyName)
Specifies the least restrictive type that may be assigned to the given property. |
static boolean |
isReadable(java.lang.Object bean,
java.lang.String propertyName)
Specifies whether the given property is readable. |
static boolean |
isWriteable(java.lang.Object bean,
java.lang.String propertyName)
Specifies whether the given property is writeable. |
static java.lang.Object |
newInstance(java.lang.Class clazz)
Creates a new instance of the given type. |
static java.lang.Object |
set(java.lang.Object container,
int index,
java.lang.Object propertyValue)
Sets the element at the specified index. |
static void |
set(java.lang.Object target,
java.lang.String expression,
boolean value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
byte value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
double value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
float value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
int value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
long value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
java.lang.Object value)
Sets the information indicated by expression on
target . |
static void |
set(java.lang.Object target,
java.lang.String expression,
java.lang.Object value,
java.util.Locale locale)
Sets the information indicated by expression on
target . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.Object convert(java.lang.Class destinationClass, java.lang.Object source) throws TransformationException
source
into an object of class
destinationClass
. The returned object may be a reference
to source
itself. This isn't an issue for immutable
classes (String, Long, etc) but is an issue for Collection and Array
types.
destinationClass
- the destination class to convertsource
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Object convert(java.lang.Class destinationClass, java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into an object of class
destinationClass
. The returned object may be a reference
to source
itself. This isn't an issue for immutable
classes (String, Long, etc) but is an issue for Collection and Array
types.
destinationClass
- the destination class to convertsource
- the source object to convertlocale
- the locale in which the conversion should take place, or
null
if the locale is not applicable
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.String convertToPrettyString(java.lang.Object source) throws TransformationException
source
into a String that displays
the information contained in the object in a format good for debugging.
This is a great implementation of the toString
method for
an object. FIXME actually, calling this method from the toString method
of an object is likely to cause a StackOverflowException
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.math.BigDecimal convertToBigDecimal(java.lang.Object source) throws TransformationException
source
into a BigDecimal
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.math.BigDecimal convertToBigDecimal(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a BigDecimal
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.math.BigInteger convertToBigInteger(java.lang.Object source) throws TransformationException
source
into a BigInteger
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.math.BigInteger convertToBigInteger(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a BigInteger
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static boolean convertToBoolean(java.lang.Object source) throws TransformationException
source
into a boolean
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Boolean convertToBooleanObject(java.lang.Object source) throws TransformationException
source
into a Boolean
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static byte convertToByte(java.lang.Object source) throws TransformationException
source
into a byte
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static byte convertToByte(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a byte
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Byte convertToByteObject(java.lang.Object source) throws TransformationException
source
into a Byte
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Byte convertToByteObject(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Byte
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.util.Calendar convertToCalendar(java.lang.Object source) throws TransformationException
source
into a Calendar
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.util.Calendar convertToCalendar(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Calendar
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.util.Date convertToDate(java.lang.Object source) throws TransformationException
source
into a Date
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.util.Date convertToDate(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Date
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static double convertToDouble(java.lang.Object source) throws TransformationException
source
into a double
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static double convertToDouble(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a double
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Double convertToDoubleObject(java.lang.Object source) throws TransformationException
source
into a Double
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Double convertToDoubleObject(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Double
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static float convertToFloat(java.lang.Object source) throws TransformationException
source
into a float
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static float convertToFloat(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a float
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Float convertToFloatObject(java.lang.Object source) throws TransformationException
source
into a Float
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Float convertToFloatObject(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Float
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static int convertToInt(java.lang.Object source) throws TransformationException
source
into a int
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static int convertToInt(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a int
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Integer convertToIntegerObject(java.lang.Object source) throws TransformationException
source
into a Integer
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Integer convertToIntegerObject(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Integer
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static long convertToLong(java.lang.Object source) throws TransformationException
source
into a long
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static long convertToLong(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a long
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Long convertToLongObject(java.lang.Object source) throws TransformationException
source
into a Long
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Long convertToLongObject(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a Long
.
source
- the source object to convertlocale
- the locale in which the conversion is to be performed
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.String convertToString(java.lang.Object source) throws TransformationException
source
into a String
.
source
- the source object to convert
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.String convertToString(java.lang.Object source, java.util.Locale locale) throws TransformationException
source
into a String
.
source
- the source object to convertlocale
- the locale in which the conversion should take place
TransformationException
- if destinationClass
is null
,
an error occurred while performing the conversionpublic static java.lang.Object get(java.lang.Object target, java.lang.String expression) throws LanguageException
expression
from
target
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Object get(java.lang.Object target, java.lang.String expression, java.lang.Class destinationClass) throws LanguageException, TransformationException
expression
from
target
as the type indicated by
destinationClass
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrievedestinationClass
- indicates the type that should be returned by this method
expression
from
target
TransformationException
- if an error occurs while converting the requested information
to the type indicated by destinationClass
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Object get(java.lang.Object target, java.lang.String expression, java.lang.Class destinationClass, java.util.Locale locale) throws LanguageException, TransformationException
expression
from
target
as the type indicated by
destinationClass
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrievedestinationClass
- indicates the type that should be returned by this methodlocale
- indicates the locale in which the conversion to type
destinationClass
should be performed, if
applicable
expression
from
target
TransformationException
- if an error occurs while converting the requested information
to the type indicated by destinationClass
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Object get(java.lang.Object target, java.lang.String expression, java.util.Locale locale, java.lang.Class destinationClass) throws LanguageException, TransformationException
expression
from
target
as the type indicated by
destinationClass
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrievelocale
- indicates the locale in which the conversion to type
destinationClass
should be performed, if
applicabledestinationClass
- indicates the type that should be returned by this method
expression
from
target
TransformationException
- if an error occurs while converting the requested information
to the type indicated by destinationClass
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, java.lang.Object value) throws LanguageException, TransformationException
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, java.lang.Object value, java.util.Locale locale) throws LanguageException, TransformationException
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changedlocale
- indicates the locale in which the conversion to type
destinationClass
should be performed, if
applicable
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void copy(java.lang.Object destination, java.lang.Object source) throws TransformationException
Copies information from the given source to the given destination.
destination
- the object to which information is writtensource
- the object from which information is read
TransformationException
- if source
or destination
are
nullpublic static void copy(java.lang.Object destination, java.lang.Object source, java.util.Locale locale) throws TransformationException
Copies information from the given source to the given destination.
destination
- the object to which information is writtensource
- the object from which information is readlocale
- the locale of the current user, which may be null if the
locale is unknown or not applicable
TransformationException
- if source
or destination
are
nullpublic static Bean getBean(java.lang.Object object) throws WrapperException
object
- the object to be wrapped
WrapperException
- if the wrapper could not be retrievedpublic static Container getContainer(java.lang.Object object) throws WrapperException
object
- the object to be wrapped
WrapperException
- if the wrapper could not be retrievedpublic static GrowableContainer getGrowableContainer(java.lang.Object object) throws WrapperException
object
- the object to be wrapped
WrapperException
- if the wrapper could not be retrievedpublic static IndexedContainer getIndexedContainer(java.lang.Object object) throws WrapperException
object
- the object to be wrapped
WrapperException
- if the wrapper could not be retrievedpublic static MutableIndexedContainer getMutableIndexedContainer(java.lang.Object object) throws WrapperException
object
- the object to be wrapped
WrapperException
- if the wrapper could not be retrievedpublic static java.math.BigDecimal getBigDecimal(java.lang.Object target, java.lang.String expression)
expression
from
target
as a BigDecimal
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a BigDecimal
TransformationException
- if an error occurs while converting the requested information
to a BigDecimal
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.math.BigInteger getBigInteger(java.lang.Object target, java.lang.String expression)
expression
from
target
as a BigInteger
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a BigInteger
TransformationException
- if an error occurs while converting the requested information
to a BigInteger
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static boolean getBoolean(java.lang.Object target, java.lang.String expression)
expression
from
target
as a boolean
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a boolean
TransformationException
- if an error occurs while converting the requested information
to a boolean
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Boolean getBooleanObject(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Boolean
object.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Boolean
object
TransformationException
- if an error occurs while converting the requested information
to a Boolean
object
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, boolean value)
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static byte getByte(java.lang.Object target, java.lang.String expression)
expression
from
target
as a byte
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a byte
TransformationException
- if an error occurs while converting the requested information
to a byte
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Byte getByteObject(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Byte
object.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Byte
object
TransformationException
- if an error occurs while converting the requested information
to a Byte
object
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, byte value)
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static double getDouble(java.lang.Object target, java.lang.String expression)
expression
from
target
as a double
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a double
TransformationException
- if an error occurs while converting the requested information
to a double
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Double getDoubleObject(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Double
object.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Double
object
TransformationException
- if an error occurs while converting the requested information
to a Double
object
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, double value)
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static float getFloat(java.lang.Object target, java.lang.String expression)
expression
from
target
as a float
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a float
TransformationException
- if an error occurs while converting the requested information
to a float
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Float getFloatObject(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Float
object.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Float
object
TransformationException
- if an error occurs while converting the requested information
to a Float
object
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, float value)
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static int getInt(java.lang.Object target, java.lang.String expression)
expression
from
target
as a int
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a int
TransformationException
- if an error occurs while converting the requested information
to a int
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Integer getIntegerObject(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Integer
object.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Integer
object
TransformationException
- if an error occurs while converting the requested information
to a Integer
object
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, int value)
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static long getLong(java.lang.Object target, java.lang.String expression)
expression
from
target
as a long
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a long
TransformationException
- if an error occurs while converting the requested information
to a long
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.Long getLongObject(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Long
object.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Long
object
TransformationException
- if an error occurs while converting the requested information
to a Long
object
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static void set(java.lang.Object target, java.lang.String expression, long value)
expression
on
target
. value
will be automatically
converted to a type appropriate for the given expression
.
target
- the object that will be modifiedexpression
- an expression specifying which information will be modifiedvalue
- the information to be changed
TransformationException
- if an error occurs while converting value
to
the appropriate type
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.util.Date getDate(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Date
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Date
TransformationException
- if an error occurs while converting the requested information
to a Date
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.String getString(java.lang.Object target, java.lang.String expression)
expression
from
target
as a String
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a String
TransformationException
- if an error occurs while converting the requested information
to a String
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.String getString(java.lang.Object target, java.lang.String expression, java.util.Locale locale)
expression
from
target
as a String
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrievelocale
- the locale in which the conversion should take place, or
null
if the locale is not applicable
expression
from
target
as a String
TransformationException
- if an error occurs while converting the requested information
to a String
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.util.Calendar getCalendar(java.lang.Object target, java.lang.String expression)
expression
from
target
as a Calendar
.
target
- the object from which information will be retrievedexpression
- an expression specifying which information to retrieve
expression
from
target
as a Calendar
TransformationException
- if an error occurs while converting the requested information
to a Calendar
LanguageException
- if target
is null
or InvalidExpressionException
- if expression
is empty or not a valid
expressionpublic static java.lang.String[] getPropertyNames(java.lang.Object bean) throws ReflectionException
bean
- the bean for which we would like a list of properties
ReflectionException
- if bean is null
public static java.lang.Class getType(java.lang.Object bean, java.lang.String propertyName) throws ReflectionException
Object.class
, which indicates that any type can
be assigned to the given property.
bean
- the beanpropertyName
- the name of the property
Object.class
, which indicates
that any type can be assigned to the given property
ReflectionException
- if bean
or propertyName
are
null
or public static java.lang.Class getType(java.lang.Class beanType, java.lang.String propertyName) throws ReflectionException
Object.class
, which indicates that any type can
be assigned to the given property.
beanType
- the type of the beanpropertyName
- the name of the property
Object.class
, which indicates
that any type can be assigned to the given property
ReflectionException
- if beanType
or propertyName
are
null
or public static boolean isReadable(java.lang.Object bean, java.lang.String propertyName) throws ReflectionException
bean
- the beanpropertyName
- the name of the property
true
if the property is readable, or false
, otherwise
ReflectionException
- if bean
or propertyName
are
null
or public static boolean isWriteable(java.lang.Object bean, java.lang.String propertyName) throws ReflectionException
true
. This method only guarantees that if
isWriteable
returns false, the method is not writeable.
The method may or may not be writeable if this method returns
true
.
bean
- the beanpropertyName
- the name of the property
false
if the property is not writeable or true
if the property is writeable or if this
reflector cannot determine for sure whether or not the property
is writeable
ReflectionException
- if bean
or propertyName
are
null
or public static java.lang.Class getContainedType(java.lang.Class clazz) throws ReflectionException
indexedClass
represents an
array of int
s,Integer.TYPE
should be
returned. This method should only be called if
Reflector#isReflectable(Class)
returns true
.
clazz
- the container's type
ReflectionException
- if container
is null or public static java.util.Iterator getIterator(java.lang.Object container) throws ReflectionException
container
- the container to iterate over
ReflectionException
- if container
is null
or public static boolean add(java.lang.Object container, java.lang.Object value) throws ReflectionException
value
to the end of a container
.
container
- the container to which the value is to be addedvalue
- the value to be added
true
if the container changed as a result of the
call or false
, otherwise
ReflectionException
- if an error occurrspublic static java.lang.Object get(java.lang.Object container, int index) throws ReflectionException
container
- the container objectindex
- a number indiciating which element should be retrieved
ReflectionException
- if container
is null or index
is not a valid index for the given
container object or public static java.lang.Object newInstance(java.lang.Class clazz) throws ReflectionException
clazz
- the type for which we would like a new instance to be created
ReflectionException
- if an error occurrspublic static java.lang.Object set(java.lang.Object container, int index, java.lang.Object propertyValue) throws ReflectionException
container
- the container objectindex
- a number indiciating which element should be setpropertyValue
- the value to be set
ReflectionException
- if container
is null or index
is not a valid index for the given
container object or public static int getSize(java.lang.Object object) throws ReflectionException
object
- the object
ReflectionException
- if object
is null
or the
number of elements in the object could not be determined
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |