Errai 3.0.1-SNAPSHOT

org.jboss.errai.codegen.literal
Class LiteralFactory

java.lang.Object
  extended by org.jboss.errai.codegen.literal.LiteralFactory

public class LiteralFactory
extends Object

The literal factory provides a LiteralValue for the specified object (if possible).

Author:
Mike Brock

Constructor Summary
LiteralFactory()
           
 
Method Summary
static LiteralValue<?> getLiteral(Context context, Object o)
          Returns a literal value (specialization of Statement) representing the given object in the given context.
static LiteralValue<?> getLiteral(Object o)
          Returns a literal value (specialization of Statement) representing the given object in the given context.
static LiteralValue<?> isLiteral(Object o)
          Returns a literal value (specialization of Statement) representing the given object in the given context, or null if the value is not literalizable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteralFactory

public LiteralFactory()
Method Detail

getLiteral

public static LiteralValue<?> getLiteral(Object o)
Returns a literal value (specialization of Statement) representing the given object in the given context.

Parameters:
o - The object to create a literal value for.
Returns:
a LiteralValue for the given object. Never null.
Throws:
NotLiteralizableException - if o cannot be literalized

getLiteral

public static LiteralValue<?> getLiteral(Context context,
                                         Object o)
Returns a literal value (specialization of Statement) representing the given object in the given context.

Parameters:
context - The context the literal value will be code-generated in. Contexts can specify additional literalizable types. See Context.addLiteralizableClass(Class).
o - The object to create a literal value for.
Returns:
a LiteralValue for the given object. Never null.
Throws:
NotLiteralizableException - if o cannot be literalized

isLiteral

public static LiteralValue<?> isLiteral(Object o)
Returns a literal value (specialization of Statement) representing the given object in the given context, or null if the value is not literalizable.

Parameters:
o - The object to create a literal value for.
Returns:
a LiteralValue for the given object, or null if the value cannot be expressed as a literal.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.