|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.slim3.commons.beanutil.AbstractCopy<S>
S
- the sub type.public abstract class AbstractCopy<S extends AbstractCopy<S>>
An abstract class to copy an object to an another object.
Field Summary | |
---|---|
protected Map<String,Converter> |
converterMap
The converters that are bound to the specific property. |
protected List<Converter> |
converters
The converters that are not bound to any properties. |
protected boolean |
copyEmptyString
Whether emptyString is copied. |
protected boolean |
copyNull
Whether null is copied. |
protected static Converter |
DEFAULT_DATE_CONVERTER
The default converter for Date . |
protected static Converter |
DEFAULT_TIME_CONVERTER
The default converter for Time . |
protected static Converter |
DEFAULT_TIMESTAMP_CONVERTER
The default converter for Timestamp . |
protected static String[] |
EMPTY_STRINGS
The empty strings. |
protected String[] |
excludedPropertyNames
The excluded property names. |
protected String[] |
includedPropertyNames
The included property names. |
Constructor Summary | |
---|---|
AbstractCopy()
|
Method Summary | |
---|---|
S |
converter(Converter converter,
CharSequence... propertyNames)
Specifies the converter. |
protected Object |
convertValue(Object value,
String destPropertyName,
Class<?> destPropertyClass)
Converts the value. |
protected void |
copyBeanToBean(Object src,
Object dest)
Copies a bean to an another bean. |
protected void |
copyBeanToMap(Object src,
Map<String,Object> dest)
Copies a bean to an another map. |
S |
copyEmptyString()
Specifies whether empty string is copied. |
protected void |
copyMapToBean(Map<String,Object> src,
Object dest)
Copies a map to an another bean. |
protected void |
copyMapToMap(Map<String,Object> src,
Map<String,Object> dest)
Copies a map to an another map. |
S |
copyNull()
Specifies whether null is copied. |
S |
dateConverter(String pattern,
CharSequence... propertyNames)
Specifies the converter for Date . |
S |
exclude(CharSequence... propertyNames)
Specifies the excluded property names. |
protected Converter |
findConverter(Class<?> clazz)
Finds the converter for the class. |
protected Converter |
findDefaultConverter(Class<?> clazz)
Finds the default converter. |
S |
include(CharSequence... propertyNames)
Specifies the included property names. |
protected boolean |
isTargetProperty(String name)
Determines if the property is target. |
protected boolean |
isTargetValue(Object value)
Determines if the value is target. |
S |
numberConverter(String pattern,
CharSequence... propertyNames)
Specifies the number converter. |
S |
sqlDateConverter(String pattern,
CharSequence... propertyNames)
Specifies the converter for Date . |
S |
timeConverter(String pattern,
CharSequence... propertyNames)
Specifies the converter for Time . |
S |
timestampConverter(String pattern,
CharSequence... propertyNames)
Specifies the converter for Timestamp . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String[] EMPTY_STRINGS
protected static final Converter DEFAULT_DATE_CONVERTER
Date
.
protected static final Converter DEFAULT_TIMESTAMP_CONVERTER
Timestamp
.
protected static final Converter DEFAULT_TIME_CONVERTER
Time
.
protected String[] includedPropertyNames
protected String[] excludedPropertyNames
protected boolean copyNull
protected boolean copyEmptyString
protected Map<String,Converter> converterMap
protected List<Converter> converters
Constructor Detail |
---|
public AbstractCopy()
Method Detail |
---|
public S include(CharSequence... propertyNames)
propertyNames
- the included property names
public S exclude(CharSequence... propertyNames)
propertyNames
- the excluded property names
public S copyNull()
public S copyEmptyString()
public S converter(Converter converter, CharSequence... propertyNames)
converter
- the converterpropertyNames
- the property names
public S dateConverter(String pattern, CharSequence... propertyNames)
Date
.
pattern
- the pattern for SimpleDateFormat
propertyNames
- the property names
public S sqlDateConverter(String pattern, CharSequence... propertyNames)
Date
.
pattern
- the pattern for SimpleDateFormat
propertyNames
- the property names
public S timeConverter(String pattern, CharSequence... propertyNames)
Time
.
pattern
- the pattern for SimpleDateFormat
propertyNames
- the property names
public S timestampConverter(String pattern, CharSequence... propertyNames)
Timestamp
.
pattern
- the pattern for SimpleDateFormat
propertyNames
- the property names
public S numberConverter(String pattern, CharSequence... propertyNames)
pattern
- the pattern for DecimalFormat
propertyNames
- the property names
protected boolean isTargetProperty(String name)
name
- the property name
protected boolean isTargetValue(Object value)
value
- the value
protected void copyBeanToBean(Object src, Object dest)
src
- the source beandest
- the destination beanprotected void copyBeanToMap(Object src, Map<String,Object> dest)
src
- the source beandest
- the destination mapprotected void copyMapToBean(Map<String,Object> src, Object dest)
src
- the source mapdest
- the destination beanprotected void copyMapToMap(Map<String,Object> src, Map<String,Object> dest)
src
- the source mapdest
- the destination mapprotected Object convertValue(Object value, String destPropertyName, Class<?> destPropertyClass) throws ConverterRuntimeException
value
- the valuedestPropertyName
- the destination property namedestPropertyClass
- the destination property class
ConverterRuntimeException
- if an exception is encountered while covertingprotected Converter findConverter(Class<?> clazz)
clazz
- the class.
protected Converter findDefaultConverter(Class<?> clazz)
clazz
- the converter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |