Packageorg.samchon.protocol.entity
Interfacepublic interface IEntity
Implementors Entity, EntityArray

An interface of entity.

Entity is a class for standardization of expression method using on network I/O by XML. If Invoke is a standard message protocol of Samchon Framework which must be kept, Entity is a recommended semi-protocol of message for expressing a data class. Following the semi-protocol Entity is not imposed but encouraged.

As we could get advantages from standardization of message for network I/O with Invoke, we can get additional advantage from standardizing expression method of data class with Entity. We do not need to know a part of network communication. Thus, with the Entity, we can only concentrate on entity's own logics and relationships between another entities. Entity does not need to how network communications are being done.

I say repeatedly. Expression method of Entity is recommended, but not imposed. It's a semi protocol for network I/O but not a essential protocol must be kept. The expression method of Entity, using on network I/O, is expressed by XML string.

If your own network system has a critical performance issue on communication data class, it would be better to using binary communication (with ByteArray). Don't worry about the problem! Invoke also provides methods for binary data (ByteArray).

See also

Invoke


Public Properties
 PropertyDefined By
  key : *
[read-only] Get a key that can identify the Entity uniquely.
IEntity
  TAG : String
[read-only] A tag name when represented by XML.
IEntity
Public Methods
 MethodDefined By
  
construct(xml:XML):void
Construct data of the Entity from a XML object.
IEntity
  
toXML():XML
Get a XML object represents the Entity.
IEntity
Property Detail
keyproperty
key:*  [read-only]

Get a key that can identify the Entity uniquely.

If identifier of the Entity is not atomic value, returns a string or paired object that can represents the composite identifier.


Implementation
    public function get key():*
TAGproperty 
TAG:String  [read-only]

A tag name when represented by XML.


Implementation
    public function get TAG():String
Method Detail
construct()method
public function construct(xml:XML):void

Construct data of the Entity from a XML object.

Overrides the construct() method and fetch data of member variables from the XML.

By recommended guidance, data representing member variables are contained in properties of the put XML object.

Parameters

xml:XML — An xml used to contruct data of entity.

toXML()method 
public function toXML():XML

Get a XML object represents the Entity.

A member variable (not object, but atomic value like number, string or date) is categorized as a property within the framework of entity side. Thus, when overriding a toXML() method and archiving member variables to an XML object to return, puts each variable to be a property belongs to only a XML object.

Don't archive the member variable of atomic value to XML::value causing enormouse creation of XML objects to number of member variables. An Entity must be represented by only a XML instance (tag).

Standard Usage Non-standard usage abusing value
<memberList>
	<member id='jhnam88' name='Jeongho+Nam' birthdate='1988-03-11' />
	<member id='master' name='Administartor' birthdate='2011-07-28' />
</memberList\>
<member>
	<id>jhnam88</id>
	<name>Jeongho+Nam<name>
	<birthdate>1988-03-11</birthdate>
</member>

Returns
XML — An XML object representing the Entity.