org.ow2.asmdex.encodedValue
Class EncodedValueFactory

java.lang.Object
  extended by org.ow2.asmdex.encodedValue.EncodedValueFactory

public class EncodedValueFactory
extends java.lang.Object

Factory for Encoded Values.

Author:
Julien Névo

Constructor Summary
EncodedValueFactory()
           
 
Method Summary
static EncodedValue getEncodedEmptyValue(java.lang.String desc)
          Returns an Encoded Value, with a value to 0 (if a primitive) or Null (if a reference).
static EncodedValue getEncodedNullValue()
          Returns a Null Encoded Value.
static EncodedValue getEncodedValue(java.lang.Object value)
          Gets an Encoded Value, only from an Object.
static EncodedValue getEncodedValue(java.lang.Object value, int type)
          Returns the Encoded Value from an Object and the type of the value.
static EncodedValue getEncodedValue(java.lang.Object value, java.lang.String desc)
          Gets the Encoded Value from an Object containing the value to encode, and the descriptor of the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodedValueFactory

public EncodedValueFactory()
Method Detail

getEncodedValue

public static EncodedValue getEncodedValue(java.lang.Object value,
                                           java.lang.String desc)
Gets the Encoded Value from an Object containing the value to encode, and the descriptor of the value. It can only be a primitive element.

Parameters:
value - the Value.
desc - descriptor of the value.
Returns:
the Encoded Value.

getEncodedValue

public static EncodedValue getEncodedValue(java.lang.Object value,
                                           int type)
Returns the Encoded Value from an Object and the type of the value. The value is ignored for Arrays. It has to be filled element by element.

Parameters:
value - the Value.
type - type of the Object (see Opcodes.VALUE_INT).
Returns:
the Encoded Value.

getEncodedEmptyValue

public static EncodedValue getEncodedEmptyValue(java.lang.String desc)
Returns an Encoded Value, with a value to 0 (if a primitive) or Null (if a reference).

Parameters:
desc - the descriptor of the Encoded Value.
Returns:
an Encoded Value, with a value to 0 (if a primitive) or Null (if a reference).

getEncodedNullValue

public static EncodedValue getEncodedNullValue()
Returns a Null Encoded Value.

Returns:
a Null Encoded Value.

getEncodedValue

public static EncodedValue getEncodedValue(java.lang.Object value)
Gets an Encoded Value, only from an Object. It should only be used when creating an Annotation, as we have the Object but not the type. Only primitives and array of primitive can be created.

Parameters:
value - the Object containing the value to encode (primitive or Object[]).
Returns:
the Encoded Value.