Class 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.Cloneable
    A 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 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 CloudObjects.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.api.client.util.GenericData

        com.google.api.client.util.GenericData.Flags
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CloudObject clone()  
      boolean equals​(@Nullable java.lang.Object otherObject)  
      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.
      int hashCode()  
      • 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
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Method Detail

      • fromSpec

        public 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.

        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 a 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).
        Parameters:
        cls - the class to use when deserializing the object on the worker
      • forClassName

        public 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. 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).
        Parameters:
        className - the class to use when deserializing the object on the worker
      • forString

        public static CloudObject forString​(java.lang.String value)
        Constructs a CloudObject representing the given value.
        Parameters:
        value - the scalar value to represent.
      • forBoolean

        public static CloudObject forBoolean​(java.lang.Boolean value)
        Constructs a CloudObject representing the given value.
        Parameters:
        value - the scalar value to represent.
      • forInteger

        public static CloudObject forInteger​(java.lang.Long value)
        Constructs a CloudObject representing the given value.
        Parameters:
        value - the scalar value to represent.
      • forInteger

        public static CloudObject forInteger​(java.lang.Integer value)
        Constructs a CloudObject representing the given value.
        Parameters:
        value - the scalar value to represent.
      • forFloat

        public static CloudObject forFloat​(java.lang.Float value)
        Constructs a CloudObject representing the given value.
        Parameters:
        value - the scalar value to represent.
      • forFloat

        public static CloudObject forFloat​(java.lang.Double value)
        Constructs a CloudObject representing the given value.
        Parameters:
        value - the scalar value to represent.
      • forKnownType

        public static CloudObject forKnownType​(java.lang.Object value)
        Constructs a CloudObject representing 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 a CloudKnownType mapping
      • getClassName

        public java.lang.String getClassName()
        Gets the name of the Java class that this CloudObject represents.
      • clone

        public CloudObject clone()
        Overrides:
        clone in class com.google.api.client.json.GenericJson
      • equals

        public boolean equals​(@Nullable java.lang.Object otherObject)
        Specified by:
        equals in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        equals in class com.google.api.client.util.GenericData
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        hashCode in class com.google.api.client.util.GenericData