Methods Summary |
---|
protected java.lang.Object | binaryNumericPromotion(java.lang.Object left, java.lang.Object right)Implements binary numeric promotion as defined in JLS.
if ((left == null) || (right == null)) {
return null;
}
Object type = null;
if (left == getDoubleType() || right == getDoubleType()) {
type = getDoubleType();
} else if (left == getFloatType() || right == getFloatType()) {
type = getFloatType();
} else if (left == getLongType() || right == getLongType()) {
type = getLongType();
} else if (isIntegralType(left) && isIntegralType(right)) {
type = getIntType();
}
return type;
|
public java.lang.Object | extendedBinaryNumericPromotion(java.lang.Object left, java.lang.Object right)Implements binary numeric promotion as defined in JLS extended by
wrapper classes, BigDecimal and BigInteger.
if ((left == null) || (right == null) ||
!isNumericType(left) || !isNumericType(right)) {
return null;
}
// handle BigDecimal
if (isBigDecimalType(left) || isBigDecimalType(right)) {
return getBigDecimalType();
}
// handle BigInteger
if (isBigIntegerType(left)) {
return isFloatingPointType(right) ? right : getBigIntegerType();
}
if (isBigIntegerType(right)) {
return isFloatingPointType(left) ? left : getBigIntegerType();
}
// check wrapper classes
boolean wrapper = false;
if (isWrapperClass(left)) {
wrapper = true;
left = getPrimitiveType(left);
}
if (isWrapperClass(right)) {
wrapper = true;
right = getPrimitiveType(right);
}
Object promoted = binaryNumericPromotion(left, right);
if (wrapper && promoted != null) {
promoted = getWrapperClass(promoted);
}
return promoted;
|
public java.lang.Object | getBigDecimalType()Returns the BigDecimal type representation.
return BigDecimal.class;
|
public java.lang.Object | getBigIntegerType()Returns the BigInteger type representation.
return BigInteger.class;
|
public java.lang.Object | getBooleanClassType()Returns the Boolean class representation.
return Boolean.class;
|
public java.lang.Object | getBooleanType()Returns the boolean type representation.
return boolean.class;
|
public java.lang.Object | getByteClassType()Returns the Byte class representation.
return Byte.class;
|
public java.lang.Object | getByteType()Returns the byte type representation.
return byte.class;
|
public java.lang.Object | getCharType()Returns the char type representation.
return char.class;
|
public java.lang.Object | getCharacterClassType()Returns the Character class representation.
return Character.class;
|
public java.lang.Object | getDateType()Returns the java.util.Date type representation.
return Date.class;
|
public java.lang.Object | getDoubleClassType()Returns the type representation of class Double.
return Double.class;
|
public java.lang.Object | getDoubleType()Returns the double type representation.
return double.class;
|
public java.lang.Object | getFloatClassType()Returns the type representation of class Float.
return Float.class;
|
public java.lang.Object | getFloatType()Returns the float type representation.
return float.class;
|
public static oracle.toplink.essentials.internal.helper.BasicTypeHelperImpl | getInstance()Gets instance of this class
return singleton;
|
public java.lang.Object | getIntType()Returns the int type representation.
return int.class;
|
public java.lang.Object | getIntegerClassType()Returns the Inter class representation.
return Integer.class;
|
public java.lang.Class | getJavaClass(java.lang.Object type)Returns the class object of the specified type.
Class clazz = null;
if (type instanceof Class) {
clazz = (Class)type;
} else if (type instanceof ClassDescriptor) {
clazz = ((ClassDescriptor)type).getJavaClass();
}
return clazz;
|
public java.lang.Object | getLongClassType()Returns the type representation of class Long.
return Long.class;
|
public java.lang.Object | getLongType()Returns the long type representation.
return long.class;
|
public java.lang.Object | getObjectType()Returns the Object type representation.
return Object.class;
|
protected java.lang.Object | getPrimitiveType(java.lang.Object wrapper)Returns the primitive for the specified wrapper class.
return wrapperToPrimitive.get(wrapper);
|
public java.lang.Object | getShortClassType()Returns the Short class representation.
return Short.class;
|
public java.lang.Object | getShortType()Returns the short type representation.
return short.class;
|
public java.lang.Object | getStringType()Returns the String type representation.
return String.class;
|
public java.lang.String | getTypeName(java.lang.Object type)Returns the name of the specified type.
Class clazz = getJavaClass(type);
return (clazz == null) ? null : clazz.getName();
|
protected java.lang.Object | getWrapperClass(java.lang.Object primitive)Returns the wrapper class for the specified primitive.
return primitiveToWrapper.get(primitive);
|
public boolean | isAssignableFrom(java.lang.Object left, java.lang.Object right)
if ((left == null) || (right == null)) {
return false;
}
// chec for identical types
if (left == right) {
return true;
}
// numeric types are compatible
Object promoted = extendedBinaryNumericPromotion(left, right);
if (promoted != null) {
return true;
}
// date types are compatible
if (isDateClass(left) && isDateClass(right)) {
return true;
}
// handle boolean and Boolean
if (isBooleanType(left) && isBooleanType(right)) {
return true;
}
// check for inheritance and implements
return getJavaClass(left).isAssignableFrom(getJavaClass(right));
|
public boolean | isBigDecimalType(java.lang.Object type)
return type == getBigDecimalType();
|
public boolean | isBigIntegerType(java.lang.Object type)
return type == getBigIntegerType();
|
public boolean | isBooleanType(java.lang.Object type)Returns true if type is the boolean primitive type or the Boolean wrapper class
return (type == getBooleanType()) || (type == getBooleanClassType());
|
public boolean | isByteType(java.lang.Object type)Returns true if type is the byte primitive type or the Byte wrapper class
return (type == getByteType()) || (type == getByteClassType());
|
public boolean | isCharacterType(java.lang.Object type)Returns true if type is the char primitive type or the Character wrapper class
return (type == getCharType()) || (type == getCharacterClassType());
|
public boolean | isDateClass(java.lang.Object type)
return dateClasses.contains(type);
|
public boolean | isDoubleType(java.lang.Object type)Returns true if type is the double primitive type or the Double wrapper class
return (type == getDoubleType()) || (type == getDoubleClassType());
|
public boolean | isEnumType(java.lang.Object type)
Class clazz = getJavaClass(type);
return (clazz != null) && (clazz.isEnum());
|
public boolean | isFloatType(java.lang.Object type)Returns true if type is the float primitive type or the Float wrapper class
return (type == getFloatType()) || (type == getFloatClassType());
|
public boolean | isFloatingPointType(java.lang.Object type)Returns true if the specified type represents an
floating point type or a wrapper class of an floating point type.
return floatingPointTypes.contains(type);
|
public boolean | isIntType(java.lang.Object type)Returns true if type is the int primitive type or the Integer wrapper class
return (type == getIntType()) || (type == getIntegerClassType());
|
public boolean | isIntegralType(java.lang.Object type)Returns true if the specified type represents an
integral type or a wrapper class of an integral type.
return integralTypes.contains(type);
|
public boolean | isLongType(java.lang.Object type)Returns true if type is the long primitive type or the Long wrapper class
return (type == getLongType()) || (type == getLongClassType());
|
public boolean | isNumericType(java.lang.Object type)
return isIntegralType(type) || isFloatingPointType(type) ||
isBigIntegerType(type) || isBigDecimalType(type);
|
public boolean | isOrderableType(java.lang.Object type)Returns true if the specified type denotes an orable type
return isNumericType(type) || isStringType(type) ||
isDateClass(type) || isEnumType(type);
|
public boolean | isShortType(java.lang.Object type)Returns true if type is the short primitive type or the Short wrapper class
return (type == getShortType()) || (type == getShortClassType());
|
public boolean | isStringType(java.lang.Object type)Returns true if the specified type represents java.lang.String.
return type == getStringType();
|
public boolean | isWrapperClass(java.lang.Object type)Returns true if the specified type is a wrapper class.
return wrapperToPrimitive.containsKey(type);
|