org.lexgrid.loader.processor.support
Class BeanReflectionTruncator

java.lang.Object
  extended by org.lexgrid.loader.processor.support.BeanReflectionTruncator
All Implemented Interfaces:
Truncator

public class BeanReflectionTruncator
extends java.lang.Object
implements Truncator

The Class BeanReflectionTruncator.

Author:
Kevin Peterson

Constructor Summary
BeanReflectionTruncator()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanReflectionTruncator

public BeanReflectionTruncator()
Method Detail

truncate

public <T> T truncate(T item)
           throws java.lang.Exception
Description copied from interface: Truncator
Truncate.

Specified by:
truncate in interface Truncator
Parameters:
item - the item
Returns:
the t
Throws:
java.lang.Exception - the exception

doTruncate

protected void doTruncate(java.lang.String[] path,
                          java.lang.Object obj,
                          int length)
                   throws java.lang.Exception
Do truncate.

Parameters:
path - the path
obj - the obj
length - the length
Throws:
java.lang.Exception - the exception

getField

public java.lang.reflect.Field getField(java.lang.Object obj,
                                        java.lang.String fieldName)
                                 throws java.lang.Exception
Gets the field.

Parameters:
obj - the obj
fieldName - the field name
Returns:
the field
Throws:
java.lang.Exception - the exception

getObject

public java.lang.Object getObject(java.lang.Object obj,
                                  java.lang.String fieldName)
                           throws java.lang.Exception
Gets the object.

Parameters:
obj - the obj
fieldName - the field name
Returns:
the object
Throws:
java.lang.Exception - the exception

getFieldPath

protected java.lang.String[] getFieldPath(java.lang.String path)
Gets the field path.

Parameters:
path - the path
Returns:
the field path

getFieldsToTruncate

public java.util.Map<java.lang.String,java.lang.Integer> getFieldsToTruncate()
Gets the fields to truncate.

Returns:
the fields to truncate

setFieldsToTruncate

public void setFieldsToTruncate(java.util.Map<java.lang.String,java.lang.Integer> fieldsToTruncate)
Sets the fields to truncate.

Parameters:
fieldsToTruncate - the fields to truncate

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.