*
Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS

 

*

 


com.architech.entry
Class Attribute

java.lang.Object
  |
  +--com.architech.entry.Attribute
All Implemented Interfaces:
com.architech.entry.AttributeInterface, Serializable

public class Attribute
extends Object
implements com.architech.entry.AttributeInterface, Serializable

The Attribute class is used in conjunction with the Entry object to store information about an attribute. The attribute has a name and a list of zero or more values. Each value can be any type of Java object so you can add values of any kind to the attribute.

See Also:
Serialized Form

Field Summary
static char ATTRIBUTE_ADD
          Add value
static char ATTRIBUTE_DELETE
          Delete value
static char ATTRIBUTE_REPLACE
          Replace value
 
Constructor Summary
Attribute()
          Initialize this attribute with no name, no values and the operation code set to ATTRIBUTE_REPLACE.
Attribute(String name)
          Initializes this attribute with no values and the operation code set to ATTRIBUTE_REPLACE, the name is set to name.
Attribute(String name, Object value)
          Initializes this attribute with operation code set to ATTRIBUTE_REPLACE, the name is set to name and the value value is added to the list of values.
 
Method Summary
 void addValue(Object p1)
          This method adds a value to the attribute's list of values.
 void clear()
          This method removes all values from this attribute and sets the operation to ATTRIBUTE_REPLACE.
 Object clone()
          Returns a clone of this object.
 boolean contains(Object p1)
          This method checks if a value is contained in this attribute.
 String getName()
          This method returns this attributes's name.
 char getOper()
          This method returns the operation type of this attribute.
 String getValue()
          This method returns the first value, if any, as a String object.
 Object getValue(int index)
          This method returns the value at the position given by index.
 Object[] getValues()
          This method returns this attribute's values as an array of objects.
 boolean hasValue(Object value)
          This method checks if a value is contained in this attribute.
 boolean hasValueIC(String value)
          This method checks if a string value is contained in this attribute.
 void setName(String name)
          This method sets this attributes's name.
 void setOper(char operation)
          This method sets the operation type of this attribute.
 void setValue(int p1, Object p2)
          This method sets the attribute's value at a specific position to the value specified.
 void setValue(Object p1)
          This method sets the attribute's value at position 0 to the value specified.
 void setValues(Vector values)
          This method sets the attribute's values using the Vector passed to it.
 int size()
          This method returns the number of values contained in this attribute.
 String toString()
          This method returns the string representation of this attribute.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_REPLACE

public static final char ATTRIBUTE_REPLACE
Replace value

ATTRIBUTE_ADD

public static final char ATTRIBUTE_ADD
Add value

ATTRIBUTE_DELETE

public static final char ATTRIBUTE_DELETE
Delete value
Constructor Detail

Attribute

public Attribute()
Initialize this attribute with no name, no values and the operation code set to ATTRIBUTE_REPLACE.

Attribute

public Attribute(String name)
Initializes this attribute with no values and the operation code set to ATTRIBUTE_REPLACE, the name is set to name.
Parameters:
name - The attribute name

Attribute

public Attribute(String name,
                 Object value)
Initializes this attribute with operation code set to ATTRIBUTE_REPLACE, the name is set to name and the value value is added to the list of values.
Parameters:
name - The attribute name
value - The attribute value
Method Detail

clone

public Object clone()
Returns a clone of this object. The cloning is shallow and does not clone attribute values.
Overrides:
clone in class Object
Returns:
The cloned attribute

clear

public void clear()
This method removes all values from this attribute and sets the operation to ATTRIBUTE_REPLACE.

hasValue

public boolean hasValue(Object value)
This method checks if a value is contained in this attribute.
Parameters:
value - The value to check for
Returns:
true if attribute contains the value, false if not

hasValueIC

public boolean hasValueIC(String value)
This method checks if a string value is contained in this attribute. The method converts values to their string representation before doing a case-insensitive comparison.

JavaScript example:

		if ( conn.hasValueIC("this value") ) {
			task.logmsg ( "It is there" );
		}
 
Parameters:
value - The string value to check for
Returns:
true if attribute contains the value, false if not

contains

public boolean contains(Object p1)
This method checks if a value is contained in this attribute.
Specified by:
contains in interface com.architech.entry.AttributeInterface
Parameters:
value - The value to check for
Returns:
true if attribute contains the value, false if not

getValue

public String getValue()
This method returns the first value, if any, as a String object.
Specified by:
getValue in interface com.architech.entry.AttributeInterface
Returns:
The String object or null if attribute has no values

getValue

public Object getValue(int index)
This method returns the value at the position given by index. The value is returned as-is.

JavaScript example

 var v = conn.getAttribute("attrname").getValue ( 0 );
 task.logmsg ( "Java class of v is: " + v.getClass().getName() );
 task.logmsg ( "String representation: " + v.toString() );
 if ( v.getClass().getName() == "java.util.Date" ) {
 	task.logmsg ("Date object: " + v.getMonth();
 }
 
Specified by:
getValue in interface com.architech.entry.AttributeInterface
Parameters:
index - The position
Returns:
The String object or null if index is out of range
See Also:
size()

getValues

public Object[] getValues()
This method returns this attribute's values as an array of objects. The array may be empty if attribute has no values (e.g. arr.length == 0).
Specified by:
getValues in interface com.architech.entry.AttributeInterface
Returns:
An array of objects.

setValues

public void setValues(Vector values)
This method sets the attribute's values using the Vector passed to it.
Parameters:
p1 - The new value array

setValue

public void setValue(Object p1)
This method sets the attribute's value at position 0 to the value specified. If the attribute has no values the value is inserted, otherwise the value at position 0 is replaced.
Specified by:
setValue in interface com.architech.entry.AttributeInterface
Parameters:
p1 - The new value

setValue

public void setValue(int p1,
                     Object p2)
This method sets the attribute's value at a specific position to the value specified. If the position (p1) is out of range an exception is thrown.
Specified by:
setValue in interface com.architech.entry.AttributeInterface
Parameters:
p1 - The position
p2 - The value
Throws:
Index - out of bounds

addValue

public void addValue(Object p1)
This method adds a value to the attribute's list of values.
Specified by:
addValue in interface com.architech.entry.AttributeInterface
Parameters:
p1 - The new value

getName

public String getName()
This method returns this attributes's name.
Specified by:
getName in interface com.architech.entry.AttributeInterface
Returns:
The attribute's name

setName

public void setName(String name)
This method sets this attributes's name.
Specified by:
setName in interface com.architech.entry.AttributeInterface
Parameters:
name - The attribute's name

getOper

public char getOper()
This method returns the operation type of this attribute.
Returns:
The operation type as a char

setOper

public void setOper(char operation)
This method sets the operation type of this attribute.
Parameters:
operation - The operation type as a char

size

public int size()
This method returns the number of values contained in this attribute.
Specified by:
size in interface com.architech.entry.AttributeInterface
Returns:
The number of values

toString

public String toString()
This method returns the string representation of this attribute.
Overrides:
toString in class Object
Returns:
The name and values as a structured string


Copyright © 1999-2001 Metamerge AS. All Rights Reserved.
*

 

  Metamerge Integrator version 4.6 ©Copyright Metamerge AS 2000-2002 Last edited 2002-05-07 contact us