org.nakedobjects.metamodel.specloader
Class NakedObjectReflectorAbstract

java.lang.Object
  extended by org.nakedobjects.metamodel.specloader.NakedObjectReflectorAbstract
All Implemented Interfaces:
ApplicationScopedComponent, Component, Injectable, DebugInfo, RuntimeContextAware, NakedObjectReflector, SpecificationLoader
Direct Known Subclasses:
JavaReflector

public abstract class NakedObjectReflectorAbstract
extends java.lang.Object
implements NakedObjectReflector, DebugInfo

Builds the meta-model for Java 5 programming model.

The implementation provides for a degree of pluggability:

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 NakedObjectsContext.


Constructor Summary
NakedObjectReflectorAbstract(NakedObjectConfiguration configuration, ClassSubstitutor classSubstitutor, CollectionTypeRegistry collectionTypeRegistry, SpecificationTraverser specificationTraverser, ProgrammingModelFacets programmingModelFacets, java.util.Set<FacetDecorator> facetDecorators, MetaModelValidator metaModelValidator)
           
 
Method Summary
 NakedObjectSpecification[] allSpecifications()
          Return all the loaded specifications.
protected  NakedObjectSpecification createSpecification(java.lang.Class<?> cls)
          Overridable method for language-specific subclass to create the appropriate type of NakedObjectSpecification.
 void debugData(DebugString str)
          Debug details describing the object being investigated
 java.lang.String debugTitle()
          The title for the debug information
protected  void finalize()
           
 ClassSubstitutor getClassSubstitutor()
          The configured ClassSubstitutor.
 CollectionTypeRegistry getCollectionTypeRegistry()
           
 java.util.Set<FacetDecorator> getFacetDecoratorSet()
           
 FacetProcessor getFacetProcessor()
          Provides access to the registered Facets.
 MetaModelValidator getMetaModelValidator()
           
 NakedObjectConfiguration getNakedObjectConfiguration()
           
 ProgrammingModelFacets getProgrammingModelFacets()
           
 RuntimeContext getRuntimeContext()
          As per setRuntimeContext(RuntimeContext).
 java.util.List<java.lang.Class<?>> getServiceClasses()
           
 SpecificationTraverser getSpecificationTraverser()
           
 void init()
          Initializes and wires up, and primes the cache based on any service classes that may have been injected.
 void injectInto(java.lang.Object candidate)
          Injects self into candidate if required, and instructs its subcomponents to do so also.
 boolean loaded(java.lang.Class<?> cls)
          Whether this class has been loaded.
 boolean loaded(java.lang.String fullyQualifiedClassName)
           
 NakedObjectSpecification loadSpecification(java.lang.Class<?> type)
          API: Return specification.
 NakedObjectSpecification loadSpecification(java.lang.String className)
          API: Return the specification for the specified class of object.
 boolean loadSpecifications(java.util.List<java.lang.Class<?>> typesToLoad)
           
 boolean loadSpecifications(java.util.List<java.lang.Class<?>> typesToLoad, java.lang.Class<?> typeToIgnore)
          Loads the specifications of the specified types except the one specified (to prevent an infinite loop).
 void setRuntimeContext(RuntimeContext runtimeContext)
          Due to RuntimeContextAware.
 void setServiceClasses(java.util.List<java.lang.Class<?>> serviceClasses)
          Specify the classes of the services to pro-actively prime the cache.
 void shutdown()
          Indicates to the component that it will no longer be used and should shut itself down cleanly.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NakedObjectReflectorAbstract

public NakedObjectReflectorAbstract(NakedObjectConfiguration configuration,
                                    ClassSubstitutor classSubstitutor,
                                    CollectionTypeRegistry collectionTypeRegistry,
                                    SpecificationTraverser specificationTraverser,
                                    ProgrammingModelFacets programmingModelFacets,
                                    java.util.Set<FacetDecorator> facetDecorators,
                                    MetaModelValidator metaModelValidator)
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

init

public void init()
Initializes and wires up, and primes the cache based on any service classes that may have been injected.

Specified by:
init in interface ApplicationScopedComponent

shutdown

public void shutdown()
Description copied from interface: ApplicationScopedComponent
Indicates to the component that it will no longer be used and should shut itself down cleanly.

Specified by:
shutdown in interface ApplicationScopedComponent

loadSpecification

public final NakedObjectSpecification loadSpecification(java.lang.String className)
API: Return the specification for the specified class of object.

Specified by:
loadSpecification in interface SpecificationLoader

loadSpecification

public NakedObjectSpecification loadSpecification(java.lang.Class<?> type)
API: Return specification.

Specified by:
loadSpecification in interface SpecificationLoader
See Also:
SpecificationLoader.loadSpecification(String)

loadSpecifications

public boolean loadSpecifications(java.util.List<java.lang.Class<?>> typesToLoad,
                                  java.lang.Class<?> typeToIgnore)
Loads the specifications of the specified types except the one specified (to prevent an infinite loop).


loadSpecifications

public boolean loadSpecifications(java.util.List<java.lang.Class<?>> typesToLoad)

createSpecification

protected NakedObjectSpecification createSpecification(java.lang.Class<?> cls)
Overridable method for language-specific subclass to create the appropriate type of NakedObjectSpecification.


allSpecifications

public NakedObjectSpecification[] allSpecifications()
Return all the loaded specifications.

Specified by:
allSpecifications in interface SpecificationLoader

loaded

public boolean loaded(java.lang.Class<?> cls)
Description copied from interface: SpecificationLoader
Whether this class has been loaded.

Specified by:
loaded in interface SpecificationLoader

loaded

public boolean loaded(java.lang.String fullyQualifiedClassName)
Specified by:
loaded in interface SpecificationLoader
See Also:
SpecificationLoader.loaded(Class).

injectInto

public void injectInto(java.lang.Object candidate)
Injects self into candidate if required, and instructs its subcomponents to do so also.

Specified by:
injectInto in interface Injectable

debugData

public void debugData(DebugString str)
Description copied from interface: DebugInfo
Debug details describing the object being investigated

Specified by:
debugData in interface DebugInfo

debugTitle

public java.lang.String debugTitle()
Description copied from interface: DebugInfo
The title for the debug information

Specified by:
debugTitle in interface DebugInfo

getFacetProcessor

public FacetProcessor getFacetProcessor()
Provides access to the registered Facets.


getRuntimeContext

public RuntimeContext getRuntimeContext()
As per setRuntimeContext(RuntimeContext).

Specified by:
getRuntimeContext in interface NakedObjectReflector

setRuntimeContext

public void setRuntimeContext(RuntimeContext runtimeContext)
Due to RuntimeContextAware.

Specified by:
setRuntimeContext in interface RuntimeContextAware

getServiceClasses

public java.util.List<java.lang.Class<?>> getServiceClasses()

setServiceClasses

public void setServiceClasses(java.util.List<java.lang.Class<?>> serviceClasses)
Description copied from interface: SpecificationLoader
Specify the classes of the services to pro-actively prime the cache.

Specified by:
setServiceClasses in interface SpecificationLoader

getNakedObjectConfiguration

public NakedObjectConfiguration getNakedObjectConfiguration()

getClassSubstitutor

public ClassSubstitutor getClassSubstitutor()
Description copied from interface: NakedObjectReflector
The configured ClassSubstitutor.

Specified by:
getClassSubstitutor in interface NakedObjectReflector

getCollectionTypeRegistry

public CollectionTypeRegistry getCollectionTypeRegistry()

getSpecificationTraverser

public SpecificationTraverser getSpecificationTraverser()
Specified by:
getSpecificationTraverser in interface NakedObjectReflector

getProgrammingModelFacets

public ProgrammingModelFacets getProgrammingModelFacets()
Specified by:
getProgrammingModelFacets in interface NakedObjectReflector

getFacetDecoratorSet

public java.util.Set<FacetDecorator> getFacetDecoratorSet()

getMetaModelValidator

public MetaModelValidator getMetaModelValidator()
Specified by:
getMetaModelValidator in interface NakedObjectReflector


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.