Errai 3.0.1-SNAPSHOT

org.jboss.errai.codegen
Class Variable

java.lang.Object
  extended by org.jboss.errai.codegen.AbstractStatement
      extended by org.jboss.errai.codegen.Variable
All Implemented Interfaces:
Statement

public class Variable
extends AbstractStatement

This class represents a variable.

Note that initialization using LiteralValues takes effect immediately, initialization using Statements needs to be deferred to generation time.

Author:
Christian Sadilek

Method Summary
static Variable create(String name, Class<?> type)
          Creates a variable, but does not assign it to a scope.
static Variable create(String name, Class<?> type, Object initialization)
          Creates a variable, but does not assign it to a scope.
static Variable create(String name, MetaClass type)
          Creates a variable, but does not assign it to a scope.
static Variable create(String name, MetaClass type, Object initialization)
          Creates a variable, but does not assign it to a scope.
static Variable create(String name, Object initialization)
          Creates a variable, but does not assign it to a scope.
static Variable create(String name, javax.enterprise.util.TypeLiteral<?> type)
          Creates a variable, but does not assign it to a scope.
static Variable create(String name, javax.enterprise.util.TypeLiteral<?> type, Object initialization)
          Creates a variable, but does not assign it to a scope.
static Variable createFinal(String name, Class<?> type)
          Creates a variable, but does not assign it to a scope.
static Variable createFinal(String name, Class<?> type, Object initialization)
          Creates a variable, but does not assign it to a scope.
static Variable createFinal(String name, MetaClass type)
          Creates a variable, but does not assign it to a scope.
static Variable createFinal(String name, MetaClass type, Object initialization)
          Creates a variable, but does not assign it to a scope.
static Variable createFinal(String name, javax.enterprise.util.TypeLiteral<?> type)
          Creates a variable, but does not assign it to a scope.
static Variable createFinal(String name, javax.enterprise.util.TypeLiteral<?> type, Object initialization)
          Creates a variable, but does not assign it to a scope.
 boolean equals(Object o)
           
static Variable from(VariableReference ref)
           
 String generate(Context context)
           
static VariableReference get(String name)
           
 String getName()
           
 VariableReference getReference()
           
 MetaClass getType()
           
 Statement getValue()
           
 int hashCode()
           
 void initialize(Object initializationValue)
           
 boolean isFinal()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

initialize

public void initialize(Object initializationValue)

createFinal

public static Variable createFinal(String name,
                                   Class<?> type)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareFinalVariable(String, Class).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

createFinal

public static Variable createFinal(String name,
                                   javax.enterprise.util.TypeLiteral<?> type)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareFinalVariable(String, TypeLiteral).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

createFinal

public static Variable createFinal(String name,
                                   MetaClass type)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt#declareFinalVariable(String, MetaClass).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

createFinal

public static Variable createFinal(String name,
                                   Class<?> type,
                                   Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareFinalVariable(String, Class, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

createFinal

public static Variable createFinal(String name,
                                   MetaClass type,
                                   Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareFinalVariable(String, MetaClass, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

createFinal

public static Variable createFinal(String name,
                                   javax.enterprise.util.TypeLiteral<?> type,
                                   Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareFinalVariable(String, TypeLiteral, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

create

public static Variable create(String name,
                              Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareVariable(String, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

from

public static Variable from(VariableReference ref)

create

public static Variable create(String name,
                              Class<?> type)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareVariable(String, Class).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

create

public static Variable create(String name,
                              javax.enterprise.util.TypeLiteral<?> type)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareVariable(String, TypeLiteral).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

create

public static Variable create(String name,
                              MetaClass type)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt#declareVariable(String, MetaClass).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

create

public static Variable create(String name,
                              Class<?> type,
                              Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareVariable(String, Class, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

create

public static Variable create(String name,
                              javax.enterprise.util.TypeLiteral<?> type,
                              Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareVariable(String, TypeLiteral, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

create

public static Variable create(String name,
                              MetaClass type,
                              Object initialization)
Creates a variable, but does not assign it to a scope. If you are trying to declare a variable, see Stmt.declareVariable(String, MetaClass, Object).

Parameters:
name - The variable name
type - The variable reference type
Returns:
A newly created variable that is not (yet) referencable.

get

public static VariableReference get(String name)

getReference

public VariableReference getReference()

getName

public String getName()

getType

public MetaClass getType()
Specified by:
getType in interface Statement
Overrides:
getType in class AbstractStatement

getValue

public Statement getValue()

isFinal

public boolean isFinal()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

generate

public String generate(Context context)

Errai 3.0.1-SNAPSHOT

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