org.objectweb.telosys.util
Class Conv

java.lang.Object
  extended byorg.objectweb.telosys.util.Conv

public class Conv
extends java.lang.Object

Utility class for types conversions ( set of static methods )
Primitive types conversion with MIN/MAX values management


Field Summary
static boolean CUT
           
static boolean STRICT
           
 
Method Summary
static byte toByte(long l)
          Converts to byte strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )
static byte toByte(long l, boolean b)
          Converts to byte ( STRICT or CUT mode )
static char toChar(long l)
          Converts to char strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )
static char toChar(long l, boolean b)
          Converts to char ( STRICT or CUT mode )
static int toInt(long l)
          Converts to int strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )
static int toInt(long l, boolean b)
          Converts to int ( STRICT or CUT mode )
static short toShort(long l)
          Converts to short strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )
static short toShort(long l, boolean b)
          Converts to short ( STRICT or CUT mode )
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRICT

public static final boolean STRICT
See Also:
Constant Field Values

CUT

public static final boolean CUT
See Also:
Constant Field Values
Method Detail

toChar

public static char toChar(long l)
Converts to char strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )

Parameters:
l - : value to convert
Returns:
Since:
v 1.0.2

toChar

public static char toChar(long l,
                          boolean b)
Converts to char ( STRICT or CUT mode )

Parameters:
l - : value to convert
b - : mode :
STRICT = throws a TelosysRuntimeException if lower/greater than MIN/MAX
CUT = no exception ( just cut the value if necessary, returning MIN or MAX )
Returns:
Since:
v 1.0.2

toByte

public static byte toByte(long l)
Converts to byte strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )

Parameters:
l - : value to convert
Returns:

toByte

public static byte toByte(long l,
                          boolean b)
Converts to byte ( STRICT or CUT mode )

Parameters:
l - : value to convert
b - : mode :
STRICT = throws a TelosysRuntimeException if lower/greater than MIN/MAX
CUT = no exception ( just cut the value if necessary, returning MIN or MAX )
Returns:

toShort

public static short toShort(long l)
Converts to short strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )

Parameters:
l - : value to convert
Returns:

toShort

public static short toShort(long l,
                            boolean b)
Converts to short ( STRICT or CUT mode )

Parameters:
l - : value to convert
b - : mode :
STRICT = throws a TelosysRuntimeException if lower/greater than MIN/MAX
CUT = no exception ( just cut the value if necessary, returning MIN or MAX )
Returns:

toInt

public static int toInt(long l)
Converts to int strictly ( throws a TelosysRuntimeException if lower/greater than MIN/MAX )

Parameters:
l - : value to convert
Returns:

toInt

public static int toInt(long l,
                        boolean b)
Converts to int ( STRICT or CUT mode )

Parameters:
l - : value to convert
b - : mode :
STRICT = throws a TelosysRuntimeException if lower/greater than MIN/MAX
CUT = no exception ( just cut the value if necessary, returning MIN or MAX )
Returns: