Data Request Broker
2-3-release

fr.gael.drb
Class DrbDefaultAttribute

java.lang.Object
  extended by fr.gael.drb.DrbAbstractAttribute
      extended by fr.gael.drb.DrbDefaultAttribute
All Implemented Interfaces:
DrbAttribute, DrbItem

public class DrbDefaultAttribute
extends DrbAbstractAttribute

Default attribute implementation. This class is a convenient class that implements the DrbAttribute class. It is useful if no specific operations are required for an attribute. It holds a name, a value and enable to configute the specification level (i.e. default value).


Field Summary
 
Fields inherited from interface fr.gael.drb.DrbItem
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM
 
Constructor Summary
DrbDefaultAttribute(String name, Value value)
          Simple constructor of an attribute.
DrbDefaultAttribute(String name, Value value, boolean specified)
          Constructor of a defaulted attribute.
DrbDefaultAttribute(String name, Value value, boolean specified, DrbNode owner)
          Constructor of a defaulted attribute with an owner.
DrbDefaultAttribute(String name, Value value, DrbNode owner)
          Constructor of an attribute with an owner.
DrbDefaultAttribute(XsdAttribute decl, DrbNode owner)
          Schema constructor of an attribute.
 
Method Summary
 String getName()
          Name of the attribute.
 String getNamespaceURI()
          Get namespace URI.
 DrbNode getOwner()
          The node the owning the current attribute.
 Value getValue()
          The value of the attribute.
 int getValueType()
          The value type of the attribute.
 boolean isSpecified()
          The attribute was explicitly given a value.
 void rename(String name)
          Changes the name of the item.
 void setNamespaceURI(String namespace_uri)
          Sets the namespace URI.
 Value setValue(Value value)
          Changes the value of the item.
 String toString()
          Returns a description of the current attribute.
 
Methods inherited from class fr.gael.drb.DrbAbstractAttribute
getItemType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DrbDefaultAttribute

public DrbDefaultAttribute(XsdAttribute decl,
                           DrbNode owner)
Schema constructor of an attribute. This operation creates a default attribute from the specified schema

Parameters:
decl - attribute declaration
owner - The owner node of the attribute.

DrbDefaultAttribute

public DrbDefaultAttribute(String name,
                           Value value)
Simple constructor of an attribute. This operation creates an attribute witn a name and its corresponding value but without owner. The value is considered as specified. Both parameters shall never be null.

Parameters:
name - Name of the attribute.
value - Value of the attribute.

DrbDefaultAttribute

public DrbDefaultAttribute(String name,
                           Value value,
                           DrbNode owner)
Constructor of an attribute with an owner. This operation creates an attribute witn a name and its corresponding value with an owner. The value is considered as specified. All parameters shall never be null.

Parameters:
name - Name of the attribute.
value - Value of the attribute.
owner - The owner node of the attribute.

DrbDefaultAttribute

public DrbDefaultAttribute(String name,
                           Value value,
                           boolean specified)
Constructor of a defaulted attribute. This operation creates a defaulted attribute witn a name and its corresponding value without owner. The value is considered as specified according to the speicifed parameter. All other parameters shall never be null.

Parameters:
name - Name of the attribute.
value - Value of the attribute.
specified - True if the attribute is specified and false otherwise.

DrbDefaultAttribute

public DrbDefaultAttribute(String name,
                           Value value,
                           boolean specified,
                           DrbNode owner)
Constructor of a defaulted attribute with an owner. This operation creates a defaulted attribute witn a name and its corresponding nvalue witha specific owner. The value is considered as specified according to the speicifed parameter. All other parameters shall never be null.

Parameters:
name - Name of the attribute.
value - Value of the attribute.
specified - True if the attribute is specified and false otherwise.
owner - The owner node of the attribute.
Method Detail

getName

public final String getName()
Name of the attribute. Returns the name of the attribute set at construction.

Returns:
The name of the attribute.

rename

public final void rename(String name)
                  throws NullPointerException,
                         UnsupportedOperationException
Changes the name of the item. This method always throw an UnsupportedOperationException.

Parameters:
name - Reference to the new name.
Throws:
UnsupportedOperationException - This exception always raised because the name property is not defined for values.
NullPointerException - This exception is overriden by an UnsupportedOperationException.

getOwner

public DrbNode getOwner()
The node the owning the current attribute. Returns the owner node set at construction. The returned reference may be null.

Returns:
The owner of the attribute.

getValueType

public int getValueType()
The value type of the attribute. The returned type is the one of the value passed at construction. The type has not been checked from the construction.

Returns:
The type of the attribute.

getNamespaceURI

public String getNamespaceURI()
Get namespace URI. The namespace URI of this attribute, or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on a examination of the namespace declarations in scope. It is merely the namespace URI given at creation time. The Namespaces on an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

Returns:
The namspace URI or null if unspecified.

getValue

public Value getValue()
The value of the attribute. The returned value is the one passed at construction.

Returns:
The value of the attribute.

isSpecified

public boolean isSpecified()
The attribute was explicitly given a value. The returned value is the one passed at construction or the default one (i.e. true).

Returns:
false is a defaulted value or true otherwise.

setNamespaceURI

public void setNamespaceURI(String namespace_uri)
                     throws UnsupportedOperationException
Sets the namespace URI. Any previous namespace URI is discarded.

Parameters:
namespace_uri - A reference to the new namespace identifier.
Throws:
UnsupportedOperationException - This exception is never raised because the operation is fully implemented and accept any namespace.

setValue

public Value setValue(Value value)
               throws NullPointerException,
                      ClassCastException,
                      UnsupportedOperationException
Changes the value of the item. This operation sets a new value of the current item.The value type of the item shall be compatible with the item implementation. If the type does not match exactly it is casted to a compatible one based on the the fr.gael.drb.value capabilities. A reference to the effectivelly assigned value is returned by the operation so it is possible to check if a cast has been performed and therefore assess the accuracy of the assignement. If the cast is not possible the operation raises an UnsupportedOperationException. If the assignment is possible and the item implementation has a physical representation the value is updated in the physical source in order to persist among sessions. It therefore possible that this operation consumses an variable time.

Parameters:
value - The new value of the attribute. This value shall not be null
Returns:
The effectivelly assigned value.The type of this value may differ from the input one.
Throws:
NullPointerException - This exception is raised when the passed reference to the value is null. This exception may be overriden by an UnsupportedOperationException.
ClassCastException - This exception is raised when the implementation has not succeeded to cast the input value in a type compatible with the current node.
UnsupportedOperationException - This exception is raised when the implementation does not support the requested assignment for any reason.

toString

public String toString()
Returns a description of the current attribute. The output format is : "@" "=" .

Overrides:
toString in class DrbAbstractAttribute
Returns:
the description of the attribute.

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .