Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.tripi.asp
Class Types  view Types download Types.java

java.lang.Object
  extended bycom.tripi.asp.Types

public class Types
extends java.lang.Object

The Types class contains utilities for conversion between data types.

Version:
0.9

Field Summary
private static org.apache.log4j.Category DBG
          Debugging instance
 
Constructor Summary
Types()
           
 
Method Summary
(package private) static java.lang.Boolean coerceToBoolean(java.lang.Object obj)
          Converts a data object to a boolean type.
(package private) static AspDate coerceToDate(java.lang.Object obj)
          Coerces a data value to a Date value.
(package private) static java.lang.Double coerceToDouble(java.lang.Object obj)
          Casts an object to a double value.
static java.lang.Integer coerceToInteger(java.lang.Object obj)
          Coerces a data type into an Integer type.
(package private) static java.lang.Object coerceToNode(java.lang.Object obj)
          Coerces an object to a "node".
static java.lang.String coerceToString(java.lang.Object obj)
          Coerces an object to a string.
static java.lang.Object dereference(java.lang.Object obj)
          Derefernces the given object.
static java.lang.Integer integerFromHex(java.lang.String str)
          Obtains an integer value from a hex string line &FF.
static boolean isDate(java.lang.Object testObject)
          This function tests an object to see if it is a date object.
static boolean isNumber(java.lang.Object obj)
          Determines if this object is a number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBG

private static final org.apache.log4j.Category DBG
Debugging instance

Constructor Detail

Types

public Types()
Method Detail

coerceToInteger

public static java.lang.Integer coerceToInteger(java.lang.Object obj)
                                         throws AspException
Coerces a data type into an Integer type.
  • null = 0
  • undefined = 0
  • Integer = self
  • Double = Cast to integer
  • String = Parsed to integer, errors are passed through
  • Everything else causes a AspCastException


coerceToString

public static java.lang.String coerceToString(java.lang.Object obj)
                                       throws AspException
Coerces an object to a string.
  • null = ""
  • undefined = ""
  • String = self
  • Integer = cast to string
  • Boolean = cast to "true"/"false"


coerceToBoolean

static java.lang.Boolean coerceToBoolean(java.lang.Object obj)
                                  throws AspException
Converts a data object to a boolean type.
  • null = false
  • undefined = false
  • Boolean = self


coerceToDouble

static java.lang.Double coerceToDouble(java.lang.Object obj)
                                throws AspException
Casts an object to a double value.
  • null - 0.0
  • undefined - 0.0
  • Double - self
  • Integer - Casted to double
  • String - Parsed to double


coerceToDate

static AspDate coerceToDate(java.lang.Object obj)
                     throws AspException
Coerces a data value to a Date value.
  • Date - Self


coerceToNode

static java.lang.Object coerceToNode(java.lang.Object obj)
                              throws AspException
Coerces an object to a "node". All of the known base types (Integer, Boolean, Double, String) are left as-is, but other Java objects are wrapped into a JavaObjectNode-type class to handle ASP->Java calls.
  • null - null
  • Node - self
  • Double - self
  • Integer - self
  • Boolean - self
  • Byte - self
  • String - self
  • SimpleMap + SimpleReference - Wrapped in a JavaReferenceMapNode
  • SimpleMap - Wrapped in a JavaMapNode
  • SimpleReference - Wrapped in a JavaReferenceNode
  • Other - Wrapped in a JavaObjectNode


integerFromHex

public static java.lang.Integer integerFromHex(java.lang.String str)
Obtains an integer value from a hex string line &FF.


isNumber

public static boolean isNumber(java.lang.Object obj)
                        throws AspException
Determines if this object is a number.


dereference

public static java.lang.Object dereference(java.lang.Object obj)
                                    throws AspException
Derefernces the given object. If the object is a SimpleReference object, it will dereference it, and keep dereferencing it until a non-SimpleReference object is found.


isDate

public static boolean isDate(java.lang.Object testObject)
This function tests an object to see if it is a date object.