public class BeanReflectionTruncator extends java.lang.Object implements Truncator
Constructor and Description |
---|
BeanReflectionTruncator() |
Modifier and Type | Method and Description |
---|---|
protected void |
doTruncate(java.lang.String[] path,
java.lang.Object obj,
int length)
Do truncate.
|
java.lang.reflect.Field |
getField(java.lang.Object obj,
java.lang.String fieldName)
Gets the field.
|
protected java.lang.String[] |
getFieldPath(java.lang.String path)
Gets the field path.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getFieldsToTruncate()
Gets the fields to truncate.
|
java.lang.Object |
getObject(java.lang.Object obj,
java.lang.String fieldName)
Gets the object.
|
void |
setFieldsToTruncate(java.util.Map<java.lang.String,java.lang.Integer> fieldsToTruncate)
Sets the fields to truncate.
|
<T> T |
truncate(T item)
Truncate.
|
public <T> T truncate(T item) throws java.lang.Exception
Truncator
protected void doTruncate(java.lang.String[] path, java.lang.Object obj, int length) throws java.lang.Exception
path
- the pathobj
- the objlength
- the lengthjava.lang.Exception
- the exceptionpublic java.lang.reflect.Field getField(java.lang.Object obj, java.lang.String fieldName) throws java.lang.Exception
obj
- the objfieldName
- the field namejava.lang.Exception
- the exceptionpublic java.lang.Object getObject(java.lang.Object obj, java.lang.String fieldName) throws java.lang.Exception
obj
- the objfieldName
- the field namejava.lang.Exception
- the exceptionprotected java.lang.String[] getFieldPath(java.lang.String path)
path
- the pathpublic java.util.Map<java.lang.String,java.lang.Integer> getFieldsToTruncate()
public void setFieldsToTruncate(java.util.Map<java.lang.String,java.lang.Integer> fieldsToTruncate)
fieldsToTruncate
- the fields to truncate