com.cumulocity.model
Class Document<T extends ID>

java.lang.Object
  extended by org.svenson.AbstractDynamicProperties
      extended by com.cumulocity.model.JSONBase
          extended by com.cumulocity.model.Document<T>
All Implemented Interfaces:
org.svenson.DynamicProperties
Direct Known Subclasses:
Event, FragmentDocument, Measurement, Operation

public abstract class Document<T extends ID>
extends JSONBase

Represents the common elements of any modeled entity. Can serialize into and be deserialized from JSON.


Constructor Summary
Document()
           
 
Method Summary
 boolean equals(Object obj)
           
<C> C
get(Class<C> clazz)
          Returns the object whose parameter name is given by clazz, or null if no such property exists.
 Object get(String name)
          Returns the object associated with the given property name, or null if no such property exists.
 Object getFragment(String name)
          Returns the object associated with the given property name, or null if no such property exists.
 T getId()
           
 String getInternalId()
           
 String getRevision()
          Deprecated. 
 int hashCode()
           
 void set(Object object)
          Sets a property referring to the given object.
<C> void
set(Object object, Class<C> clazz)
          Sets a property referring to the given object.
 void set(Object object, String propertyName)
          Sets a property referring to the given object, using an arbitrary property name.
 void setId(T id)
           
 void setInternalId(String internalId)
           
 void setRevision(String revision)
          Deprecated. 
 String toString()
           
 
Methods inherited from class com.cumulocity.model.JSONBase
fromJSON, getJSONGenerator, getJSONParser, toJSON
 
Methods inherited from class org.svenson.AbstractDynamicProperties
getProperty, propertyNames, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Document

public Document()
Method Detail

getId

@JSONProperty(value="id",
              ignoreIfNull=true)
@JSONConverter(type=IDTypeConverter.class)
public T getId()

setId

public void setId(T id)

getInternalId

@JSONProperty(value="_id",
              ignoreIfNull=true)
public String getInternalId()

setInternalId

public void setInternalId(String internalId)

getRevision

@Deprecated
@JSONProperty(value="_rev",
              ignoreIfNull=true)
public String getRevision()
Deprecated. 


setRevision

@Deprecated
public void setRevision(String revision)
Deprecated. 


set

@JSONProperty(ignore=true)
public void set(Object object)
Sets a property referring to the given object. The name of the property will be the fully qualified class name with dots replaced by underscores.
For example, if the object is of type:
then the property name will be:

Parameters:
object -

set

@JSONProperty(ignore=true)
public void set(Object object,
                             String propertyName)
Sets a property referring to the given object, using an arbitrary property name.

Parameters:
object -
propertyName -

set

@JSONProperty(ignore=true)
public <C> void set(Object object,
                                 Class<C> clazz)
Sets a property referring to the given object. The name of the property will be the fully qualified class name of the given class, with dots replaced by underscores.
This can be useful if you want to name the property after the base class rather than the actual class of object.
For example, if clazz is of type:
then the property name will be:

Parameters:
object -
clazz -

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

get

public <C> C get(Class<C> clazz)
Returns the object whose parameter name is given by clazz, or null if no such property exists.

Parameters:
clazz -
Returns:
See Also:
set(Object)

get

public Object get(String name)
Returns the object associated with the given property name, or null if no such property exists.

Parameters:
name -
Returns:

getFragment

public Object getFragment(String name)
Returns the object associated with the given property name, or null if no such property exists. Such an accessor is required when bean naming conventions are used to discover available properties, eg in Esper. Same as a call to get(String name)

Parameters:
name -
Returns:


Copyright © 2013 (C) Cumulocity GmbH. All Rights Reserved.