org.apache.aries.jmx.codec
Class PropertyData<T>

java.lang.Object
  extended by org.apache.aries.jmx.codec.PropertyData<T>

public class PropertyData<T>
extends Object

PropertyData represents Property Type @see JmxConstants.PROPERTY_TYPE. It is a codec for the CompositeData representing a Property with an associated Type and Value.

Version:
$Rev: 896239 $ $Date: 2010-01-05 22:02:23 +0000 (Tue, 05 Jan 2010) $

Method Summary
static
<T> PropertyData<T>
from(CompositeData compositeData)
          Constructs a PropertyData object from the given CompositeData
 String getEncodedType()
           
 String getEncodedValue()
           
 String getKey()
           
 T getValue()
           
 boolean isEncodingPrimitive()
           
static PropertyData<Boolean> newInstance(String key, boolean value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive boolean type
static PropertyData<Byte> newInstance(String key, byte value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive byte type
static PropertyData<Character> newInstance(String key, char value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive char type
static PropertyData<Double> newInstance(String key, double value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive double type
static PropertyData<Float> newInstance(String key, float value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive float type
static PropertyData<Integer> newInstance(String key, int value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive int type
static PropertyData<Long> newInstance(String key, long value)
          Static factory method for PropertyData instance which preserves encoded type information for primitive long type
static
<T> PropertyData<T>
newInstance(String key, T value)
          Static factory method for PropertyData instance parameterized by value's type
 CompositeData toCompositeData()
          Returns CompositeData representing a Property typed by JmxConstants.PROPERTY_TYPE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static <T> PropertyData<T> newInstance(String key,
                                              T value)
                                   throws IllegalArgumentException
Static factory method for PropertyData instance parameterized by value's type

Type Parameters:
T -
Parameters:
key -
value - an instance of JmxConstants.SCALAR
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Integer> newInstance(String key,
                                                int value)
                                         throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive int type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Long> newInstance(String key,
                                             long value)
                                      throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive long type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Float> newInstance(String key,
                                              float value)
                                       throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive float type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Double> newInstance(String key,
                                               double value)
                                        throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive double type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Byte> newInstance(String key,
                                             byte value)
                                      throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive byte type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Character> newInstance(String key,
                                                  char value)
                                           throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive char type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

newInstance

public static PropertyData<Boolean> newInstance(String key,
                                                boolean value)
                                         throws IllegalArgumentException
Static factory method for PropertyData instance which preserves encoded type information for primitive boolean type

Parameters:
key -
value -
Returns:
Throws:
IllegalArgumentException - if key or value are null or value's type cannot be encoded

toCompositeData

public CompositeData toCompositeData()
Returns CompositeData representing a Property typed by JmxConstants.PROPERTY_TYPE.

Returns:

from

public static <T> PropertyData<T> from(CompositeData compositeData)
                            throws IllegalArgumentException
Constructs a PropertyData object from the given CompositeData

Parameters:
compositeData -
Returns:
Throws:
IlleglArgumentException - if compositeData is null or not of type JmxConstants.PROPERTY_TYPE
IllegalArgumentException

getKey

public String getKey()

getValue

public T getValue()

getEncodedType

public String getEncodedType()

getEncodedValue

public String getEncodedValue()

isEncodingPrimitive

public boolean isEncodingPrimitive()


Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.