LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyObjectId

java.lang.Object
  extended by leon.data.LyObjectId

public final class LyObjectId
extends java.lang.Object

This class implements object identifiers. An instance of this class identifies uniquely an object within an application.

Object ids are used for identifying both logical or physical objects.

Object ids contains :

See Also:
LyClass, LyClassInfo, LyPeerClass, LyObject

Field Summary
static java.lang.String __VERSION
          File version.
static char CLASS_SEP
          Separator used when to separate class id from object id within this class.
static char FIELD_SEP
          Separators used when object are identify by more than one field.
static char OLD_FIELD_SEP
           
static char VALUE_SEP
           
static char VISIBLE_FIELD_SEP
          Displayable separators used when object are identify by more than one field and the resquested string should not contain specific characters.
static char VISIBLE_VALUE_SEP
           
 
Constructor Summary
LyObjectId(LyApplication application, java.lang.String objectId)
          Builds an objectId in a given application from an encoded string.
LyObjectId(LyClass objectClass, java.lang.Object id)
          Constructs an object id from an object class and an Object that identifies it within this class.
 
Method Summary
 boolean checkObject()
          Checks if object corresponding to this object id exists on the data source of object class.
 int compare(LyObjectId objectId)
          Compares this object id with another object id using default comparison.
 boolean equals(LyObjectId objectId, boolean allowSuperClass)
          Compares the given object with this object id for equlity.
 boolean equals(java.lang.Object object)
          Compares the given object with this object id for equlity.
 LyClassInfo getClassInfo()
          Gets object class info to which the identified logical object belongs.
 java.lang.String getFullString()
          Gets a string representation of this object id.
 LyObject getLogicalObject()
          Retrieves logical object (LyObject) identified by this object id from the object source of the class info.
 LyObject getLyObject()
          Deprecated. Replaced by getLogicalObject.
 java.lang.Object getObject()
          Retrieves object identified by this object id from the data source of object class.
 LyClass getObjectClass()
          Gets object class to which the identified object belongs.
 int hashCode()
          Returns a hash code value corresponding this object id.
 java.lang.String toName()
          Gets displayable string that identifies uniquely the object within the class.
 java.lang.String[] toNames()
          Gets an array of displayable strings that splits the object id using FIELD_SEP.
 java.lang.String toString()
          Gets string that identifies uniquely the object within the class.
 java.lang.String[] toStrings()
          Gets an array of strings that splits the object id using FIELD_SEP.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version.

See Also:
Constant Field Values

FIELD_SEP

public static char FIELD_SEP
Separators used when object are identify by more than one field.


OLD_FIELD_SEP

public static char OLD_FIELD_SEP

VALUE_SEP

public static char VALUE_SEP

VISIBLE_FIELD_SEP

public static char VISIBLE_FIELD_SEP
Displayable separators used when object are identify by more than one field and the resquested string should not contain specific characters.


VISIBLE_VALUE_SEP

public static char VISIBLE_VALUE_SEP

CLASS_SEP

public static char CLASS_SEP
Separator used when to separate class id from object id within this class.

Constructor Detail

LyObjectId

public LyObjectId(LyClass objectClass,
                  java.lang.Object id)
Constructs an object id from an object class and an Object that identifies it within this class.

Parameters:
objectClass - Class of the object that is represented by this object id.
id - Object that identifies the object within the given class. This object may be an array of Objects if the object class contains several id fields.
Throws:
java.lang.IllegalArgumentException - If the given object class is null.
java.lang.IllegalArgumentException - If the given id is null.

LyObjectId

public LyObjectId(LyApplication application,
                  java.lang.String objectId)
Builds an objectId in a given application from an encoded string.

Parameters:
application - Application in which this object id is constructed.
objectId - Object id encoded as a string. This string must start with the class id (LyClass.getId), followed by CLASS_SEP and by a string that identifies the object within the class (this should be the result of concatenation of all values corresponding to id fields of the class).
Throws:
java.lang.IllegalArgumentException - If the given string objectId is null.
java.lang.IllegalArgumentException - If the class separator can't be find in the given string.
java.lang.IllegalArgumentException - If class id extracted from the objectId can't be found in given application.
Method Detail

getObjectClass

public LyClass getObjectClass()
Gets object class to which the identified object belongs.

Returns:
Class of the identified object.

getClassInfo

public LyClassInfo getClassInfo()
Gets object class info to which the identified logical object belongs.

Returns:
Class of the identified logical object.

toString

public java.lang.String toString()
Gets string that identifies uniquely the object within the class. This string may contain non displayable characters.

Overrides:
toString in class java.lang.Object
Returns:
String that identifies the object within the class.

toName

public java.lang.String toName()
Gets displayable string that identifies uniquely the object within the class. This string contains only displayable characters.

Returns:
Displayable string that identifies the object within the class. Same string as the one returned by toString but with FIELD_SEP replaced by VISIBLE_FIELD_SEP.

toNames

public java.lang.String[] toNames()
Gets an array of displayable strings that splits the object id using FIELD_SEP.

Returns:
Array of strings corresponding to the different parts of object id (each substring should correspond to each id field of the object class).

toStrings

public java.lang.String[] toStrings()
Gets an array of strings that splits the object id using FIELD_SEP.

Returns:
Array of strings corresponding to the different parts of object id (each substring should correspond to each id field of the object class).

hashCode

public int hashCode()
Returns a hash code value corresponding this object id.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code value for this object id.

compare

public int compare(LyObjectId objectId)
Compares this object id with another object id using default comparison.

Parameters:
objectId - Object id to compare with this object id.
Returns:
0 If the two object ids are identical, a positive number if this object id is "greater" than object id. Otherwise, a negative number is returned.

equals

public boolean equals(java.lang.Object object)
Compares the given object with this object id for equlity. This method is overriden to compare class id and string id.

Overrides:
equals in class java.lang.Object
Returns:
True if this object id is the same as the given object, false otherwise.

equals

public boolean equals(LyObjectId objectId,
                      boolean allowSuperClass)
Compares the given object with this object id for equlity. This method is overriden to compare class id and string id.

Parameters:
object -
Returns:
True if this object id is the same as the given object, false otherwise.

getFullString

public java.lang.String getFullString()
Gets a string representation of this object id. This string contains the class id concatened to CLASS_SEP, followed by the string id.

Returns:
String representation of this object id.

getObject

public java.lang.Object getObject()
Retrieves object identified by this object id from the data source of object class.

Returns:
Object if it's found, null otherwise.

getLogicalObject

public LyObject getLogicalObject()
Retrieves logical object (LyObject) identified by this object id from the object source of the class info. Same as getObject but casted to LyObject.

Returns:
Logical object if it's found, null otherwise.

getLyObject

public LyObject getLyObject()
Deprecated. Replaced by getLogicalObject.

Retrieves logical object identified by this object id.


checkObject

public boolean checkObject()
Checks if object corresponding to this object id exists on the data source of object class.

Returns:
True if an object corresponding to this object id is found, false otherwise.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com