|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.codegen.ecore.genmodel.impl.Literals
Utility class for converting primitive values, strings, and classes to literals that could appear in code.
Method Summary | |
static String |
toBigDecimalLiteral(BigDecimal bigDecimal,
GenModel genModel)
Returns a literal expression for the given BigDecimal value. |
static String |
toBigIntegerLiteral(BigInteger bigInteger,
GenModel genModel)
Returns a literal expression for the given BigInteger value. |
static String |
toBooleanLiteral(boolean b,
GenModel genModel)
Returns the literal expression for the given boolean value. |
static String |
toByteLiteral(byte b,
GenModel genModel)
Returns the decimal literal expression for the given byte
value. |
static String |
toCharLiteral(char c,
GenModel genModel)
Returns a literal expression for the given char value.
|
static String |
toClassLiteral(Class c,
GenModel genModel)
Returns a literal expression for the given Class value. |
static String |
toDateLiteral(Date date,
GenModel genModel)
Returns a literal expression for the given Date value. |
static String |
toDoubleLiteral(double d,
GenModel genModel)
Returns a literal expression for the given double value.
|
static String |
toFloatLiteral(float f,
GenModel genModel)
Returns a literal expression for the given float value.
|
static String |
toIntLiteral(int i,
GenModel genModel)
Returns the decimal literal expression for the given int
value. |
static String |
toLiteral(Object o)
Convenience dispatch method. |
static String |
toLiteral(Object o,
GenModel genModel)
Convenience dispatch method. |
static String |
toLongLiteral(long l,
GenModel genModel)
Returns the decimal literal expression for the given long
value. |
static String |
toShortLiteral(short s,
GenModel genModel)
Returns the decimal literal expression for the given short
value. |
static String |
toStringLiteral(String s,
GenModel genModel)
Returns a literal expression for the given String . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static String toLiteral(Object o)
Boolean
, Byte
, Short
,
Integer
, Long
, Float
,
Double
, Character
, String
,
BigDecimal
, BigInteger
, Date
,
or Class
, the appropriate conversion method is called,
with the unwrapped primitive, or the typed object as an argument.
Class names are never imported; the qualified name is used.
public static String toLiteral(Object o, GenModel genModel)
Boolean
, Byte
, Short
,
Integer
, Long
, Float
,
Double
, Character
, String
,
BigDecimal
, BigInteger
, Date
,
or Class
, the appropriate conversion method is called,
with the unwrapped primitive, or the typed object as an argument.
The specified GenModel
,
if non-null, is used when necessary to import class names.
public static String toBooleanLiteral(boolean b, GenModel genModel)
boolean
value.
public static String toByteLiteral(byte b, GenModel genModel)
byte
value.
public static String toShortLiteral(short s, GenModel genModel)
short
value.
public static String toIntLiteral(int i, GenModel genModel)
int
value.
public static String toLongLiteral(long l, GenModel genModel)
long
value.
public static String toFloatLiteral(float f, GenModel genModel)
float
value.
This literal may be in simple form or exponential notation, or it may
be one of the special values java.lang.Float.NaN
,
java.lang.Float.POSITIVE_INFINITY
, or
java.lang.Float.NEGATIVE_INFINITY
.
public static String toDoubleLiteral(double d, GenModel genModel)
double
value.
This literal may be in simple form or exponential notation, or it may
be one of the special values java.lang.Double.NaN
,
java.lang.Double.POSITIVE_INFINITY
, or
java.lang.Double.NEGATIVE_INFINITY
.
public static String toCharLiteral(char c, GenModel genModel)
char
value.
This literal will be in its escaped form if it is backspace,
horizontal tab, newline, form feed, carriage return, double quote,
single quote, or backslash. If it is within the common printable
range of space (32) to ~
(126), it will simply be the
character literal. Otherwise, it will be in the escaped Unicode
encoding form.
public static String toStringLiteral(String s, GenModel genModel)
String
. Each
of its characters will appear in the same form as if it was the
argument to toCharLiteral(char, org.eclipse.emf.codegen.ecore.genmodel.GenModel)
.
public static String toBigDecimalLiteral(BigDecimal bigDecimal, GenModel genModel)
BigDecimal
value.
public static String toBigIntegerLiteral(BigInteger bigInteger, GenModel genModel)
BigInteger
value.
public static String toDateLiteral(Date date, GenModel genModel)
Date
value.
public static String toClassLiteral(Class c, GenModel genModel)
Class
value.
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |