javax.slee.resource
Class ConfigProperties.Property

java.lang.Object
  extended by javax.slee.resource.ConfigProperties.Property
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
ConfigProperties

public static final class ConfigProperties.Property
extends java.lang.Object
implements java.io.Serializable

The Property class represents a single property.

See Also:
Serialized Form

Constructor Summary
ConfigProperties.Property(java.lang.String name, java.lang.String type, java.lang.Object value)
          Create a new property object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this property for equality with another.
 java.lang.String getName()
          Get the name of the property.
 java.lang.String getType()
          Get the Java class type of the property.
 java.lang.Object getValue()
          Get the current value of the property.
 int hashCode()
          Get a hash code for this property.
 void setValue(java.lang.Object value)
          Set a new value for the property.
static java.lang.Object toObject(java.lang.String type, java.lang.String value)
          Utility method to convert the string representation of a value to a value object of a specified type.
 java.lang.String toString()
          Get a string representation of this property object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigProperties.Property

public ConfigProperties.Property(java.lang.String name,
                                 java.lang.String type,
                                 java.lang.Object value)
                          throws java.lang.IllegalArgumentException
Create a new property object.

Parameters:
name - the name of the property.
type - the Java class type of the property.
value - the value of the property. If value is not null, then value.getClass().getName().equals(type) must hold true.
Throws:
java.lang.NullPointerException - if name or type is null.
java.lang.IllegalArgumentException - if value.getClass().getName().equals(type) is not true.
Method Detail

getName

public java.lang.String getName()
Get the name of the property.

Returns:
the name of the property.

getType

public java.lang.String getType()
Get the Java class type of the property.

Returns:
the Java class type of the property.

getValue

public java.lang.Object getValue()
Get the current value of the property.

Returns:
the current value of the property. The current value may be null.

setValue

public void setValue(java.lang.Object value)
              throws java.lang.IllegalArgumentException
Set a new value for the property.

Parameters:
value - the value of the property. If value is not null, then value.getClass().getName().equals(getType()) must hold true.
Throws:
java.lang.IllegalArgumentException - if value.getClass().getName().equals(getType()) is not true.

equals

public boolean equals(java.lang.Object obj)
Compare this property for equality with another.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is an instance of this class with the same property name, type, and value as this, false otherwise.

hashCode

public int hashCode()
Get a hash code for this property.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this property. The hash code is based on the property's name.

toString

public java.lang.String toString()
Get a string representation of this property object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this property object.

toObject

public static java.lang.Object toObject(java.lang.String type,
                                        java.lang.String value)
                                 throws java.lang.IllegalArgumentException
Utility method to convert the string representation of a value to a value object of a specified type. For example toObject("java.lang.Integer","5") returns a java.lang.Integer object containing the value 5.

The following types can be converted by this method:

  • java.lang.Integer
  • java.lang.Long
  • java.lang.Double
  • java.lang.Float
  • java.lang.Short
  • java.lang.Byte
  • java.lang.Character
  • java.lang.Boolean
  • java.lang.String
These types are the supported types of SLEE resource adaptor configuration properties, SBB environment entries, etc.

Parameters:
type - the type of object to return.
value - a string representation of the value to convert.
Returns:
an object of the specified type, containing the value represented by the value argument.
Throws:
java.lang.NullPointerException - if either argument is null.
java.lang.IllegalArgumentException - if type is not supported by this method, or if value is not a legal value for the type.


Copyright © 2009. All Rights Reserved.