private Object getPropertyTypeValue ( Class propertyType , Object value ) { if ( propertyType . equals ( String . class ) ) { return value . toString ( ) ; } else if ( propertyType . equals ( Boolean . class ) || propertyType . equals ( Boolean . TYPE ) ) { Boolean arg = null ; if ( value instanceof Boolean ) { arg = ( Boolean ) value ; } else { arg = Boolean . parseBoolean ( value . toString ( ) ) ; } return arg ; } else if ( propertyType . equals ( Short . class ) || propertyType . equals ( Short . TYPE ) ) { Short arg = null ; if ( value instanceof Short ) { arg = ( Short ) value ; } else { arg = Short . parseShort ( value . toString ( ) ) ; } return arg ; } else if ( propertyType . equals ( Integer . class ) || propertyType . equals ( Integer . TYPE ) ) { Integer arg = null ; if ( value instanceof Integer ) { arg = ( Integer ) value ; } else { arg = Integer . parseInt ( value . toString ( ) ) ; } return arg ; } else if ( propertyType . equals ( Long . class ) || propertyType . equals ( Long . TYPE ) ) { Long arg = null ; if ( value instanceof Long ) { arg = ( Long ) value ; } else { arg = Long . parseLong ( value . toString ( ) ) ; } return arg ; } else if ( propertyType . equals ( Float . class ) || propertyType . equals ( Float . TYPE ) ) { Float arg = null ; if ( value instanceof Float ) { arg = ( Float ) value ; } else { arg = Float . parseFloat ( value . toString ( ) ) ; } return arg ; } else if ( propertyType . equals ( Double . class ) || propertyType . equals ( Double . TYPE ) ) { Double arg = null ; if ( value instanceof Double ) { arg = ( Double ) value ; } else { arg = Double . parseDouble ( value . toString ( ) ) ; } return arg ; } else { // Object return value ; } }
converts ths incoming value to an object for the property type .