GigaSpaces XAP 10.0.1 API

com.gigaspaces.document
Class SpaceDocument

java.lang.Object
  extended by com.gigaspaces.document.SpaceDocument
All Implemented Interfaces:
com.gigaspaces.entry.VirtualEntry, Externalizable, Serializable
Direct Known Subclasses:
SpaceXmlDocument

public class SpaceDocument
extends Object
implements com.gigaspaces.entry.VirtualEntry, Externalizable

Represents a document which can be stored and retrieved from the space. A document is a collection of properties (which are name-value pairs) associated with a type. A property name is a string. A property value can be of any type, but it is usually either a scalar (e.g. int, String, Date, etc.), a set of properties (either Map or DocumentProperties), or an array/collection or scalars or maps. Documents of the same type can have different properties, which provides more dynamic schema than POJOs.

Since:
8.0
Author:
Niv Ingberg
See Also:
DocumentProperties, SpaceTypeDescriptor, Serialized Form

Constructor Summary
SpaceDocument()
          Creates a space document of type java.lang.Object.
SpaceDocument(String typeName)
          Creates a space document of the specified type.
SpaceDocument(String typeName, Map<String,Object> properties)
          Creates a space document of the specified type with the specified properties.
 
Method Summary
 SpaceDocument addProperties(Map<String,Object> properties)
          
 boolean containsProperty(String name)
          
 boolean equals(Object obj)
           
 Map<String,Object> getProperties()
          
<T> T
getProperty(String name)
          
 String getTypeName()
          
 int getVersion()
          
 int hashCode()
           
 void initFromDocument(SpaceDocument document)
           
protected  void initialize()
           
 boolean isTransient()
          
 void readExternal(ObjectInput in)
          This method is required by the Externalizable interface and should not be called directly.
 void readExternalV1(ObjectInput in)
           
<T> T
removeProperty(String name)
          
 SpaceDocument setProperty(String name, Object value)
          
 SpaceDocument setTransient(boolean isTransient)
          
 SpaceDocument setTypeName(String typeName)
          
 SpaceDocument setVersion(int version)
          
 String toString()
           
 void writeExternal(ObjectOutput out)
          This method is required by the Externalizable interface and should not be called directly.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpaceDocument

public SpaceDocument()
Creates a space document of type java.lang.Object.


SpaceDocument

public SpaceDocument(String typeName)
Creates a space document of the specified type.

Parameters:
typeName - Name of document's type.

SpaceDocument

public SpaceDocument(String typeName,
                     Map<String,Object> properties)
Creates a space document of the specified type with the specified properties.

Parameters:
typeName - Name of document's type.
properties - Properties to set in document.
Method Detail

initialize

protected void initialize()

getTypeName

public String getTypeName()

Specified by:
getTypeName in interface com.gigaspaces.entry.VirtualEntry

setTypeName

public SpaceDocument setTypeName(String typeName)

Specified by:
setTypeName in interface com.gigaspaces.entry.VirtualEntry

containsProperty

public boolean containsProperty(String name)

Specified by:
containsProperty in interface com.gigaspaces.entry.VirtualEntry

getProperty

public <T> T getProperty(String name)

Specified by:
getProperty in interface com.gigaspaces.entry.VirtualEntry

setProperty

public SpaceDocument setProperty(String name,
                                 Object value)

Specified by:
setProperty in interface com.gigaspaces.entry.VirtualEntry

removeProperty

public <T> T removeProperty(String name)

Specified by:
removeProperty in interface com.gigaspaces.entry.VirtualEntry

getProperties

public Map<String,Object> getProperties()

Specified by:
getProperties in interface com.gigaspaces.entry.VirtualEntry

addProperties

public SpaceDocument addProperties(Map<String,Object> properties)

Specified by:
addProperties in interface com.gigaspaces.entry.VirtualEntry

getVersion

public int getVersion()

Specified by:
getVersion in interface com.gigaspaces.entry.VirtualEntry

setVersion

public SpaceDocument setVersion(int version)

Specified by:
setVersion in interface com.gigaspaces.entry.VirtualEntry

isTransient

public boolean isTransient()

Specified by:
isTransient in interface com.gigaspaces.entry.VirtualEntry

setTransient

public SpaceDocument setTransient(boolean isTransient)

Specified by:
setTransient in interface com.gigaspaces.entry.VirtualEntry

toString

public String toString()
Overrides:
toString in class Object

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
This method is required by the Externalizable interface and should not be called directly.

Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
This method is required by the Externalizable interface and should not be called directly.

Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

readExternalV1

public void readExternalV1(ObjectInput in)
                    throws IOException,
                           ClassNotFoundException
Throws:
IOException
ClassNotFoundException

initFromDocument

public void initFromDocument(SpaceDocument document)

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.