spoon.reflect.code.CtLiteral Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spoon-core Show documentation
Show all versions of spoon-core Show documentation
Spoon is a tool for meta-programming, analysis and transformation of Java programs.
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
package spoon.reflect.code;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import static spoon.reflect.path.CtRole.LITERAL_BASE;
import static spoon.reflect.path.CtRole.VALUE;
/**
* 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.
*
* @param
* type of literal's value
*/
public interface CtLiteral extends CtExpression {
/**
* Gets the actual value of the literal (statically known).
*/
@PropertyGetter(role = VALUE)
T getValue();
/**
* Sets the actual value of the literal.
*/
@PropertySetter(role = VALUE)
> C setValue(T value);
/**
* Gets the base of the numeric literal (2, 8, 10 or 16).
*/
@PropertyGetter(role = LITERAL_BASE)
LiteralBase getBase();
/**
* Sets the base of the numeric literal.
*/
@PropertySetter(role = LITERAL_BASE)
> C setBase(LiteralBase base);
/** Overriding return type, a clone of a CtLiteral returns a CtLiteral */
@Override
CtLiteral clone();
}