public static Value[] values( final Object... input ) { Value[] values = new Value[input.length]; for ( int i = 0; i < input.length; i++ ) { values[i] = value( input[i] ); } return values; }
/** * Create a new statement. * @param text the statement text * @param parameters the statement parameters */ public Statement( String text, Map<String, Object> parameters ) { this( text, Values.value( parameters ) ); }
private static Map<String,Value> buildMetadata( String userAgent, Map<String,Value> authToken ) { Map<String,Value> result = new HashMap<>( authToken ); result.put( USER_AGENT_METADATA_KEY, value( userAgent ) ); return result; } }
@Override public String toString() { Map<String,Value> metadataCopy = new HashMap<>( metadata ); metadataCopy.replace( CREDENTIALS_KEY, value( "******" ) ); return "HELLO " + metadataCopy; }
/** * No authentication scheme. This will only work if authentication is disabled * on the Neo4j Instance we are connecting to. * @return an authentication token that can be used to connect to Neo4j instances with auth disabled * @see GraphDatabase#driver(String, AuthToken) */ public static AuthToken none() { return new InternalAuthToken( singletonMap( SCHEME_KEY, value( "none" ) ) ); } }
public static Value isoDuration( long months, long days, long seconds, int nanoseconds ) { return value( new InternalIsoDuration( months, days, seconds, nanoseconds ) ); }
public static Value value( boolean... input ) { Value[] values = new Value[input.length]; for ( int i = 0; i < input.length; i++ ) { values[i] = value( input[i] ); } return new ListValue( values ); }
public static Value value( char... input ) { Value[] values = new Value[input.length]; for ( int i = 0; i < input.length; i++ ) { values[i] = value( input[i] ); } return new ListValue( values ); }
public static Value value( long... input ) { Value[] values = new Value[input.length]; for ( int i = 0; i < input.length; i++ ) { values[i] = value( input[i] ); } return new ListValue( values ); }
public static Value value( int... input ) { Value[] values = new Value[input.length]; for ( int i = 0; i < input.length; i++ ) { values[i] = value( input[i] ); } return new ListValue( values ); }
public static Value value( Iterator<Object> val ) { List<Value> values = new ArrayList<>(); while ( val.hasNext() ) { values.add( value( val.next() ) ); } return new ListValue( values.toArray( new Value[0] ) ); }
public static Value value( double... input ) { Value[] values = new Value[input.length]; for ( int i = 0; i < input.length; i++ ) { values[i] = value( input[i] ); } return new ListValue( values ); }
public static Value value( List<Object> vals ) { Value[] values = new Value[vals.size()]; int i = 0; for ( Object val : vals ) { values[i++] = value( val ); } return new ListValue( values ); }
public static Value value( final Map<String,Object> val ) { Map<String,Value> asValues = newHashMapWithSize( val.size() ); for ( Map.Entry<String,Object> entry : val.entrySet() ) { asValues.put( entry.getKey(), value( entry.getValue() ) ); } return new MapValue( asValues ); }
private Value unpackLocalTime() throws IOException { long nanoOfDayLocal = unpacker.unpackLong(); return value( LocalTime.ofNanoOfDay( nanoOfDayLocal ) ); }
private Value unpackDate() throws IOException { long epochDay = unpacker.unpackLong(); return value( LocalDate.ofEpochDay( epochDay ) ); }
private Value unpackLocalDateTime() throws IOException { long epochSecondUtc = unpacker.unpackLong(); int nano = Math.toIntExact( unpacker.unpackLong() ); return value( LocalDateTime.ofEpochSecond( epochSecondUtc, nano, UTC ) ); }
private Value unpackDateTimeWithZoneId() throws IOException { long epochSecondLocal = unpacker.unpackLong(); int nano = Math.toIntExact( unpacker.unpackLong() ); String zoneIdString = unpacker.unpackString(); return value( newZonedDateTime( epochSecondLocal, nano, ZoneId.of( zoneIdString ) ) ); }
private Value unpackDateTimeWithZoneOffset() throws IOException { long epochSecondLocal = unpacker.unpackLong(); int nano = Math.toIntExact( unpacker.unpackLong() ); int offsetSeconds = Math.toIntExact( unpacker.unpackLong() ); return value( newZonedDateTime( epochSecondLocal, nano, ZoneOffset.ofTotalSeconds( offsetSeconds ) ) ); }
private Value unpackTime() throws IOException { long nanoOfDayLocal = unpacker.unpackLong(); int offsetSeconds = Math.toIntExact( unpacker.unpackLong() ); LocalTime localTime = LocalTime.ofNanoOfDay( nanoOfDayLocal ); ZoneOffset offset = ZoneOffset.ofTotalSeconds( offsetSeconds ); return value( OffsetTime.of( localTime, offset ) ); }