ariba.util.expr
Class TypeConversionHelper

java.lang.Object
  extended by ariba.util.expr.TypeConversionHelper

public class TypeConversionHelper
extends java.lang.Object


Constructor Summary
TypeConversionHelper()
           
 
Method Summary
static boolean canCastTo(TypeInfo convertedTo, TypeInfo convertedFrom)
          Find out if the type convertedFrom can be widening to the type convertedTo.
static boolean canConvert(java.lang.Class convertTo, java.lang.Object source)
           
static boolean canWideningTo(TypeInfo convertedTo, TypeInfo convertedFrom)
          Find out if the type convertedFrom can be widening to the type convertedTo.
static java.lang.Object convertPrimitive(java.lang.String convertTo, java.lang.Object source)
          This method converts the source to an instance of type convertTo if source is a primitive and convertTo is also a primitive type.
static java.lang.Object convertPrimitive(TypeInfo convertTo, java.lang.Object source)
          This method converts the source to an instance of type convertTo if source is a primitive and convertTo is also a primitive type.
static boolean exactMatch(TypeInfo convertedTo, TypeInfo convertedFrom)
          Find out if the two types are the same.
static java.lang.Class getClassForType(java.lang.String name)
           
static boolean isCompatible(TypeRetriever provider, java.lang.String convertedTo, java.lang.String convertedFrom)
          Find out if the type convertedFrom is compatible with the type convertedTo.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeConversionHelper

public TypeConversionHelper()
Method Detail

isCompatible

public static boolean isCompatible(TypeRetriever provider,
                                   java.lang.String convertedTo,
                                   java.lang.String convertedFrom)
Find out if the type convertedFrom is compatible with the type convertedTo.

Parameters:
provider -
convertedTo -
convertedFrom -

canCastTo

public static boolean canCastTo(TypeInfo convertedTo,
                                TypeInfo convertedFrom)
Find out if the type convertedFrom can be widening to the type convertedTo. If both are primtive types, then this method will check if primtive narrowing is possible.

Parameters:
convertedTo -
convertedFrom -

canWideningTo

public static boolean canWideningTo(TypeInfo convertedTo,
                                    TypeInfo convertedFrom)
Find out if the type convertedFrom can be widening to the type convertedTo.

Parameters:
convertedTo -
convertedFrom -

exactMatch

public static boolean exactMatch(TypeInfo convertedTo,
                                 TypeInfo convertedFrom)
Find out if the two types are the same.

Parameters:
convertedTo -
convertedFrom -

convertPrimitive

public static java.lang.Object convertPrimitive(TypeInfo convertTo,
                                                java.lang.Object source)
This method converts the source to an instance of type convertTo if source is a primitive and convertTo is also a primitive type. Otherwise, this method return the source withou conversion.

Parameters:
convertTo -
source -

convertPrimitive

public static java.lang.Object convertPrimitive(java.lang.String convertTo,
                                                java.lang.Object source)
This method converts the source to an instance of type convertTo if source is a primitive and convertTo is also a primitive type. If the convertTo is a string and the convertFrom is a character, then conversion is allowed. Otherwise, this method return the source without conversion.

Parameters:
convertTo -
source -

canConvert

public static boolean canConvert(java.lang.Class convertTo,
                                 java.lang.Object source)

getClassForType

public static java.lang.Class getClassForType(java.lang.String name)


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.