Package com.scriptbasic.utility
Class CastUtility
- java.lang.Object
-
- com.scriptbasic.utility.CastUtility
-
public final class CastUtility extends java.lang.Object- Author:
- Peter Verhas date Jun 30, 2012
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Objectcast(java.lang.Object object, java.lang.Class<?> castTo)Convert an object to another object so that the result does have the typecastTo.static java.lang.ObjecttoObject(RightValue rightValue)
-
-
-
Method Detail
-
cast
public static java.lang.Object cast(java.lang.Object object, java.lang.Class<?> castTo)Convert an object to another object so that the result does have the typecastTo.This is not a generic solution but does some handy conversion like Long to Integer so that the BASIC programs can easily call Java methods that accept int, float etc.
Casting is done on best effort. If the class is unknown to the utility then the original object is returned and it is up to the higher level code to recognize the class mis-alignment.
- Parameters:
object- the object to convert.castTo- the class that the result has to belong to.- Returns:
- the converted object.
-
toObject
public static java.lang.Object toObject(RightValue rightValue)
-
-