import { XML } from "sxml"; /** * 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). * * ![Class Diagram](http://samchon.github.io/framework/images/design/ts_class_diagram/protocol_message_protocol.png) * * @author Jeongho Nam */ export interface IEntity { /** * 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. * * @param xml An xml used to contruct data of entity. */ construct(xml: XML): void; /** * Get a key that can identify the Entity uniquely. * * If identifier of the Entity is not atomic value, returns a paired or tuple object * that can represents the composite identifier. * * * class Point extends Entity * { * private x: number; * private y: number; * * public key(): std.Pair * { * return std.make_pair(this.x, this.y); * } * } * */ key(): any; /** * A tag name when represented by XML. * * */ TAG(): string; /** * 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.

* * * jhnam88 * Jeongho Nam * 1988-03-11 * * * master * Administartor * 2011-07-28 * * * * @return An XML object representing the Entity. */ toXML(): XML; } /** * @hidden */ export declare namespace IEntity { function construct(entity: IEntity, xml: XML, ...prohibited_names: string[]): void; function toXML(entity: IEntity, ...prohibited_names: string[]): XML; }