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 literalA 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
partiallyEvaluate
Methods 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, updateAllParentsBelow
Methods inherited from interface spoon.reflect.code.CtExpression
addTypeCast, getTypeCasts, setTypeCasts
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.reflect.declaration.CtTypedElement
getType, setType
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
Methods 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:
clone
in interfaceCtCodeElement
- Specified by:
clone
in interfaceCtElement
- Specified by:
clone
in interfaceCtExpression<T>
-