public final class CloudObject
extends com.google.api.client.json.GenericJson
Typically, an object to be written by the SDK to the Dataflow service will
implement a method (typically called asCloudObject()
) that returns a
CloudObject
to represent the object in the protocol. Once the
CloudObject
is constructed, the method should explicitly add
additional properties to be presented during deserialization, representing
child objects by building additional CloudObject
s.
com.google.api.client.util.GenericData.Flags
Modifier and Type | Method and Description |
---|---|
CloudObject |
clone() |
static CloudObject |
forBoolean(java.lang.Boolean value)
Constructs a
CloudObject representing the given value. |
static CloudObject |
forClass(java.lang.Class<?> cls)
Constructs a
CloudObject to be used for serializing an instance of
the supplied class for transport via the Dataflow API. |
static CloudObject |
forClassName(java.lang.String className)
Constructs a
CloudObject to be used for serializing data to be
deserialized using the supplied class name the supplied class name for
transport via the Dataflow API. |
static CloudObject |
forFloat(java.lang.Double value)
Constructs a
CloudObject representing the given value. |
static CloudObject |
forFloat(java.lang.Float value)
Constructs a
CloudObject representing the given value. |
static CloudObject |
forInteger(java.lang.Integer value)
Constructs a
CloudObject representing the given value. |
static CloudObject |
forInteger(java.lang.Long value)
Constructs a
CloudObject representing the given value. |
static CloudObject |
forKnownType(java.lang.Object value)
Constructs a
CloudObject representing the given value of a
well-known cloud object type. |
static CloudObject |
forString(java.lang.String value)
Constructs a
CloudObject representing the given value. |
static CloudObject |
fromSpec(java.util.Map<java.lang.String,java.lang.Object> spec)
Constructs a
CloudObject by copying the supplied serialized object
spec, which must represent an SDK object serialized for transport via the
Dataflow API. |
java.lang.String |
getClassName()
Gets the name of the Java class that this CloudObject represents.
|
getFactory, set, setFactory, toPrettyString, toString
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, values
public static CloudObject fromSpec(java.util.Map<java.lang.String,java.lang.Object> spec)
CloudObject
by 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.
spec
- supplies the serialized form of the object as a nested mapjava.lang.RuntimeException
- if the supplied map does not represent an SDK objectpublic static CloudObject forClass(java.lang.Class<?> cls)
CloudObject
to 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 the
CloudObject
is created, by using GenericData.put(java.lang.String, java.lang.Object)
.cls
- the class to use when deserializing the object on the workerpublic static CloudObject forClassName(java.lang.String className)
CloudObject
to 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 the CloudObject
is created, by
using GenericData.put(java.lang.String, java.lang.Object)
.className
- the class to use when deserializing the object on the workerpublic static CloudObject forString(java.lang.String value)
CloudObject
representing the given value.value
- the scalar value to represent.public static CloudObject forBoolean(java.lang.Boolean value)
CloudObject
representing the given value.value
- the scalar value to represent.public static CloudObject forInteger(java.lang.Long value)
CloudObject
representing the given value.value
- the scalar value to represent.public static CloudObject forInteger(java.lang.Integer value)
CloudObject
representing the given value.value
- the scalar value to represent.public static CloudObject forFloat(java.lang.Float value)
CloudObject
representing the given value.value
- the scalar value to represent.public static CloudObject forFloat(java.lang.Double value)
CloudObject
representing the given value.value
- the scalar value to represent.public static CloudObject forKnownType(java.lang.Object value)
CloudObject
representing the given value of a
well-known cloud object type.value
- the scalar value to represent.java.lang.RuntimeException
- if the value does not have a
CloudKnownType
mappingpublic java.lang.String getClassName()
public CloudObject clone()
clone
in class com.google.api.client.json.GenericJson