Class IdDefinition
This class encapsulates metadata about an ID field in an object, including:
- The name of the ID generator to use
- The field that should receive the generated ID
- The type of the ID field (String, Long, Integer, etc.)
The ID definition is used by the CosId accessor framework to automatically inject generated IDs into objects when they are processed. This enables automatic ID assignment without requiring explicit code in the application.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final IdDefinitionA sentinel value representing a "not found" ID definition.
- 
Constructor SummaryConstructorsConstructorDescriptionIdDefinition(Field idField) Create a new ID definition with the default shared generator.IdDefinition(String generatorName, Field idField) Create a new ID definition with the specified generator name.IdDefinition(String generatorName, Field idField, Class<?> idType) Create a new ID definition with all parameters specified.
- 
Method SummaryModifier and TypeMethodDescriptionGet the name of the ID generator to use for this field.Get the field that should receive the generated ID.Class<?>Get the type of the ID field.
- 
Field Details- 
NOT_FOUNDA sentinel value representing a "not found" ID definition.This is used when no valid ID field can be found in an object, allowing the framework to handle missing ID fields gracefully without null checks. 
 
- 
- 
Constructor Details- 
IdDefinitionCreate a new ID definition with the default shared generator.This constructor creates an ID definition that uses the shared ID generator ( IdGeneratorProvider.SHARE) to generate IDs for the specified field.- Parameters:
- idField- The field that should receive the generated ID
 
- 
IdDefinitionCreate a new ID definition with the specified generator name.This constructor creates an ID definition that uses the named ID generator to generate IDs for the specified field. The field's type is inferred from the field itself. - Parameters:
- generatorName- The name of the ID generator to use
- idField- The field that should receive the generated ID
 
- 
IdDefinitionCreate a new ID definition with all parameters specified.This constructor creates an ID definition with explicit control over all aspects: generator name, target field, and field type. - Parameters:
- generatorName- The name of the ID generator to use
- idField- The field that should receive the generated ID
- idType- The type of the ID field
 
 
- 
- 
Method Details- 
getGeneratorNameGet the name of the ID generator to use for this field.- Returns:
- The name of the ID generator
 
- 
getIdFieldGet the field that should receive the generated ID.- Returns:
- The field that should receive the generated ID
 
- 
getIdTypeGet the type of the ID field.- Returns:
- The type of the ID field
 
 
-