Package dev.grafeo.gwp.internal
Class ValueConverter
java.lang.Object
dev.grafeo.gwp.internal.ValueConverter
Converts between protobuf
gql.Value messages and native Java objects.
Protobuf types are referenced via the generated classes in the gql package,
which the protobuf-maven-plugin generates from the proto files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectfromProto(GqlTypes.Value proto) Convert a protobufValueto a native Java object.static GqlTypes.ValueConvert a native Java value to a protobufValue.
-
Method Details
-
fromProto
Convert a protobufValueto a native Java object.The mapping is:
null_value->nullboolean_value->Booleaninteger_value->Longunsigned_integer_value->Longfloat_value->Doublestring_value->Stringbytes_value->byte[]date_value->GqlDatelocal_time_value->GqlLocalTimezoned_time_value->GqlZonedTimelocal_datetime_value->GqlLocalDateTimezoned_datetime_value->GqlZonedDateTimeduration_value->GqlDurationlist_value->Listrecord_value->GqlRecordnode_value->GqlNodeedge_value->GqlEdgepath_value->GqlPath
- Parameters:
proto- the protobuf Value message- Returns:
- the native Java value, or null for null/unrecognized types
-
toProto
Convert a native Java value to a protobufValue.Supported types:
null,Boolean,Integer,Long,Float,Double,String,byte[],GqlDate,GqlLocalTime,GqlZonedTime,GqlLocalDateTime,GqlZonedDateTime,GqlDuration,List. Unsupported types map to null.- Parameters:
value- the Java value to convert- Returns:
- the protobuf Value message
-