Class BasePersistenceGenerator
java.lang.Object
io.helidon.data.codegen.common.BaseGenerator
io.helidon.data.codegen.common.BasePersistenceGenerator
- All Implemented Interfaces:
PersistenceGenerator
public abstract class BasePersistenceGenerator
extends BaseGenerator
implements PersistenceGenerator
Specific persistence provider (e.g. Jakarta Persistence, EclipseLink native, ...) generator base class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface PersistenceGenerator
PersistenceGenerator.BaseQuery, PersistenceGenerator.DynamicQueryParts, PersistenceGenerator.Query, PersistenceGenerator.QueryBuilder, PersistenceGenerator.QueryReturnType, PersistenceGenerator.QuerySettings, PersistenceGenerator.StatementGeneratorModifier and TypeInterfaceDescriptionstatic interfaceBase query generated code.static enumDefines which query parts shall be dynamic.static interfaceQuery generated code without any dynamic parts.static interfaceData query code builder.static enumQuery return type.static interfaceGenerated query settings code snippet.static interfacePersistence code snippets generator. -
Field Summary
Fields inherited from class BaseGenerator
BIG_DECIMAL, BIG_INTEGER, CLASS_WILDCARD, ENTITIES, ENTITY, EXECUTOR, GENERIC_T, GENERIC_WILDCARD, ID, ITERABLE_T, ITERABLE_T_ENTITIES, LIST_T, LIST_T_ENTITIES, NUMBER, OBJECT, T, T_ENTITYModifier 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
ConstructorsModifierConstructorDescriptionprotectedCreates an instance of specific persistence provider generator base class. -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate(CodegenContext codegenContext, RoundContext roundContext, TypeInfo interfaceInfo, RepositoryGenerator repositoryGenerator) Generate persistence provider specific code.protected abstract voidgenerateRepositoryClass(CodegenContext codegenContext, RoundContext roundContext, RepositoryGenerator repositoryGenerator, RepositoryInfo repositoryInfo, TypeName className, ClassModel.Builder classModel) Generate data repository interface implementing class for specific persistence provider.protected abstract Stringprovider()Name of the provider.protected abstract TypeNamerepositoryClassName(TypeName baseName) Data repository interface implementing class name for specific persistence provider.Methods inherited from class BaseGenerator
decreasePadding, identifier, increasePadding, initializedVariable, nullValue, returnStatement, statement, throwException, throwException, valueModifier 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.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PersistenceGenerator
queryBuilder, statementGeneratorModifier and TypeMethodDescriptionqueryBuilder(RepositoryInfo repositoryInfo) Provider specific data query code builder.Provider specific persistence code snippets generator.
-
Constructor Details
-
BasePersistenceGenerator
protected BasePersistenceGenerator()Creates an instance of specific persistence provider generator base class.
-
-
Method Details
-
generate
public void generate(CodegenContext codegenContext, RoundContext roundContext, TypeInfo interfaceInfo, RepositoryGenerator repositoryGenerator) Description copied from interface:PersistenceGeneratorGenerate persistence provider specific code. There is always just one data repository provider bound to single data repository interface and its implementing class.- Specified by:
generatein interfacePersistenceGenerator- Parameters:
codegenContext- code processing and generation contextroundContext- codegen round contextinterfaceInfo- data repository interface inforepositoryGenerator- specific data repository code generator
-
provider
-
repositoryClassName
-
generateRepositoryClass
protected abstract void generateRepositoryClass(CodegenContext codegenContext, RoundContext roundContext, RepositoryGenerator repositoryGenerator, RepositoryInfo repositoryInfo, TypeName className, ClassModel.Builder classModel) Generate data repository interface implementing class for specific persistence provider.- Parameters:
codegenContext- code processing and generation context.roundContext- code processing and generation round contextsrepositoryGenerator- specific data repository code generatorrepositoryInfo- data repository interface infoclassName- implementing class name (from {#linkrepositoryClassName(TypeName)})classModel- target implementing class model builder
-