de.hpi.fgis.dude.util.data
Class DuDeObjectId

java.lang.Object
  extended by de.hpi.fgis.dude.util.data.DuDeObjectId
All Implemented Interfaces:
AutoJsonable, Jsonable, Comparable<DuDeObjectId>

public class DuDeObjectId
extends Object
implements Jsonable, Comparable<DuDeObjectId>

DuDeObjectId encapsulates the identifying information of each DuDeObject.

Author:
Matthias Pohl

Field Summary
static String OBJECT_ID_ATTRIBUTE_NAME
          The attribute name of the object id within the Json representation of this DuDeObject.
static String SOURCE_ID_ATTRIBUTE_NAME
          The attribute name of the source id within the Json representation of this DuDeObject.
 
Constructor Summary
DuDeObjectId()
          Initializes an invalid DuDeObjectId.
DuDeObjectId(String srcId, JsonArray objId)
          Initializes a DuDeObjectId with the passed identifiers.
 
Method Summary
 int compareTo(DuDeObjectId other)
           
 boolean equals(Object obj)
           
 void fromJson(DuDeJsonParser<?> jsonParser)
          Initializes the current instance using the passed DuDeJsonParser.
 boolean fromSameSource(DuDeObjectId other)
          Checks if the passed id has the same source information.
 JsonArray getObjectId()
          Returns the object identifier.
 String getSourceId()
          Returns the source identifier.
 int hashCode()
           
 boolean isValid()
          Checks if the id is valid.
 void toJson(DuDeJsonGenerator jsonGenerator)
          Generates the Json code using the passed DuDeJsonGenerator.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

OBJECT_ID_ATTRIBUTE_NAME

public static final String OBJECT_ID_ATTRIBUTE_NAME
The attribute name of the object id within the Json representation of this DuDeObject.

See Also:
Constant Field Values

SOURCE_ID_ATTRIBUTE_NAME

public static final String SOURCE_ID_ATTRIBUTE_NAME
The attribute name of the source id within the Json representation of this DuDeObject.

See Also:
Constant Field Values
Constructor Detail

DuDeObjectId

DuDeObjectId()
Initializes an invalid DuDeObjectId.


DuDeObjectId

DuDeObjectId(String srcId,
             JsonArray objId)
Initializes a DuDeObjectId with the passed identifiers. If one of the parameters is null, the id will be invalid.

Parameters:
srcId - The identifier of the corresponding source.
objId - The actual identifier of the object.
Method Detail

getSourceId

public String getSourceId()
Returns the source identifier.

Returns:
The source identifier or null, if the id is invalid.

getObjectId

public JsonArray getObjectId()
Returns the object identifier.

Returns:
The object identifier or null, if the id is invalid.

isValid

public boolean isValid()
Checks if the id is valid.

Returns:
true, if the id is valid; otherwise false.

fromSameSource

public boolean fromSameSource(DuDeObjectId other)
Checks if the passed id has the same source information.

Parameters:
other - Another DuDeObjectId.
Returns:
true, if both ids contain the same source information; otherwise false.

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(DuDeObjectId other)
Specified by:
compareTo in interface Comparable<DuDeObjectId>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

toJson

public void toJson(DuDeJsonGenerator jsonGenerator)
            throws org.codehaus.jackson.JsonGenerationException,
                   IOException
Description copied from interface: Jsonable
Generates the Json code using the passed DuDeJsonGenerator.

Specified by:
toJson in interface Jsonable
Parameters:
jsonGenerator - The DuDeJsonGenerator that is used internally.
Throws:
org.codehaus.jackson.JsonGenerationException - If an error occurs while generating the Json syntax.
IOException - If an error occurs while writing to the output.

fromJson

public void fromJson(DuDeJsonParser<?> jsonParser)
              throws org.codehaus.jackson.JsonParseException,
                     IOException
Description copied from interface: Jsonable
Initializes the current instance using the passed DuDeJsonParser.

Specified by:
fromJson in interface Jsonable
Parameters:
jsonParser - The parser that is used for extracting the data out of the Json.
Throws:
org.codehaus.jackson.JsonParseException - If an error occurs while parsing the Json.
IOException - If an error occurs while reading from the stream.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.