类 ValueCodeGenerator
java.lang.Object
cn.taketoday.aot.generate.ValueCodeGenerator
Code generator for a single value. Delegates code generation to a list of
configurable
ValueCodeGenerator.Delegate implementations.- 从以下版本开始:
- 4.0
- 作者:
- Stephane Nicoll, Harry Yang
-
嵌套类概要
嵌套类修饰符和类型类说明static interfaceStrategy interface that can be used to implement code generation for a particular value type. -
字段概要
字段修饰符和类型字段说明private final List<ValueCodeGenerator.Delegate>private final GeneratedMethodsprivate static final ValueCodeGeneratorprivate static final cn.taketoday.javapoet.CodeBlock -
构造器概要
构造器限定符构造器说明privateValueCodeGenerator(List<ValueCodeGenerator.Delegate> delegates, GeneratedMethods generatedMethods) -
方法概要
修饰符和类型方法说明add(List<ValueCodeGenerator.Delegate> additionalDelegates) cn.taketoday.javapoet.CodeBlockgenerateCode(Object value) Generate the code that represents the specifiedvalue.Return theGeneratedMethodsthat represents the scope in which code generated by this instance will be added, ornullif no specific scope is set.scoped(GeneratedMethods generatedMethods) Return aValueCodeGeneratorthat is scoped for the specifiedGeneratedMethods.static ValueCodeGeneratorwith(ValueCodeGenerator.Delegate... delegates) Create an instance with the specifiedValueCodeGenerator.Delegateimplementations.static ValueCodeGeneratorwith(List<ValueCodeGenerator.Delegate> delegates) Create an instance with the specifiedValueCodeGenerator.Delegateimplementations.static ValueCodeGeneratorReturn an instance that provides support for common value types.
-
字段详细资料
-
INSTANCE
-
NULL_VALUE_CODE_BLOCK
private static final cn.taketoday.javapoet.CodeBlock NULL_VALUE_CODE_BLOCK -
delegates
-
generatedMethods
-
-
构造器详细资料
-
ValueCodeGenerator
private ValueCodeGenerator(List<ValueCodeGenerator.Delegate> delegates, @Nullable GeneratedMethods generatedMethods)
-
-
方法详细资料
-
withDefaults
Return an instance that provides support for common value types.- 返回:
- an instance with support for common value types
-
with
Create an instance with the specifiedValueCodeGenerator.Delegateimplementations.- 参数:
delegates- the delegates to use- 返回:
- an instance with the specified delegates
-
with
Create an instance with the specifiedValueCodeGenerator.Delegateimplementations.- 参数:
delegates- the delegates to use- 返回:
- an instance with the specified delegates
-
add
-
scoped
Return aValueCodeGeneratorthat is scoped for the specifiedGeneratedMethods. This allows code generation to generate additional methods if necessary, or perform some optimization in case of visibility issues.- 参数:
generatedMethods- the generated methods to use- 返回:
- an instance scoped to the specified generated methods
-
generateCode
Generate the code that represents the specifiedvalue.- 参数:
value- the value to generate- 返回:
- the code that represents the specified value
-
getGeneratedMethods
Return theGeneratedMethodsthat represents the scope in which code generated by this instance will be added, ornullif no specific scope is set.- 返回:
- the generated methods to use for code generation
-