Class JavaLiteral<T>
java.lang.Object
io.github.mmm.code.base.item.BaseItem
io.github.mmm.code.base.expression.BaseExpression
io.github.mmm.code.impl.java.expression.constant.JavaConstant<T>
io.github.mmm.code.impl.java.expression.literal.JavaLiteral<T>
- Type Parameters:
T- type ofJavaConstant.getValue().
- All Implemented Interfaces:
io.github.mmm.code.api.expression.CodeConstant,io.github.mmm.code.api.expression.CodeExpression,io.github.mmm.code.api.expression.CodeLiteral,io.github.mmm.code.api.item.CodeItem,JavaExpression
- Direct Known Subclasses:
JavaLiteralBoolean,JavaLiteralByte,JavaLiteralChar,JavaLiteralClass,JavaLiteralDouble,JavaLiteralFloat,JavaLiteralInt,JavaLiteralLong,JavaLiteralNull,JavaLiteralShort,JavaLiteralString
public abstract class JavaLiteral<T>
extends JavaConstant<T>
implements io.github.mmm.code.api.expression.CodeLiteral
Implementation of
CodeLiteral for Java.- Since:
- 1.0.0
- Author:
- hohwille
-
Field Summary
Fields inherited from interface io.github.mmm.code.api.item.CodeItem
DEFAULT_INDENT, DEFAULT_NEWLINE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluate()booleanstatic JavaLiteral<?>abstract JavaLiteral<T>Methods inherited from class io.github.mmm.code.impl.java.expression.constant.JavaConstant
doWrite, getJavaClass, getSourceCode, getValue, ofMethods inherited from class io.github.mmm.code.base.item.BaseItem
getOwningType, getSpaces, toString, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.code.api.expression.CodeConstant
getValueMethods inherited from interface io.github.mmm.code.api.item.CodeItem
getLanguage, getSourceCode, write, write, write, write, write
-
Constructor Details
-
JavaLiteral
The constructor.- Parameters:
value- thevalue.
-
-
Method Details
-
evaluate
- Specified by:
evaluatein interfaceio.github.mmm.code.api.expression.CodeConstant- Specified by:
evaluatein interfaceio.github.mmm.code.api.expression.CodeExpression- Specified by:
evaluatein interfaceJavaExpression- Overrides:
evaluatein classJavaConstant<T>
-
isPrimitive
public boolean isPrimitive()- Overrides:
isPrimitivein classJavaConstant<T>- Returns:
trueif thetypeis primitive.
-
withValue
- Specified by:
withValuein classJavaConstant<T>- Parameters:
newValue- the newvalue. May not benull.- Returns:
- the corresponding
JavaConstantof the same type with the given value.
-
of
- Parameters:
value- the literal value.- Returns:
- the
JavaLiteralfor the givenvalue. May benullif the type of the givenvalueis not supported.
-