public static Triple < Map < String , PropertyType > , Map < String , Object > , Map < String , Object > > validateVertexKeysValues ( SqlDialect sqlDialect , Object [ ] keyValues ) { Map < String , Object > resultAllValues = new LinkedHashMap <> ( ) ; Map < String , Object > resultNotNullValues = new LinkedHashMap <> ( ) ; Map < String , PropertyType > keyPropertyTypeMap = new LinkedHashMap <> ( ) ; if ( keyValues . length % 2 != 0 ) throw Element . Exceptions . providedKeyValuesMustBeAMultipleOfTwo ( ) ; for ( int i = 0 ; i < keyValues . length ; i = i + 2 ) { if ( ! ( keyValues [ i ] instanceof String ) && ! ( keyValues [ i ] instanceof T ) ) { throw Element . Exceptions . providedKeyValuesMustHaveALegalKeyOnEvenIndices ( ) ; } if ( keyValues [ i ] . equals ( T . id ) ) { throw Vertex . Exceptions . userSuppliedIdsNotSupported ( ) ; } if ( ! keyValues [ i ] . equals ( T . label ) ) { String key = ( String ) keyValues [ i ] ; sqlDialect . validateColumnName ( key ) ; Object value = keyValues [ i + 1 ] ; ElementHelper . validateProperty ( key , value ) ; sqlDialect . validateProperty ( key , value ) ; if ( value != null ) { resultNotNullValues . put ( key , value ) ; keyPropertyTypeMap . put ( key , PropertyType . from ( value ) ) ; } else { keyPropertyTypeMap . put ( key , PropertyType . STRING ) ; } resultAllValues . put ( key , value ) ; } } return Triple . of ( keyPropertyTypeMap , resultAllValues , resultNotNullValues ) ; }
Validates the key values and converts it into a Triple with three maps . The left map is a map of keys together with their PropertyType . The middle map is a map of keys together with their values . The right map is a map of keys with values where the values are guaranteed not to be null .