MetaModelService
This service provides a formal API into the framework’s metamodel.
API
interface MetaModelService {
Optional<LogicalType> lookupLogicalTypeByName(String logicalTypeName) (1)
Can<LogicalType> logicalTypeAndAliasesFor(LogicalType logicalType) (2)
Can<LogicalType> logicalTypeAndAliasesFor(String logicalTypeName) (3)
Optional<LogicalType> lookupLogicalTypeByClass(Class<?> domainType) (4)
void rebuild(Class<?> domainType) (5)
DomainModel getDomainModel() (6)
BeanSort sortOf(Class<?> domainType, Mode mode) (7)
BeanSort sortOf(Bookmark bookmark, Mode mode) (8)
CommandDtoProcessor commandDtoProcessorFor(String logicalMemberIdentifier) (9)
MetamodelDto exportMetaModel(Config config) (10)
ObjectGraph exportObjectGraph(BiPredicate<BeanSort, LogicalType> filter) (11)
}
1 | lookupLogicalTypeByName(String)
Provides a lookup by logicalTypeName of a domain class' object type, corresponding to Named#value() or DomainService#aliased() or DomainObject#aliased() . Will return an empty result if there is no such non-abstract class registered. (interfaces and abstract types are never added to the lookup table). |
2 | logicalTypeAndAliasesFor(LogicalType)
Assuming that the LogicalType passed in actually represents a domain type, then returns it along with any aliases defined as per DomainService#aliased() or DomainObject#aliased() . |
3 | logicalTypeAndAliasesFor(String)
Returns the LogicalType of a domain class' object type, corresponding to Named#value() , along with any aliases defined as per DomainService#aliased() or DomainObject#aliased() . |
4 | lookupLogicalTypeByClass(Class)
Provides a lookup by class of a domain class' object type,corresponding to Named#value() or DomainService#aliased() or DomainObject#aliased() . |
5 | rebuild(Class)
Invalidates and rebuilds the internal metadata for the specified domain type. |
6 | getDomainModel()
Returns a list of representations of each of member of each domain class. |
7 | sortOf(Class, Mode)
What sort of object the domain type represents. |
8 | sortOf(Bookmark, Mode)
Override of #sortOf(Class, Mode) , extracting the domain type from the provided Bookmark of a domain object instance. |
9 | commandDtoProcessorFor(String)
Obtains the implementation of CommandDtoProcessor (if any) as per Action#commandDtoProcessor() or Property#commandDtoProcessor() . |
10 | exportMetaModel(Config)
Exports the entire metamodel as a DTO, serializable into XML using JAXB. |
11 | exportObjectGraph(BiPredicate)
Can be used to create object relation diagrams (e.g. Plantuml). |
Members
lookupLogicalTypeByName(String)
Provides a lookup by logicalTypeName of a domain class' object type, corresponding to Named#value() or DomainService#aliased() or DomainObject#aliased() . Will return an empty result if there is no such non-abstract class registered. (interfaces and abstract types are never added to the lookup table).
logicalTypeAndAliasesFor(LogicalType)
Assuming that the LogicalType passed in actually represents a domain type, then returns it along with any aliases defined as per DomainService#aliased() or DomainObject#aliased() .
If there is no such domain type, then an empty Can will be returned.
logicalTypeAndAliasesFor(String)
Returns the LogicalType of a domain class' object type, corresponding to Named#value() , along with any aliases defined as per DomainService#aliased() or DomainObject#aliased() .
If there is no such domain type, then an empty Can will be returned.
lookupLogicalTypeByClass(Class)
Provides a lookup by class of a domain class' object type,corresponding to Named#value() or DomainService#aliased() or DomainObject#aliased() .
getDomainModel()
Returns a list of representations of each of member of each domain class.
Used by MetaModelServiceMenu to return a downloadable CSV.
Note that MetaModelService#exportMetaModel(Config) provides a superset of the functionality provided by this method.
sortOf(Bookmark, Mode)
Override of #sortOf(Class, Mode) , extracting the domain type from the provided Bookmark of a domain object instance.
commandDtoProcessorFor(String)
Obtains the implementation of CommandDtoProcessor (if any) as per Action#commandDtoProcessor() or Property#commandDtoProcessor() .
This is used by framework-provided implementations of org.apache.causeway.applib.services.conmap.ContentMappingService .
exportMetaModel(Config)
Exports the entire metamodel as a DTO, serializable into XML using JAXB.
The Config parameter can be used to restrict/filter the export to some subset of the metamodel; in particular to specific Config#getNamespacePrefixes() namespace prefixes .
Implementation
The framework provides a default implementation of this service, o.a.c.core.metamodel.services.metamodel.MetaModelServiceDefault
.
See also
-
exposes exportMetaModel as an action in the user interface.