|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IContainer
A container represents an entity with multiple properties. The properties
make up the state of the entity. The properties are represented by
IField
objects. The IField
implementations are for scalar
primitive types only. Each property is addressed by its identity (a string).
Non-scalar properties can be simulated by using identities with suitable
namespacing.
As each field changes, it notifies its container with the IEvent
that
encapsulates the change. These events are marshaled into an event frame by
the container.
A container may be static or dynamic; static container types have an
immutable IField
population. The definition of the fields is held in
a IContainerDefinitionField
that will be keyed against the
container's type. If the field definition changes for the container type, it
must be changed in all contexts. If not, then the container type will
not be read correctly by receiving contexts that have an incorrect static
definition for the type.
Dynamic containers have a variable (mutable) population with no constraints of the container's type.
IComponent
,
IContainerDefinitionField
,
IContainerFactory.IContainerBuilder
Nested Class Summary | |
---|---|
static class |
IContainer.DataState
The enumeration of data states for an IContainer . |
Method Summary | ||
---|---|---|
void |
add(IField field)
Add the field to this container. |
|
boolean |
contains(String key)
Determines if there is an IField instance with an identity equal
to the key argument. |
|
void |
destroy()
This is a life-cycle method of a container to release all resources and perform cleaning up prior to being made redundant. |
|
|
get(String identity)
Find the field in the container with the identity equal to the string argument. |
|
BooleanField |
getBooleanField(String identity)
Get the BooleanField identified by the identity |
|
String[] |
getComponentIdentities()
Get all the identities of the fields in this container. |
|
IFrameworkContext |
getContext()
Get the host context for the container instance. |
|
IContainer.DataState |
getDataState()
Get the container's data state. |
|
DoubleField |
getDoubleField(String identity)
Get the DoubleField identified by the identity |
|
FloatField |
getFloatField(String identity)
Get the FloatField identified by the identity |
|
IntegerField |
getIntegerField(String identity)
Get the IntegerField identified by the identity |
|
LongField |
getLongField(String identity)
Get the LongField identified by the identity |
|
String |
getNativeContextIdentity()
Get the identity of the context this container is native to; this is its local context identity. |
|
StringField |
getStringField(String identity)
Get the StringField identified by the identity |
|
IType |
getType()
Get the type of the container. |
|
boolean |
isClone()
Determine if this instance is the original or a clone. |
|
boolean |
isDynamic()
Identify if the container is dynamic or static. |
|
boolean |
isEmpty()
Determines if this container empty. |
|
boolean |
isLocal()
Is the container local to the host context returned by getContext() |
|
|
remove(T field)
Remove the field from this container. |
|
void |
setState(IContainer.DataState dataState)
Set the container state. |
|
int |
size()
Determine the number of IField instances held in this container |
|
void |
start()
A life-cycle method of a container to initialise all resources. |
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 |
Methods inherited from interface fulmine.IAddressable |
---|
getAddress, getDomain, getIdentity |
Methods inherited from interface fulmine.event.IEvent |
---|
clone, getDrivingFrame, getFrame, getSource, getTriggerEvent, setTriggerEvent |
Methods inherited from interface fulmine.IDescriptor |
---|
toDetailedString, toIdentityString |
Methods inherited from interface fulmine.IAddressable |
---|
getAddress, getDomain, getIdentity |
Methods inherited from interface fulmine.event.IEventFrame |
---|
addEvent, beginFrame, endFrame, flushFrame, isFrameActive |
Methods inherited from interface fulmine.model.container.subscription.remote.IRemoteSubscribable |
---|
getRemoteSubscriptionCount, markForRemoteSubscription, unmarkForRemoteSubscription |
Method Detail |
---|
void add(IField field)
IEvent
events raised by the
field will reach this container via its IEventFrame
interface.
field
- the field to add to this container.<T extends IField> T remove(T field)
field
- the field to remove from this container.
<T extends IField> T get(String identity)
identity
- the string identity of the field to find
null
if not found.String[] getComponentIdentities()
IField
objects in this container.void start()
RuntimeException
if a container is
accessed without being initialised.
The proper way to retrieve a container is via the
ContainerFactory#createContainer(String, int)
. This will
automatically invoke this method.
Idempotent operation.
start
in interface ILifeCycle
destroy()
void destroy()
Idempotent operation.
destroy
in interface IDestroyable
start()
void setState(IContainer.DataState dataState)
dataState
- the new business state.for a description of the states.
int size()
IField
instances held in this container
IField
instances held in this containerIContainer.DataState getDataState()
DataState for a description of the states.
IType getType()
getType
in interface IAddressable
IAddressable.getDomain()
boolean isEmpty()
true
if there are no fields in this container.boolean contains(String key)
IField
instance with an identity equal
to the key argument.
key
- the identity of a field to find in this container.
true
if there is an IField
with this
identity held in this.boolean isDynamic()
IField
population. Dynamic containers have a
variable (mutable) population.
true
if the definition is dynamicboolean isLocal()
getContext()
true
if the container is localIFrameworkContext getContext()
IFrameworkContext
hosting this instanceisLocal()
,
getNativeContextIdentity()
BooleanField getBooleanField(String identity)
BooleanField
identified by the identity
identity
- the identity of the field to get
BooleanField
for the identity, null
if
not found
ClassCastException
- if the field is not of this typeStringField getStringField(String identity)
StringField
identified by the identity
identity
- the identity of the field to get
StringField
for the identity, null
if
not found
ClassCastException
- if the field is not of this typeIntegerField getIntegerField(String identity)
IntegerField
identified by the identity
identity
- the identity of the field to get
IntegerField
for the identity, null
if
not found
ClassCastException
- if the field is not of this typeLongField getLongField(String identity)
LongField
identified by the identity
identity
- the identity of the field to get
LongField
for the identity, null
if not
found
ClassCastException
- if the field is not of this typeFloatField getFloatField(String identity)
FloatField
identified by the identity
identity
- the identity of the field to get
FloatField
for the identity, null
if not
found
ClassCastException
- if the field is not of this typeDoubleField getDoubleField(String identity)
DoubleField
identified by the identity
identity
- the identity of the field to get
DoubleField
for the identity, null
if
not found
ClassCastException
- if the field is not of this typeString getNativeContextIdentity()
getContext()
. If this
container is a remote container, this will return the remote context
identity.
Note: this is more for informational purposes, the true mechanism for
determining whether a container is local to the host context or not is by
checking isLocal()
.
isLocal()
,
getContext()
boolean isClone()
IEventListener
instances processing IContainer
instances
as IEvent
instances will receive the container instance as a
clone. In this way, the container changes are broadcast as a
logically immutable instance.
true
if this is a clone of the original
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |