@ SuppressWarnings ( "unchecked" ) protected SFSDataWrapper transformCollection ( Object value ) { Collection < ? > collection = ( Collection < ? > ) value ; if ( collection . isEmpty ( ) ) return new SFSDataWrapper ( SFSDataType . NULL , value ) ; Iterator < ? > it = collection . iterator ( ) ; Object firstItem = it . next ( ) ; if ( firstItem . getClass ( ) . isArray ( ) ) return transformArrayCollection ( collection ) ; if ( isObject ( firstItem . getClass ( ) ) ) return transformObjectCollection ( ( Collection < ? > ) value ) ; if ( firstItem instanceof Boolean ) return new SFSDataWrapper ( SFSDataType . BOOL_ARRAY , value ) ; if ( firstItem instanceof Byte ) return new SFSDataWrapper ( SFSDataType . BYTE_ARRAY , collectionToPrimitiveByteArray ( ( Collection < Byte > ) value ) ) ; if ( firstItem instanceof Character ) return new SFSDataWrapper ( SFSDataType . BYTE_ARRAY , charCollectionToPrimitiveByteArray ( ( Collection < Character > ) value ) ) ; if ( firstItem instanceof Double ) return new SFSDataWrapper ( SFSDataType . DOUBLE_ARRAY , value ) ; if ( firstItem instanceof Float ) return new SFSDataWrapper ( SFSDataType . FLOAT_ARRAY , value ) ; if ( firstItem instanceof Integer ) return new SFSDataWrapper ( SFSDataType . INT_ARRAY , value ) ; if ( firstItem instanceof Long ) return new SFSDataWrapper ( SFSDataType . LONG_ARRAY , value ) ; if ( firstItem instanceof Short ) return new SFSDataWrapper ( SFSDataType . SHORT_ARRAY , value ) ; if ( firstItem instanceof String ) return new SFSDataWrapper ( SFSDataType . UTF_STRING_ARRAY , value ) ; throw new IllegalArgumentException ( "Can not transform value of " + value . getClass ( ) ) ; }
Transform a collection of value to SFSDataWrapper object