org.openptk.api
Interface ElementIF

All Known Subinterfaces:
ConnectionIF
All Known Implementing Classes:
Connection, Element, Input, JerseyConnection, Output

public interface ElementIF

The ElementIF interface is used by many classes within the package. It defines core functionality and supports storing both Properties and Attributes, each of these can be be used for application specific purposes

Author:
Scott Fehrman, Sun Microsystems, Inc.
contributor: Derrick Harcey, Sun Microsystems, Inc.

Method Summary
 void addAttribute(AttributeIF attr)
          Add an Attribute, copying an existing Attribute.
 void addAttribute(java.lang.String name)
          Add an Attribute, name only, with no value.
 void addAttribute(java.lang.String name, boolean value)
          Add an Attribute with the give name and boolean value.
 void addAttribute(java.lang.String name, java.lang.Boolean value)
           
 void addAttribute(java.lang.String name, java.lang.Boolean[] value)
           
 void addAttribute(java.lang.String name, int value)
          Add an Attribute with the give name and integer value.
 void addAttribute(java.lang.String name, java.lang.Integer value)
           
 void addAttribute(java.lang.String name, java.lang.Integer[] value)
           
 void addAttribute(java.lang.String name, long value)
           
 void addAttribute(java.lang.String name, java.lang.Long value)
           
 void addAttribute(java.lang.String name, java.lang.Long[] value)
           
 void addAttribute(java.lang.String name, java.lang.Object value)
          Add an Attribute with the give name and Object value.
 void addAttribute(java.lang.String name, java.lang.String value)
          Add an Attribute with the give name and a single String value.
 void addAttribute(java.lang.String name, java.lang.String[] values)
          Add an Attribute with the give name and multiple String values.
 void addAttributes(java.util.List<java.lang.String> names)
          Add multiple Attributes, with no value, one for each String.
 ElementIF copy()
          Returns a copy of the Element.
 AttributeIF getAttribute(java.lang.String name)
          Get the named Attribute.
 java.lang.String[] getAttributeNames()
          Gets all the Attribute names.
 java.util.Map<java.lang.String,AttributeIF> getAttributes()
          Get all of the Attributes as a Properties object.
 int getAttributesSize()
          Get the number of Attributes.
 java.lang.String getDescription()
          Get the Description a generic value that can be defined by the application.
 java.lang.String getKey()
          Gets the name of the attribute which is defined as the unique primary key.
 java.util.Properties getProperties()
          Get all of the Properties.
 int getPropertiesSize()
          Get the number Property key/value pairs.
 java.lang.String getProperty(java.lang.String key)
          Get a property value.
 State getState()
          Get the state.
 java.lang.String getStateAsString()
          Get the String representation for the current state.
 java.lang.String getStatus()
          Get the status
a general purpose piece of information that can store arbitrary information, typically used to store application status information.
 java.lang.Object getUniqueId()
          Get the Unique ID, a generic identifier.
 DataType getUniqueIdType()
           
 boolean isError()
          Flag to determine if there was an Error.
 void removeAttribute(java.lang.String name)
          Remove the named Attribute.
 void removeProperty(java.lang.String name)
          Remove the named Property
 void setAttributes(java.util.Map<java.lang.String,AttributeIF> map)
          Set / Replace all Attributes with the new Collection.
 void setDescription(java.lang.String str)
          Set the Description, a generic value that can be defined.
 void setError(boolean error)
          Flag to set if there is an Error.
 void setKey(java.lang.String key)
          Sets the name of the attribute which is defined as the unique primary key.
 void setProperties(java.util.Properties props)
          Set/Replace the properties with the new Properties.
 void setProperty(java.lang.String key, java.lang.String value)
          Set a property using the key and value.
 void setState(State state)
          Set the state, see State for valid states.
 void setStatus(java.lang.String str)
          Set the status
a general purpose piece of information that can be used to store arbitrary information, typically used to store application level status information.
 void setUniqueId(ElementIF value)
           
 void setUniqueId(java.lang.Integer value)
           
 void setUniqueId(java.lang.Long value)
           
 void setUniqueId(java.lang.String value)
          Set the Unique ID
a generic identifier, this should be a unique value.
 

Method Detail

addAttribute

void addAttribute(AttributeIF attr)
Add an Attribute, copying an existing Attribute.

Parameters:
attr - an existing AttributeIF

addAttribute

void addAttribute(java.lang.String name)
Add an Attribute, name only, with no value.

Parameters:
name - of the Attribute

addAttribute

void addAttribute(java.lang.String name,
                  boolean value)
Add an Attribute with the give name and boolean value.

Parameters:
name - of the Attribute
value - TRUE/FALSE

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Boolean value)

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Boolean[] value)

addAttribute

void addAttribute(java.lang.String name,
                  int value)
Add an Attribute with the give name and integer value.

Parameters:
name - of the Attribute
value - integer

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Integer value)

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Integer[] value)

addAttribute

void addAttribute(java.lang.String name,
                  long value)

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Long value)

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Long[] value)

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.Object value)
Add an Attribute with the give name and Object value.

Parameters:
name - of the Attribute
value - Object

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.String value)
Add an Attribute with the give name and a single String value.

Parameters:
name - of the Attribute
value - of the Attribute

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.String[] values)
Add an Attribute with the give name and multiple String values.

Parameters:
name - of the Attribute
values - String[] with multiple values

addAttributes

void addAttributes(java.util.List<java.lang.String> names)
Add multiple Attributes, with no value, one for each String.

Parameters:
names - List of Attributes to add

copy

ElementIF copy()
Returns a copy of the Element.

Returns:
ElementIF new ElementIF instance

getAttribute

AttributeIF getAttribute(java.lang.String name)
Get the named Attribute.

Parameters:
name - the Attributes name
Returns:
AttributeIF object

getAttributeNames

java.lang.String[] getAttributeNames()
Gets all the Attribute names.

Returns:
String[] String Array of Attribute names

getAttributes

java.util.Map<java.lang.String,AttributeIF> getAttributes()
Get all of the Attributes as a Properties object.
If an attribute has multiple values, only the first one is used

Returns:
Map a map all of the attributes.

getAttributesSize

int getAttributesSize()
Get the number of Attributes.

Returns:
int the number of attributes

getDescription

java.lang.String getDescription()
Get the Description a generic value that can be defined by the application.

Returns:
String the description of the Element

getKey

java.lang.String getKey()
Gets the name of the attribute which is defined as the unique primary key.

Returns:
String the name of the primary unique key attribute

getProperties

java.util.Properties getProperties()
Get all of the Properties.

Returns:
Properties all of the properties

getPropertiesSize

int getPropertiesSize()
Get the number Property key/value pairs.

Returns:
int number of properties

getProperty

java.lang.String getProperty(java.lang.String key)
Get a property value. Note: this is a "copy" of the value

Parameters:
key - for the property
Returns:
String value of the property

getState

State getState()
Get the state.

Returns:
enum State

getStateAsString

java.lang.String getStateAsString()
Get the String representation for the current state.

Returns:
String the current state

getStatus

java.lang.String getStatus()
Get the status
a general purpose piece of information that can store arbitrary information, typically used to store application status information.

Returns:
String the Elements status

getUniqueId

java.lang.Object getUniqueId()
Get the Unique ID, a generic identifier.

Returns:
Object the unique id of the ElementIF
Could be of type: String, Integer, Long

getUniqueIdType

DataType getUniqueIdType()
Returns:
DataType uniqueid type

isError

boolean isError()
Flag to determine if there was an Error.

Returns:
boolean error TRUE/FALSE

removeAttribute

void removeAttribute(java.lang.String name)
Remove the named Attribute.

Parameters:
name - the Attributes name

removeProperty

void removeProperty(java.lang.String name)
Remove the named Property

Parameters:
name - of the property

setAttributes

void setAttributes(java.util.Map<java.lang.String,AttributeIF> map)
Set / Replace all Attributes with the new Collection.

Parameters:
map - Collection of new AttributeIF items

setDescription

void setDescription(java.lang.String str)
Set the Description, a generic value that can be defined.

Parameters:
str - the description for the Element

setError

void setError(boolean error)
Flag to set if there is an Error.

Parameters:
error - set the error flag

setKey

void setKey(java.lang.String key)
Sets the name of the attribute which is defined as the unique primary key.

Parameters:
key - the name of the attribute which defines the primary key

setProperties

void setProperties(java.util.Properties props)
Set/Replace the properties with the new Properties.

Parameters:
props - new properties object

setProperty

void setProperty(java.lang.String key,
                 java.lang.String value)
Set a property using the key and value.

Parameters:
key - for the property
value - for the property

setState

void setState(State state)
Set the state, see State for valid states. The default value is NEW

Parameters:
state - the State

setStatus

void setStatus(java.lang.String str)
Set the status
a general purpose piece of information that can be used to store arbitrary information, typically used to store application level status information.

Parameters:
str - the Elements status

setUniqueId

void setUniqueId(ElementIF value)

setUniqueId

void setUniqueId(java.lang.Integer value)
Parameters:
value -

setUniqueId

void setUniqueId(java.lang.Long value)
Parameters:
value -

setUniqueId

void setUniqueId(java.lang.String value)
Set the Unique ID
a generic identifier, this should be a unique value. Note: it's uniqueness IS NOT CHECKED

Parameters:
value - the Elements unique id


View/submit a bug or feature

For further API reference and developer documentation, see www.openptk.org. That documentation contains more detailed, developer-targeted descriptions, definitions of terms, workarounds, and working code examples.

Copyright (C) 2008-2012, Project OpenPTK. All Rights Reserved