Package de.ubs.xdm3.wrapper
Class AttributeGeneratorWrapper
java.lang.Object
de.ubs.xdm3.wrapper.GeneratorWrapper<AttributeGeneratorProcessor>
de.ubs.xdm3.wrapper.AttributeGeneratorWrapper
Wrapper class for the AttributeGeneratorProcessor.
This class is responsible for managing the attribute generation process.
It provides methods to generate attributes and calculate match scores.
-
Field Summary
Fields inherited from class de.ubs.xdm3.wrapper.GeneratorWrapper
parameters, processor, processorFactory -
Constructor Summary
ConstructorsConstructorDescriptionAttributeGeneratorWrapper(ProcessorFactory processorFactory, AttributeGeneratorProcessor processor, Map<String, Object> parameters) Constructs a new AttributeGeneratorWrapper with the specified processor factory, processor, and parameters. -
Method Summary
Modifier and TypeMethodDescriptiongenerateAttribute(EntityInstance entityInstance, FieldDefinition fieldDefinition) Generates an attribute for the given entity instance.intgetMatchScore(FieldDefinition attribute, EntityGeneratorDefinition entityGeneratorDefinition, Map<String, Object> parameters) Calculates the match score for the given attribute and entity generator definition.Methods inherited from class de.ubs.xdm3.wrapper.GeneratorWrapper
init
-
Constructor Details
-
AttributeGeneratorWrapper
public AttributeGeneratorWrapper(ProcessorFactory processorFactory, AttributeGeneratorProcessor processor, Map<String, Object> parameters) Constructs a new AttributeGeneratorWrapper with the specified processor factory, processor, and parameters.- Parameters:
processorFactory- the processor factory to useprocessor- the attribute generator processorparameters- the parameters to set in the processor
-
-
Method Details
-
generateAttribute
Generates an attribute for the given entity instance. This method can be overridden by the generator script. The generateAttribute() function is called multiple times to generate a new value and must return this value. For example, it can be used to return a random value from a mapping table set up in the init() function.- Parameters:
entityInstance- the entity instance for which to generate the attributefieldDefinition- the field definition of the attribute to generate- Returns:
- the generated attribute
-
getMatchScore
public int getMatchScore(FieldDefinition attribute, EntityGeneratorDefinition entityGeneratorDefinition, Map<String, Object> parameters) Calculates the match score for the given attribute and entity generator definition. This method is used to determine how well the generated attribute matches the expected value. The higher the score, the better the match. This method can be overridden by the generator script.- Parameters:
attribute- the attribute definitionentityGeneratorDefinition- the entity generator definitionparameters- the parameters to use for calculating the match score- Returns:
- the match score
-