Package spoon.reflect.code
Interface CtLiteral<T>
- Type Parameters:
T- type of literal's value
- All Superinterfaces:
Cloneable,CtCodeElement,CtElement,CtExpression<T>,CtQueryable,CtTypedElement<T>,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder,TemplateParameter<T>
- All Known Subinterfaces:
CtTextBlock
- All Known Implementing Classes:
CtLiteralImpl,CtTextBlockImpl
This code element defines a literal value (an int, a string, etc).
int x = 4; // 4 is a literal
A null literal, as in s = null", is represented by a CtLiteral whose value is null.-
Method Summary
Modifier and TypeMethodDescriptionclone()Overriding return type, a clone of a CtLiteral returns a CtLiteralgetBase()Gets the base of the numeric literal (2, 8, 10 or 16).getValue()Gets the actual value of the literal (statically known).setBase(LiteralBase base)Sets the base of the numeric literal.Sets the actual value of the literal.Methods inherited from interface spoon.reflect.code.CtCodeElement
partiallyEvaluateMethods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelowMethods inherited from interface spoon.reflect.code.CtExpression
addTypeCast, getTypeCasts, setTypeCastsMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.declaration.CtTypedElement
getType, setTypeMethods inherited from interface spoon.reflect.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactoryMethods inherited from interface spoon.template.TemplateParameter
S
-
Method Details
-
getValue
T getValue()Gets the actual value of the literal (statically known). -
setValue
Sets the actual value of the literal. -
getBase
LiteralBase getBase()Gets the base of the numeric literal (2, 8, 10 or 16). -
setBase
Sets the base of the numeric literal. -
clone
Overriding return type, a clone of a CtLiteral returns a CtLiteral- Specified by:
clonein interfaceCtCodeElement- Specified by:
clonein interfaceCtElement- Specified by:
clonein interfaceCtExpression<T>
-