Package ch.tocco.nice2.model.entity.api
Interface NiceModelReceiver
public interface NiceModelReceiver
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntity
(EntityModel model) Callback for the XML reader.Get the validator for the model.@Nullable EntityModel
@Nullable Type
<?> Get the type.void
Method called when the receiver is done, can be used to clean up the receiver.void
removeEntity
(EntityModel toRemove) Type
<?> requireType
(String name) void
withEntityModel
(String name, Function<EntityModel, Void> function) Execute a function with an entity model as argument once the required entity model exists.
-
Method Details
-
addEntity
Callback for the XML reader.WARNING: most properties are not set at this time! Only name and disabled are there, rest comes later. Check the implementation.
- Parameters:
model
- The entity model to add.- Throws:
ModelBuildException
- .
-
getEntity
-
getEntities
Iterable<EntityModel> getEntities() -
removeEntity
-
getConceptionValidator
NiceModelValidator getConceptionValidator()Get the validator for the model.ATTENTION: This validator has to be able to handle a model in a conceptional-state. Maybe some stuff gets changed, removed etc later. Also not all models have been read yet! For example the relations of an entity are not there when the entity model is validated!
- Returns:
- the validator, non-null
-
getType
Get the type.- Parameters:
name
- the name of the type.- Returns:
- the type.
-
requireType
- Throws:
NoSuchTypeException
-
withEntityModel
Execute a function with an entity model as argument once the required entity model exists. This method is generally preferred overgetEntity(java.lang.String)
followed by a null-check to make sure the required entity model exists already.
Note that the function is only executed if the required model will be created at all!- Parameters:
name
- the name of an entity model to be passed as argument into the provided functionfunction
- a function to be executed with the requested entity model
-
onDoneReceiving
void onDoneReceiving()Method called when the receiver is done, can be used to clean up the receiver.
-