com.mysema.query.types
Class ConstantImpl<T>

java.lang.Object
  extended by com.mysema.query.types.ExpressionBase<T>
      extended by com.mysema.query.types.ConstantImpl<T>
All Implemented Interfaces:
Constant<T>, Expression<T>, Serializable

public class ConstantImpl<T>
extends ExpressionBase<T>
implements Constant<T>

ConstantImpl is the default implementation of the Constant interface

Author:
tiwe
See Also:
Serialized Form

Constructor Summary
ConstantImpl(Class<T> type, T constant)
          Create a new Constant of the given type for the given object
ConstantImpl(T constant)
          Create a new Constant for the given object
 
Method Summary
<R,C> R
accept(Visitor<R,C> v, C context)
          Accept the visitor with the given context
static Constant<Boolean> create(boolean b)
          Get a constant for the given boolean value
static Constant<Byte> create(byte i)
          Get a constant for the given byte value
static Constant<Character> create(char i)
          Get a constant for the given char value
static
<T> Constant<Class<T>>
create(Class<T> constant)
          Create a constant for the given class
static Constant<Integer> create(int i)
          Get a constant for the given int value
static Constant<Long> create(long i)
          Get a constant for the given long value
static Constant<Short> create(short i)
          Create a constant for the given short value
static Constant<String> create(String str)
          Create a constant for the given string
static Constant<String> create(String str, boolean populateCache)
          Create a constant for the given string
 boolean equals(Object o)
           
 T getConstant()
          Get the constant
 
Methods inherited from class com.mysema.query.types.ExpressionBase
getType, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.mysema.query.types.Expression
getType
 

Constructor Detail

ConstantImpl

public ConstantImpl(T constant)
Create a new Constant for the given object

Parameters:
constant -

ConstantImpl

public ConstantImpl(Class<T> type,
                    T constant)
Create a new Constant of the given type for the given object

Parameters:
type -
constant -
Method Detail

create

public static Constant<Boolean> create(boolean b)
Get a constant for the given boolean value

Parameters:
b -
Returns:

create

public static Constant<Byte> create(byte i)
Get a constant for the given byte value

Parameters:
i -
Returns:

create

public static Constant<Character> create(char i)
Get a constant for the given char value

Parameters:
i -
Returns:

create

public static Constant<Integer> create(int i)
Get a constant for the given int value

Parameters:
i -
Returns:

create

public static Constant<Long> create(long i)
Get a constant for the given long value

Parameters:
i -
Returns:

create

public static Constant<Short> create(short i)
Create a constant for the given short value

Parameters:
i -
Returns:

create

public static Constant<String> create(String str)
Create a constant for the given string

Parameters:
str -
Returns:

create

public static Constant<String> create(String str,
                                      boolean populateCache)
Create a constant for the given string

Parameters:
str -
populateCache - whether to add the created constant to the cache
Returns:

create

public static <T> Constant<Class<T>> create(Class<T> constant)
Create a constant for the given class

Parameters:
constant -
Returns:

accept

public <R,C> R accept(Visitor<R,C> v,
                      C context)
Description copied from interface: Expression
Accept the visitor with the given context

Specified by:
accept in interface Expression<T>
Type Parameters:
R - return type
C - context type
Parameters:
v - visitor
context - context of visit
Returns:

equals

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

getConstant

public T getConstant()
Description copied from interface: Constant
Get the constant

Specified by:
getConstant in interface Constant<T>
Returns:


Copyright © 2007-2012 Mysema Ltd. All Rights Reserved.