org.ujoframework.core
Class UjoCoder

java.lang.Object
  extended by org.ujoframework.core.UjoCoder

public class UjoCoder
extends java.lang.Object

A tool for encoding an object to a text and a text back to the object.

Author:
Pavel Ponec

Field Summary
static java.lang.Class[] CONSTRUCTOR_TYPE
          Typ konstruktoru
 
Constructor Summary
UjoCoder()
           
 
Method Summary
protected  byte[] decodeBytes(java.lang.String hexString)
          Decode HexaString into byte array.
 java.lang.Object decodeValue(java.lang.Class type, java.lang.String aValue)
          Restore an Object value from a String representation.
 java.lang.Object decodeValue(UjoProperty property, java.lang.String aValue, java.lang.Class type)
          Restore an Object value from a String representation and write it into ujo.
protected  java.lang.String encodeBytes(byte[] bytes)
          Encode bytes to hexadecimal String.
 java.lang.String encodeValue(java.lang.Object value, boolean regenerationTest)
          Convert value to a String representation.
 char getSeparator()
          Returns a list separator
 boolean isContainerType(java.lang.Class baseType)
          Returns true, if the Class is type of Ujo, List or Object[].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTRUCTOR_TYPE

public static final java.lang.Class[] CONSTRUCTOR_TYPE
Typ konstruktoru

Constructor Detail

UjoCoder

public UjoCoder()
Method Detail

getSeparator

public char getSeparator()
Returns a list separator


encodeValue

public java.lang.String encodeValue(java.lang.Object value,
                                    boolean regenerationTest)
Convert value to a String representation.

Parameters:
value - The value
regenerationTest - Perform a decoding for an unknown data types.

decodeValue

public java.lang.Object decodeValue(UjoProperty property,
                                    java.lang.String aValue,
                                    java.lang.Class type)
                             throws java.lang.IllegalArgumentException
Restore an Object value from a String representation and write it into ujo.
If value can't be decoded, an IllegalArgumentException is throwed.

Throws:
java.lang.IllegalArgumentException

decodeValue

public java.lang.Object decodeValue(java.lang.Class type,
                                    java.lang.String aValue)
                             throws java.lang.IllegalArgumentException
Restore an Object value from a String representation.
If value can't be decoded, an IllegalArgumentException is throwed.

Throws:
java.lang.IllegalArgumentException

decodeBytes

protected byte[] decodeBytes(java.lang.String hexString)
Decode HexaString into byte array.

Parameters:
hexString - NULL value is not supported.
Returns:
Byte array

encodeBytes

protected java.lang.String encodeBytes(byte[] bytes)
Encode bytes to hexadecimal String.

Parameters:
bytes - NULL value is not supported
Returns:
A hexadecimal text

isContainerType

public boolean isContainerType(java.lang.Class baseType)
Returns true, if the Class is type of Ujo, List or Object[].



Copyright © 2010. All Rights Reserved.