|
JFCML - JFC/Swing
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metasolutions.jfcml.helpers.Primative
public class Primative
Used by the JFCML interpreter to internally classify primitive entities. This class is a generic, immutable wrapper for the Java primitive wrapper classes (Byte,Boolean,Character,etc). As such, it provides a generic way to access the TYPE field belonging to the aforementioned classes.
Additionally, this class provides a mechanism to perform any valid cast on the wrapped primitive. For convenience, a constructor is declared for all primitive types.
New parsing abilities have been added to this class to support parsing Strings into Primative Objects, or arrays of Primative Objects. Supported syntax includes:
ReflectionHandler
Field Summary | |
---|---|
Class |
TYPE
The type of the primitive entity that this instance represents. |
Constructor Summary | |
---|---|
Primative(boolean b)
Construct a Primitive from a boolean. |
|
Primative(byte b)
Construct a Primitive from a byte. |
|
Primative(char c)
Construct a Primitive from a char. |
|
Primative(Class type,
Object val)
Construct a Primitive from a Java wrapper class. |
|
Primative(double d)
Construct a Primitive from a double. |
|
Primative(float f)
Construct a Primitive from a float. |
|
Primative(int i)
Construct a Primitive from an int. |
|
Primative(long l)
Construct a Primitive from a long. |
|
Primative(short s)
Construct a Primitive from a short. |
Method Summary | |
---|---|
static Primative |
castToType(Class toCastTo,
Primative toCast)
Casts a Primative to another type. |
Object |
getValue()
Returns the wrapped value. |
static void |
main(String[] args)
|
static Primative |
parsePrimative(String s)
|
static Primative[] |
parsePrimatives(String spec)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final Class TYPE
Constructor Detail |
---|
public Primative(boolean b)
b
- the boolean to wrap.public Primative(byte b)
b
- the byte to wrap.public Primative(char c)
c
- the char to wrap.public Primative(double d)
d
- the double to wrap.public Primative(float f)
f
- the float to wrap.public Primative(int i)
i
- the int to wrap.public Primative(long l)
l
- the long to wrap.public Primative(short s)
s
- the short to wrap.public Primative(Class type, Object val)
type
- the primative Class.val
- the primative value.
RuntimeException
- if the specified Class is not primative, or
if the specified value is not primative.Method Detail |
---|
public Object getValue()
public static Primative castToType(Class toCastTo, Primative toCast)
toCastTo
- the Class to cast totoCast
- the Primative Object to cast.
IllegalArgumentException
- if the specified Class is not primative, or if the specified
Primative is a boolean, and the specified class not boolean.public String toString()
toString
in class Object
public static Primative parsePrimative(String s)
public static Primative[] parsePrimatives(String spec)
public static void main(String[] args)
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |