java.lang.Object
io.helidon.data.codegen.common.BaseGenerator
- Direct Known Subclasses:
BasePersistenceGenerator,BaseRepositoryInterfaceGenerator
Base code generator.
Common utilities for both repository interface and persistence provider generators.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final TypeNameBigDecimaltype.protected static final TypeNameBigIntegertype.protected static final TypeNameType of theClass<?>.protected static final StringLocal entities Collection variable.protected static final StringLocal entity variable.protected static final StringLocal executor variable.protected static final StringName of the generic typeT.protected static final StringName of the generic type?.protected static final StringLocal id variable.protected static final TypeNameType of theIterable<T>.protected static final ParameterIterable<T> entitiesmethod parameter.protected static final TypeNameType of theList<T>.protected static final ParameterList<T> entitiesmethod parameter.protected static final TypeNameNumbertype.protected static final TypeNameType of theObject.protected static final TypeNameType of the generic typeT.protected static final ParameterT entitymethod parameter. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate an instance of generator base class. -
Method Summary
Modifier and TypeMethodDescriptionprotected static voiddecreasePadding(Method.Builder builder, int count) Decrease padding.protected static voididentifier(Method.Builder builder, String identifier) Generate identifier.protected static voidincreasePadding(Method.Builder builder, int count) Increase padding.protected static voidinitializedVariable(Method.Builder builder, TypeName type, String name, Consumer<Method.Builder> value) Generate initialized variable.protected static voidnullValue(Method.Builder builder) Generatenullvalue.protected static voidreturnStatement(Method.Builder builder, Consumer<Method.Builder> content) Generate return statement.protected static voidstatement(Method.Builder builder, Consumer<Method.Builder> content) Generate statement.protected static voidthrowException(Method.Builder builder, TypeName type, String message) Generatethrow new <type>(<message>)for an exception.protected static voidthrowException(Method.Builder builder, TypeName type, Consumer<Method.Builder> message) Generatethrow new <type>(<message>)for an exception.protected static voidvalue(Method.Builder builder, String value) Generate value.
-
Field Details
-
GENERIC_T
Name of the generic typeT.- See Also:
-
T
Type of the generic typeT. -
ENTITY
Local entity variable.- See Also:
-
ENTITIES
Local entities Collection variable.- See Also:
-
ITERABLE_T
Type of theIterable<T>. -
OBJECT
Type of theObject. -
ITERABLE_T_ENTITIES
Iterable<T> entitiesmethod parameter. -
LIST_T
Type of theList<T>. -
LIST_T_ENTITIES
List<T> entitiesmethod parameter. -
T_ENTITY
T entitymethod parameter. -
GENERIC_WILDCARD
Name of the generic type?.- See Also:
-
EXECUTOR
Local executor variable.- See Also:
-
ID
Local id variable.- See Also:
-
NUMBER
Numbertype. -
BIG_INTEGER
BigIntegertype. -
BIG_DECIMAL
BigDecimaltype. -
CLASS_WILDCARD
Type of theClass<?>.
-
-
Constructor Details
-
BaseGenerator
protected BaseGenerator()Create an instance of generator base class.
-
-
Method Details
-
statement
Generate statement.- Parameters:
builder- method buildercontent- additional statement content
-
returnStatement
Generate return statement.- Parameters:
builder- method buildercontent- additional statement content
-
identifier
Generate identifier.- Parameters:
builder- method builderidentifier- identifier name
-
value
Generate value.- Parameters:
builder- method buildervalue- identifier name
-
initializedVariable
protected static void initializedVariable(Method.Builder builder, TypeName type, String name, Consumer<Method.Builder> value) Generate initialized variable.- Parameters:
builder- method buildertype- variable typename- variable namevalue- variable value content
-
nullValue
Generatenullvalue.- Parameters:
builder- method builder
-
throwException
Generatethrow new <type>(<message>)for an exception.- Parameters:
builder- method buildertype- exception typemessage- exception message
-
throwException
protected static void throwException(Method.Builder builder, TypeName type, Consumer<Method.Builder> message) Generatethrow new <type>(<message>)for an exception.- Parameters:
builder- method buildertype- exception typemessage- exception message content
-
increasePadding
Increase padding.- Parameters:
builder- method buildercount- number of paddings to add
-
decreasePadding
Decrease padding.- Parameters:
builder- method buildercount- number of paddings to remove
-