Package name.moore.kevin.ze.entities
Class entityFactory
java.lang.Object
name.moore.kevin.ze.entities.entityFactory
Creates entity factories which can then in turn create appropriate repository
entities.
Before the factory can be used the entityrepository should be injected. Injection is used since it allows more flexibility in testing.
Typical use:
engineEF e = (engineEF) new entityFactory().make(engine.class);
e.toComponents( enginespec ); //build an engine entity based on spec
- Author:
- Kevin Moore
<dev@kevin.moore.name>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classIdentify which type of factories we want. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.simsilica.es.EntityDataprivate entityFactory.FACTORYprivate static org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMake a new factory able to provide the specified class.trace()Used to testing and diagnostics to display the current entity repository.voidwriteDOTfile(File dotf)Output a .dot format diagram of the games entities and components.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
entityrepository
@Inject private com.simsilica.es.EntityData entityrepository -
factory
-
-
Constructor Details
-
entityFactory
public entityFactory() -
entityFactory
-
-
Method Details
-
make
Make a new factory able to provide the specified class.Example:
engineEF ep = (engineEF) new entityFactory().make(engine.class);If we are unable to make the required processor we throw a RuntimeException since there isn't a reasonable way forward.
- Parameters:
c- required class (without 'Entity' suffix) eg engine.class provides an engineEntity.class- Returns:
- a factory which can create entities.
- Throws:
RuntimeException- if an appropriate processor can't be made.
-
writeDOTfile
Output a .dot format diagram of the games entities and components. This becomes part of the site documentation. Failure to create the file is just reported and execution continues - it isnt a show-stopper.- Parameters:
dotf-
-
trace
Used to testing and diagnostics to display the current entity repository.- Returns:
-