Package no.sikt.graphitron.mappings
Class ReflectionHelpers
java.lang.Object
no.sikt.graphitron.mappings.ReflectionHelpers
Helper class that takes care of any reflection operations the code generator might require.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanclassHasMethod(Class<?> reference, String methodName) getJooqRecordClassForNodeIdInputField(GenerationField field, ProcessedSchema schema) Gets the jOOQ record class that a @nodeId field should produce.getJooqRecordClassReturnedFromFieldGetter(Class<?> recordClass, String fieldName) Gets the jOOQ record class for a field in a Java record class.static booleansetterAcceptsOptional(Class<?> recordClass, String setterName) Checks whether a setter method on the given class accepts an Optional parameter.
-
Constructor Details
-
ReflectionHelpers
public ReflectionHelpers()
-
-
Method Details
-
classHasMethod
- Returns:
- Does this jOOQ table contain this method name?
-
getJooqRecordClassReturnedFromFieldGetter
public static Optional<Class<? extends org.jooq.impl.UpdatableRecordImpl<?>>> getJooqRecordClassReturnedFromFieldGetter(Class<?> recordClass, String fieldName) Gets the jOOQ record class for a field in a Java record class.- Parameters:
recordClass- The Java record class to inspectfieldName- The field name to get type for- Returns:
- The jOOQ record class, or null if not a jOOQ record type
-
setterAcceptsOptional
Checks whether a setter method on the given class accepts an Optional parameter.- Parameters:
recordClass- The POJO class to inspectsetterName- The setter method name (e.g., "setRentalDuration")- Returns:
- true if the setter's first parameter is Optional
-
getJooqRecordClassForNodeIdInputField
public static Optional<Class<? extends org.jooq.impl.UpdatableRecordImpl<?>>> getJooqRecordClassForNodeIdInputField(GenerationField field, ProcessedSchema schema) Gets the jOOQ record class that a @nodeId field should produce. Uses reflection on the Java record class to get the target field's type.- Parameters:
field- The @nodeId field- Returns:
- The jOOQ record class, or null if the field is not targeting a jOOQ record field
-