Class CloudObject
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,java.lang.Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.json.GenericJson
-
- org.apache.beam.runners.dataflow.util.CloudObject
-
- All Implemented Interfaces:
java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
public final class CloudObject extends com.google.api.client.json.GenericJson implements java.lang.CloneableA representation of an arbitrary Java object to be instantiated by Dataflow workers.Typically, an object to be written by the SDK to the Dataflow service will implement a method (typically called
asCloudObject()) that returns aCloudObjectto represent the object in the protocol. Once theCloudObjectis constructed, the method should explicitly add additional properties to be presented during deserialization, representing child objects by building additionalCloudObjects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.Flags
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CloudObjectclone()booleanequals(@Nullable java.lang.Object otherObject)static CloudObjectforBoolean(java.lang.Boolean value)Constructs aCloudObjectrepresenting the given value.static CloudObjectforClass(java.lang.Class<?> cls)Constructs aCloudObjectto be used for serializing an instance of the supplied class for transport via the Dataflow API.static CloudObjectforClassName(java.lang.String className)Constructs aCloudObjectto be used for serializing data to be deserialized using the supplied class name the supplied class name for transport via the Dataflow API.static CloudObjectforFloat(java.lang.Double value)Constructs aCloudObjectrepresenting the given value.static CloudObjectforFloat(java.lang.Float value)Constructs aCloudObjectrepresenting the given value.static CloudObjectforInteger(java.lang.Integer value)Constructs aCloudObjectrepresenting the given value.static CloudObjectforInteger(java.lang.Long value)Constructs aCloudObjectrepresenting the given value.static CloudObjectforKnownType(java.lang.Object value)Constructs aCloudObjectrepresenting the given value of a well-known cloud object type.static CloudObjectforString(java.lang.String value)Constructs aCloudObjectrepresenting the given value.static CloudObjectfromSpec(java.util.Map<java.lang.String,java.lang.Object> spec)Constructs aCloudObjectby copying the supplied serialized object spec, which must represent an SDK object serialized for transport via the Dataflow API.java.lang.StringgetClassName()Gets the name of the Java class that this CloudObject represents.inthashCode()-
Methods inherited from class com.google.api.client.json.GenericJson
getFactory, set, setFactory, toPrettyString, toString
-
Methods inherited from class com.google.api.client.util.GenericData
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
-
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
-
-
-
-
Method Detail
-
fromSpec
public static CloudObject fromSpec(java.util.Map<java.lang.String,java.lang.Object> spec)
Constructs aCloudObjectby copying the supplied serialized object spec, which must represent an SDK object serialized for transport via the Dataflow API.The most common use of this method is during deserialization on the worker, where it's used as a binding type during instance construction.
- Parameters:
spec- supplies the serialized form of the object as a nested map- Throws:
java.lang.RuntimeException- if the supplied map does not represent an SDK object
-
forClass
public static CloudObject forClass(java.lang.Class<?> cls)
Constructs aCloudObjectto be used for serializing an instance of the supplied class for transport via the Dataflow API. The instance parameters to be serialized must be supplied explicitly after theCloudObjectis created, by usingGenericData.put(java.lang.String, java.lang.Object).- Parameters:
cls- the class to use when deserializing the object on the worker
-
forClassName
public static CloudObject forClassName(java.lang.String className)
Constructs aCloudObjectto be used for serializing data to be deserialized using the supplied class name the supplied class name for transport via the Dataflow API. The instance parameters to be serialized must be supplied explicitly after theCloudObjectis created, by usingGenericData.put(java.lang.String, java.lang.Object).- Parameters:
className- the class to use when deserializing the object on the worker
-
forString
public static CloudObject forString(java.lang.String value)
Constructs aCloudObjectrepresenting the given value.- Parameters:
value- the scalar value to represent.
-
forBoolean
public static CloudObject forBoolean(java.lang.Boolean value)
Constructs aCloudObjectrepresenting the given value.- Parameters:
value- the scalar value to represent.
-
forInteger
public static CloudObject forInteger(java.lang.Long value)
Constructs aCloudObjectrepresenting the given value.- Parameters:
value- the scalar value to represent.
-
forInteger
public static CloudObject forInteger(java.lang.Integer value)
Constructs aCloudObjectrepresenting the given value.- Parameters:
value- the scalar value to represent.
-
forFloat
public static CloudObject forFloat(java.lang.Float value)
Constructs aCloudObjectrepresenting the given value.- Parameters:
value- the scalar value to represent.
-
forFloat
public static CloudObject forFloat(java.lang.Double value)
Constructs aCloudObjectrepresenting the given value.- Parameters:
value- the scalar value to represent.
-
forKnownType
public static CloudObject forKnownType(java.lang.Object value)
Constructs aCloudObjectrepresenting the given value of a well-known cloud object type.- Parameters:
value- the scalar value to represent.- Throws:
java.lang.RuntimeException- if the value does not have aCloudKnownTypemapping
-
getClassName
public java.lang.String getClassName()
Gets the name of the Java class that this CloudObject represents.
-
clone
public CloudObject clone()
- Overrides:
clonein classcom.google.api.client.json.GenericJson
-
equals
public boolean equals(@Nullable java.lang.Object otherObject)
- Specified by:
equalsin interfacejava.util.Map<java.lang.String,java.lang.Object>- Overrides:
equalsin classcom.google.api.client.util.GenericData
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Map<java.lang.String,java.lang.Object>- Overrides:
hashCodein classcom.google.api.client.util.GenericData
-
-