Entity Type Enhancement - fieldenms/tg GitHub Wiki
Entity Type Enhancement
In TG extensive use is made of dynamic entity type enhancements - generated Java classes that enhance entity types they are based on in various ways.
For example:
- Instrumented entity types - enhanced with interception of property setters, which enables property validators and definers.
- Criteria entity types - enhanced with crit-only properites; core component of entity centres.
Entity type enhancements can be categorised into 2 groups:
- Structural enhancement - the structure of an enhanced type differs from that of its base type. E.g., new properties are added.
- Criteria entity types
- Entity types with custom calculated properties
- Non-structural enhancement - the opposite of structural enhancement.
- Instrumented entity types
- Proxied entity types
Structure of an entity type is defined to consist of the following:
- Entity nature
- Properties
- Type-level annotations that affect entity nature or its properties (e.g.,
@KeyType
determines the type of propertykey
).
This categorisation is especially useful in application to computations that operate on the structure of an entity type and use caching: non-structurally enhanced entity types can be treated as their base types.