fulmine.model.field
Class AbstractField

java.lang.Object
  extended by fulmine.AbstractLifeCycle
      extended by fulmine.model.component.AbstractComponent
          extended by fulmine.model.field.AbstractField
All Implemented Interfaces:
IEvent, IEventSource, IAddressable, IDescriptor, IDestroyable, ILifeCycle, IComponent, IField, IWireState, Cloneable
Direct Known Subclasses:
BooleanField, ContainerDefinitionField, DescriptorField, DoubleField, FloatField, IntegerField, LongField, StringField

public abstract class AbstractField
extends AbstractComponent
implements IField

The base-class for all IField implementations. All implementations will include a setter and getter for the field's value. A field is added as a member of an IContainer.

If a field is set with a different value, the field will raise an event with its container. If the field is set with the same value, no event is raised.

Field implementations are not guaranteed to be thread-safe.

Author:
Ramon Servadei

Constructor Summary
AbstractField(String identity, IType type, byte application, short permission)
          Standard constructor.
 
Method Summary
 void addedToContainer(IContainer container)
          Signals the field that it has been added to a container.
protected  void doComponentDestroy()
          The destroy method that is invoked on a non-cloned version of this.
 boolean equals(Object obj)
           
 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.
 int hashCode()
           
protected  void notifyEvent(IEvent event)
          Notify the container with an event
 void removedFromContainer(IContainer container)
          Signals the field that it has been removed from a container.
 void setApplication(byte application)
           
 void setContainer(IContainer container)
           
 void setPermission(short permission)
           
 boolean setValueFromString(String value)
          Set the field value from the string.
 String toDetailedString()
          Provides a formatted string describing this object in detail.
 String toIdentityString()
          Get a string that provides the identification for this object.
 String toString()
           
 
Methods inherited from class fulmine.model.component.AbstractComponent
addEvent, addListener, checkClone, clone, createIdentityString, doDestroy, doPostAddListener, doPostRemoveListener, doReadState, doStart, doWriteState, getAddress, getAddressable, getDomain, getDrivingFrame, getEventSourceGroupId, getFrame, getIdentity, getIdentityString, getListeners, getLog, getSource, getTriggerEvent, getType, isClone, readState, removeListener, removeListeners, setDrivingFrame, setFrame, setTriggerEvent, writeState
 
Methods inherited from class fulmine.AbstractLifeCycle
checkActive, destroy, finalize, isActive, start
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fulmine.model.field.IField
clone, getValue, getValueAsString
 
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.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.IAddressable
getAddress, getDomain, getIdentity, getType
 

Constructor Detail

AbstractField

public AbstractField(String identity,
                     IType type,
                     byte application,
                     short permission)
Standard constructor.

Parameters:
identity - the identity of the field
type - the type of the field
application - the application that created the field
permission - the permission assigned for the field by the application
Method Detail

getContainer

public final IContainer getContainer()
Description copied from interface: IField
Get the container this field has been added to

Specified by:
getContainer in interface IField
Returns:
the IContainer this belongs to

getApplication

public byte getApplication()
Description copied from interface: IField
Get the application code for the field.

Specified by:
getApplication in interface IField
Returns:
the application code for the field
See Also:
IPermissionProfile

getPermission

public short getPermission()
Description copied from interface: IField
Get the permission code for the field.

Specified by:
getPermission in interface IField
Returns:
the permission code for the field
See Also:
IPermissionProfile

addedToContainer

public final void addedToContainer(IContainer container)
Description copied from interface: IField
Signals the field that it has been added to a container.

Specified by:
addedToContainer in interface IField
Parameters:
container - the container that now has a reference to this

removedFromContainer

public final void removedFromContainer(IContainer container)
Description copied from interface: IField
Signals the field that it has been removed from a container.

Specified by:
removedFromContainer in interface IField
Parameters:
container - the container that removed a reference to this

doComponentDestroy

protected void doComponentDestroy()
Description copied from class: AbstractComponent
The destroy method that is invoked on a non-cloned version of this.

Overrides:
doComponentDestroy in class AbstractComponent

notifyEvent

protected final void notifyEvent(IEvent event)
Notify the container with an event

Parameters:
event - the event to notify the container with

setContainer

public final void setContainer(IContainer container)

setApplication

public void setApplication(byte application)

setPermission

public void setPermission(short permission)

toIdentityString

public String toIdentityString()
Description copied from interface: IDescriptor
Get a string that provides the identification for this object. This should have no more detail than the Object.toString() method.

Specified by:
toIdentityString in interface IDescriptor
Overrides:
toIdentityString in class AbstractComponent
Returns:
a string that provides the identification for this object

toString

public String toString()
Overrides:
toString in class AbstractComponent

toDetailedString

public String toDetailedString()
Description copied from interface: IDescriptor
Provides a formatted string describing this object in detail. This has the same or more information than the standard Object.toString() method.

Specified by:
toDetailedString in interface IDescriptor
Overrides:
toDetailedString in class AbstractComponent
Returns:
a formatted string describing this object in detail

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractComponent

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractComponent

setValueFromString

public boolean setValueFromString(String value)
Description copied from interface: IField
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.

Specified by:
setValueFromString in interface IField
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.