org.eclipse.emf.codegen.ecore.genmodel.impl
Class Literals

java.lang.Object
  extended byorg.eclipse.emf.codegen.ecore.genmodel.impl.Literals

public class Literals
extends Object

Utility class for converting primitive values, strings, and classes to literals that could appear in code.


Method Summary
static String toBigDecimalLiteral(BigDecimal bigDecimal)
          Returns a literal expression for the given BigDecimal.
static String toBigIntegerLiteral(BigInteger bigInteger)
           
static String toBooleanLiteral(boolean b)
          Returns the literal expression for the given boolean value.
static String toByteLiteral(byte b)
          Returns the decimal literal expression for the given byte value.
static String toCharLiteral(char c)
          Returns a literal expression for the given char value.
static String toClassLiteral(Class c)
          Returns a literal expression for the given Class value.
static String toDoubleLiteral(double d)
          Returns a literal expression for the given double value.
static String toFloatLiteral(float f)
          Returns a literal expression for the given float value.
static String toIntLiteral(int i)
          Returns the decimal literal expression for the given int value.
static String toLiteral(Object o)
          Convenience dispatch method.
static String toLongLiteral(long l)
          Returns the decimal literal expression for the given long value.
static String toShortLiteral(short s)
          Returns the decimal literal expression for the given short value.
static String toStringLiteral(String s)
          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

toLiteral

public static String toLiteral(Object o)
Convenience dispatch method. If the argument is an instance of Boolean, Byte, Short, Integer, Long, Float, Double, Character, String, or Class, the appropriate conversion method is called, with the unwrapped primitive, or the String or Class itself, as an argument.


toBooleanLiteral

public static String toBooleanLiteral(boolean b)
Returns the literal expression for the given boolean value.


toByteLiteral

public static String toByteLiteral(byte b)
Returns the decimal literal expression for the given byte value.


toShortLiteral

public static String toShortLiteral(short s)
Returns the decimal literal expression for the given short value.


toIntLiteral

public static String toIntLiteral(int i)
Returns the decimal literal expression for the given int value.


toLongLiteral

public static String toLongLiteral(long l)
Returns the decimal literal expression for the given long value.


toFloatLiteral

public static String toFloatLiteral(float f)
Returns a literal expression for the given 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.


toDoubleLiteral

public static String toDoubleLiteral(double d)
Returns a literal expression for the given 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.


toCharLiteral

public static String toCharLiteral(char c)
Returns a literal expression for the given 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.


toStringLiteral

public static String toStringLiteral(String s)
Returns a literal expression for the given String. Each of its characters will appear in the same form as if it was the argument to toCharLiteral(char).


toBigDecimalLiteral

public static String toBigDecimalLiteral(BigDecimal bigDecimal)
Returns a literal expression for the given BigDecimal.


toBigIntegerLiteral

public static String toBigIntegerLiteral(BigInteger bigInteger)

toClassLiteral

public static String toClassLiteral(Class c)
Returns a literal expression for the given Class value.


Copyright 2001-2004 IBM Corporation and others.
All Rights Reserved.