public final class ObjectReflectorDefault extends Object implements SpecificationLoaderSpi, ApplicationScopedComponent, RuntimeContextAware, DebuggableWithTitle
The implementation provides for a degree of pluggability:
ProgrammingModel that
specifies the set of Facet that make up programming model. If not
specified then defaults to ProgrammingModelFacetsJava5 (which should
be used as a starting point for your own customizations).
ClassSubstitutor, which
allows the class to be loaded to be substituted if required. This is used in
conjunction with some PersistenceMechanisms that do class
enhancement.
CollectionTypeRegistry specifies the types that should be
considered as collections. If not specified then will
default. (Note: this extension point
has not been tested, so should be considered more of a "statement of
intent" than actual API. Also, we may use annotations (similar to the
way in which Values are specified) as an alternative mechanism).
In addition, the RuntimeContext can optionally be injected, but will
default to RuntimeContextNoRuntime if not provided prior to
initialization. The purpose of RuntimeContext is to
allow the metamodel to be used standalone, for example in a Maven plugin. The
RuntimeContextNoRuntime implementation will through an exception for
any methods (such as finding an adapter) because there
is no runtime session. In the case of the metamodel being used by the
framework (that is, when there is a runtime), then the framework
injects an implementation of RuntimeContext that acts like a bridge
to its IsisContext.
| Constructor and Description |
|---|
ObjectReflectorDefault(IsisConfiguration configuration,
ClassSubstitutor classSubstitutor,
CollectionTypeRegistry collectionTypeRegistry,
SpecificationTraverser specificationTraverser,
ProgrammingModel programmingModel,
Set<FacetDecorator> facetDecorators,
MetaModelValidator metaModelValidator) |
| Modifier and Type | Method and Description |
|---|---|
Collection<ObjectSpecification> |
allSpecifications()
Return all the loaded specifications.
|
void |
debugData(DebugBuilder debug)
Debug details describing the object being investigated
|
String |
debugTitle()
The title for the debug information
|
protected void |
finalize() |
protected ClassSubstitutor |
getClassSubstitutor() |
protected CollectionTypeRegistry |
getCollectionTypeRegistry() |
protected Set<FacetDecorator> |
getFacetDecoratorSet() |
FacetProcessor |
getFacetProcessor()
Provides access to the registered
Facets. |
protected IsisConfiguration |
getIsisConfiguration() |
protected MetaModelValidator |
getMetaModelValidator() |
protected ProgrammingModel |
getProgrammingModelFacets() |
RuntimeContext |
getRuntimeContext()
|
List<Class<?>> |
getServiceClasses() |
protected SpecificationTraverser |
getSpecificationTraverser() |
void |
init()
Initializes and wires up, and primes the cache based on any service
classes that may have been
injected. |
ValidationFailures |
initAndValidate()
For benefit of IsisMetaModel.
|
void |
injectInto(Object candidate)
Injects self into candidate if required, and instructs its subcomponents
to do so also.
|
ObjectSpecification |
introspectIfRequired(ObjectSpecification spec)
Typically does not need to be called, but is available for
FacetFactorys to force
early introspection of referenced specs in certain circumstances. |
void |
invalidateCache(Class<?> cls) |
void |
invalidateCacheFor(Object domainObject) |
boolean |
isInitialized() |
boolean |
loaded(Class<?> cls)
Whether this class has been loaded.
|
boolean |
loaded(String fullyQualifiedClassName) |
ObjectSpecification |
loadSpecification(Class<?> type)
API: Return specification.
|
ObjectSpecification |
loadSpecification(String className)
API: Return the specification for the specified class of object.
|
boolean |
loadSpecifications(List<Class<?>> typesToLoad)
Loads the specifications of the specified types.
|
boolean |
loadSpecifications(List<Class<?>> typesToLoad,
Class<?> typeToIgnore)
Loads the specifications of the specified types except the one specified
(to prevent an infinite loop).
|
ObjectSpecification |
lookupBySpecId(ObjectSpecId objectSpecId) |
void |
setContainer(org.apache.isis.applib.DomainObjectContainer container)
Specify the
DomainObjectContainer as part of initializing the services. |
void |
setRuntimeContext(RuntimeContext runtimeContext)
Due to
RuntimeContextAware. |
void |
setServices(List<Object> services)
Specify the services to pro-actively prime the cache, and to initialize them also.
|
void |
shutdown()
Indicates to the component that it will no longer be used and should shut
itself down cleanly.
|
void |
validateSpecifications(ValidationFailures validationFailures)
Populated as a result of running
validation after all specs have been loaded. |
public ObjectReflectorDefault(IsisConfiguration configuration, ClassSubstitutor classSubstitutor, CollectionTypeRegistry collectionTypeRegistry, SpecificationTraverser specificationTraverser, ProgrammingModel programmingModel, Set<FacetDecorator> facetDecorators, MetaModelValidator metaModelValidator)
public void init()
injected.init in interface ApplicationScopedComponentpublic boolean isInitialized()
isInitialized in interface SpecificationLoaderSpipublic ValidationFailures initAndValidate()
public void shutdown()
ApplicationScopedComponentshutdown in interface ApplicationScopedComponentpublic void invalidateCacheFor(Object domainObject)
invalidateCacheFor in interface SpecificationLoaderSpipublic void invalidateCache(Class<?> cls)
invalidateCache in interface SpecificationLoaderinvalidateCache in interface SpecificationLoaderSpipublic final ObjectSpecification loadSpecification(String className)
loadSpecification in interface SpecificationLoaderpublic ObjectSpecification loadSpecification(Class<?> type)
loadSpecification in interface SpecificationLoaderSpecificationLoader.loadSpecification(String)public boolean loadSpecifications(List<Class<?>> typesToLoad, Class<?> typeToIgnore)
loadSpecifications in interface SpecificationLoaderpublic boolean loadSpecifications(List<Class<?>> typesToLoad)
loadSpecifications in interface SpecificationLoaderpublic Collection<ObjectSpecification> allSpecifications()
allSpecifications in interface SpecificationLoaderpublic boolean loaded(Class<?> cls)
SpecificationLoaderloaded in interface SpecificationLoaderpublic boolean loaded(String fullyQualifiedClassName)
loaded in interface SpecificationLoaderSpecificationLoader.loaded(Class).public ObjectSpecification introspectIfRequired(ObjectSpecification spec)
SpecificationLoaderFacetFactorys to force
early introspection of referenced specs in certain circumstances.
Originally introduced to support AutoCompleteFacet.
introspectIfRequired in interface SpecificationLoaderpublic ObjectSpecification lookupBySpecId(ObjectSpecId objectSpecId)
lookupBySpecId in interface SpecificationLoaderpublic void injectInto(Object candidate)
injectInto in interface Injectablepublic void debugData(DebugBuilder debug)
DebuggabledebugData in interface Debuggablepublic String debugTitle()
DebuggableWithTitledebugTitle in interface DebuggableWithTitlepublic FacetProcessor getFacetProcessor()
Facets.public RuntimeContext getRuntimeContext()
public void setRuntimeContext(RuntimeContext runtimeContext)
RuntimeContextAware.setRuntimeContext in interface RuntimeContextAwarepublic List<Class<?>> getServiceClasses()
getServiceClasses in interface SpecificationLoaderpublic void setContainer(org.apache.isis.applib.DomainObjectContainer container)
SpecificationLoaderSpiDomainObjectContainer as part of initializing the services.setContainer in interface SpecificationLoaderSpiSpecificationLoaderSpi.setServices(List)public void setServices(List<Object> services)
SpecificationLoaderSpisetServices in interface SpecificationLoaderSpiSpecificationLoaderSpi.setContainer(DomainObjectContainer)protected IsisConfiguration getIsisConfiguration()
protected CollectionTypeRegistry getCollectionTypeRegistry()
protected ClassSubstitutor getClassSubstitutor()
protected SpecificationTraverser getSpecificationTraverser()
protected ProgrammingModel getProgrammingModelFacets()
protected MetaModelValidator getMetaModelValidator()
protected Set<FacetDecorator> getFacetDecoratorSet()
public void validateSpecifications(ValidationFailures validationFailures)
SpecificationLoaderSpivalidation after all specs have been loaded.validateSpecifications in interface SpecificationLoaderSpiCopyright © 2010–2014 The Apache Software Foundation. All rights reserved.