se.js.jesdob
Class Dob

java.lang.Object
  extended by se.js.jesdob.Dob
All Implemented Interfaces:
IDob

public class Dob
extends java.lang.Object
implements IDob

A Dob is a dynamic object, containing various kinds of data.

It is possible to add attributes to a dob, and to assign values to these attributes. It is possible to read back the values for a specific attrbitutes.

Dobs can be exported to text as json-format, xml-format or dob-format. They can then be saved to files and read as dynamic objects when they are needed.


Field Summary
static java.lang.String newline
           
 
Constructor Summary
Dob()
          Parameterless constructor.
 
Method Summary
 java.lang.String attr(java.lang.String attribute)
          Returns the value of a specific attribute.
 IDob attr(java.lang.String attribute, boolean isTrue)
          Sets a specific attribute to a specific boolean value.
 IDob attr(java.lang.String attribute, float value)
          Sets a specific attribute to a specific float value.
 IDob attr(java.lang.String attribute, int value)
          Sets a specific attribute to a specific int value.
 IDob attr(java.lang.String attribute, java.lang.String value)
          Sets a specific attribute to a specific String value.
static IDob create(java.lang.String dobData)
          Returns a dob from a dob data string.
 boolean hasAttr(java.lang.String attribute)
          Checks if the Dob object contains a specific attribute or not.
 boolean is(java.lang.String attribute)
          Checks if a specific boolean attribute is true of false.
 IDob removeAttr(java.lang.String attribute)
          Removes a specific attribute from the Dob.
 java.lang.String toDob()
          Exports the Dob object data in dob-format.
 java.lang.String toJson()
          Exports the Dob object data in json-format.
 java.lang.String toXml()
          Exports the Dob object data in xml-format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newline

public static java.lang.String newline
Constructor Detail

Dob

public Dob()
Parameterless constructor.

Method Detail

create

public static IDob create(java.lang.String dobData)
Returns a dob from a dob data string.

Parameters:
dobData - The dob data.
Returns:
The new Dob object.

attr

public java.lang.String attr(java.lang.String attribute)
Returns the value of a specific attribute.

Specified by:
attr in interface IDob
Parameters:
attribute - The specific attribute.
Returns:
The value of the attribute.

is

public boolean is(java.lang.String attribute)
Checks if a specific boolean attribute is true of false.

Specified by:
is in interface IDob
Parameters:
attribute - The specific attribute.
Returns:
If the attribute is true or false.

attr

public IDob attr(java.lang.String attribute,
                 java.lang.String value)
Sets a specific attribute to a specific String value.

Specified by:
attr in interface IDob
Parameters:
attribute - The specific attribute.
value - The specific String value.
Returns:
The dob object, to enable method chaining.

attr

public IDob attr(java.lang.String attribute,
                 boolean isTrue)
Sets a specific attribute to a specific boolean value.

Specified by:
attr in interface IDob
Parameters:
attribute - The specific attribute.
value - The specific boolean value.
Returns:
The dob object, to enable method chaining.

attr

public IDob attr(java.lang.String attribute,
                 int value)
Sets a specific attribute to a specific int value.

Specified by:
attr in interface IDob
Parameters:
attribute - The specific attribute.
value - The specific int value.
Returns:
The dob object, to enable method chaining.

attr

public IDob attr(java.lang.String attribute,
                 float value)
Sets a specific attribute to a specific float value.

Specified by:
attr in interface IDob
Parameters:
attribute - The specific attribute.
value - The specific float value.
Returns:
The dob object, to enable method chaining.

hasAttr

public boolean hasAttr(java.lang.String attribute)
Checks if the Dob object contains a specific attribute or not.

Specified by:
hasAttr in interface IDob
Parameters:
attribute - The specific attribute
Returns:
True or false, depending on if the attribute exists or not.

removeAttr

public IDob removeAttr(java.lang.String attribute)
Removes a specific attribute from the Dob.

Specified by:
removeAttr in interface IDob
Parameters:
attribute - The specific attribute.
Returns:
The dob object, to enable method chaining.

toJson

public java.lang.String toJson()
Exports the Dob object data in json-format.

Specified by:
toJson in interface IDob
Returns:
The Dob object data in json-format.

toDob

public java.lang.String toDob()
Exports the Dob object data in dob-format.

Specified by:
toDob in interface IDob
Returns:
The Dob object data in dob-format.

toXml

public java.lang.String toXml()
Exports the Dob object data in xml-format.

Specified by:
toXml in interface IDob
Returns:
The Dob object data in xml-format.