fulmine.model.field
Interface IField

All Superinterfaces:
Cloneable, IAddressable, IComponent, IDescriptor, IDestroyable, IEvent, IEventSource, ILifeCycle, IWireState
All Known Subinterfaces:
IContainerDefinitionField
All Known Implementing Classes:
AbstractField, BooleanField, ContainerDefinitionField, DescriptorField, DoubleField, FloatField, IntegerField, LongField, StringField

public interface IField
extends IComponent, Cloneable

A field represents a property of an entity. The entity is represented by an IContainer. A field can be naturally added to a container and becomes part of the container's state.

A field is wire-state aware; it knows its data type and also includes the logic to read and write its identity and data into byte[] form. The reading and writing is an asymmetrical operation; a field can write its identity and data to a byte[] but can only read the data from the byte[], it cannot read its identity from a byte[], that is the responsibility of the parent container. This is because a container receives the wire frame and needs to locate each field expressed in the wire frame and pass the byte[] to the field.

A field can have a non-unique wire identity so long as no other field in the container shares the same wire identity. As an example, a field with a wire value 'XYZ' can identify a 'foo' field in record type A and a 'bar' field in record type B. These records are separate objects that will be sent as separate wire messages and so can share the same field wire value.

Note fields are equal by their type and encapsulated property value. Equality does not take into account the record of the field. Thus if 2 fields both called 'foo', belonging to different records, have the same type and value, they are equal.

Fields are given a permission by the creating application code. This permission governs whether receiving contexts can view the field's value.

Author:
Ramon Servadei
See Also:
IWireState, IWireIdentity, IPermissionProfile

Method Summary
 void addedToContainer(IContainer container)
          Signals the field that it has been added to a container.
 Object clone()
          Clone this.
 byte getApplication()
          Get the application code for the field.
 IContainer getContainer()
          Get the container this field has been added to
 short getPermission()
          Get the permission code for the field.
 Object getValue()
          Get the field value
 String getValueAsString()
          Get the value of this field as a string.
 void removedFromContainer(IContainer container)
          Signals the field that it has been removed from a container.
 boolean setValueFromString(String value)
          Set the field value from the string.
 
Methods inherited from interface fulmine.protocol.wire.IWireState
readState, writeState
 
Methods inherited from interface fulmine.event.IEventSource
addEvent, addListener, getEventSourceGroupId, getListeners, removeListener, removeListeners
 
Methods inherited from interface fulmine.IDescriptor
toDetailedString, toIdentityString
 
Methods inherited from interface fulmine.ILifeCycle
isActive, start
 
Methods inherited from interface fulmine.IDestroyable
destroy
 
Methods inherited from interface fulmine.IAddressable
getAddress, getDomain, getIdentity, getType
 
Methods inherited from interface fulmine.event.IEvent
getDrivingFrame, getFrame, getSource, getTriggerEvent, setTriggerEvent
 
Methods inherited from interface fulmine.IDescriptor
toDetailedString, toIdentityString
 
Methods inherited from interface fulmine.IAddressable
getAddress, getDomain, getIdentity, getType
 

Method Detail

addedToContainer

void addedToContainer(IContainer container)
Signals the field that it has been added to a container.

Parameters:
container - the container that now has a reference to this

getContainer

IContainer getContainer()
Get the container this field has been added to

Returns:
the IContainer this belongs to

removedFromContainer

void removedFromContainer(IContainer container)
Signals the field that it has been removed from a container.

Parameters:
container - the container that removed a reference to this

clone

Object clone()
             throws CloneNotSupportedException
Clone this.

Specified by:
clone in interface IEvent
Returns:
a clone of this
Throws:
CloneNotSupportedException
See Also:
Object.clone()

getValueAsString

String getValueAsString()
Get the value of this field as a string.

Returns:
a string representing the value of this field.

getValue

Object getValue()
Get the field value

Returns:
the field type

getPermission

short getPermission()
Get the permission code for the field.

Returns:
the permission code for the field
See Also:
IPermissionProfile

getApplication

byte getApplication()
Get the application code for the field.

Returns:
the application code for the field
See Also:
IPermissionProfile

setValueFromString

boolean setValueFromString(String value)
Set the field value from the string. The field converts the string into the field's data format. If there is an error performing this, the operation simply returns false or throws a RuntimeException.

Parameters:
value - the value to set
Returns:
true if the value changed, false if it did not or there was a problem converting the string to the field's data format


Copyright © 2007-2009. All Rights Reserved.