@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public static byte [ ] encode ( final String attributeName , final Object obj ) { TypeConverter converter = DataConverter . attributeConverters . get ( attributeName ) ; if ( converter == null ) { log . warn ( "Unable to find a suitable data converter for attribute {}." , attributeName ) ; throw new IllegalArgumentException ( "Unable to find a suitable data converter for attribute \"" + attributeName + "\"." ) ; } if ( obj instanceof String ) { return converter . encode ( ( String ) obj ) ; } return converter . encode ( obj ) ; }
Encodes attribute data into the standard binary representation for the type .