org.apache.tuscany.sca.implementation.java.introspect.impl
Class HeuristicPojoProcessor

java.lang.Object
  extended by org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor
      extended by org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor
All Implemented Interfaces:
JavaClassVisitor

public class HeuristicPojoProcessor
extends BaseJavaClassVisitor

Heuristically evaluates an un-annotated Java implementation type to determine services, references, and properties according to the algorithm described in the SCA Java Client and Implementation Model Specification

TODO Implement:

When no service interface is annotated, need to calculate a single service comprising all public methods that are not reference or property injection sites. If that service can be exactly mapped to an interface implemented by the class then the service interface will be defined in terms of that interface.


Field Summary
 
Fields inherited from class org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor
assemblyFactory
 
Constructor Summary
HeuristicPojoProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory)
           
 
Method Summary
 boolean areUnique(JavaParameterImpl[] parameters)
           
 Reference createReference(java.lang.String name, java.lang.Class<?> paramType)
           
 Service createService(java.lang.Class<?> interfaze)
           
 boolean injectionAnnotationsPresent(java.lang.annotation.Annotation[][] annots)
           
 void processCallback(java.lang.Class<?> interfaze, Contract contract)
           
<T> void
visitEnd(java.lang.Class<T> clazz, JavaImplementation type)
          The final callback received when all other callbacks during evaluation of the component implementation have been issued
 
Methods inherited from class org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor
visitClass, visitConstructor, visitConstructorParameter, visitField, visitMethod, visitSuperClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeuristicPojoProcessor

public HeuristicPojoProcessor(AssemblyFactory assemblyFactory,
                              JavaInterfaceFactory javaFactory)
Method Detail

visitEnd

public <T> void visitEnd(java.lang.Class<T> clazz,
                         JavaImplementation type)
              throws IntrospectionException
Description copied from interface: JavaClassVisitor
The final callback received when all other callbacks during evaluation of the component implementation have been issued

Specified by:
visitEnd in interface JavaClassVisitor
Overrides:
visitEnd in class BaseJavaClassVisitor
Parameters:
clazz - the component implementation class
type - the incomplete component type associated with the implementation class
Throws:
IntrospectionException - if an error is encountered while processing metadata

areUnique

public boolean areUnique(JavaParameterImpl[] parameters)

createReference

public Reference createReference(java.lang.String name,
                                 java.lang.Class<?> paramType)
                          throws IntrospectionException
Throws:
IntrospectionException

createService

public Service createService(java.lang.Class<?> interfaze)
                      throws InvalidInterfaceException
Throws:
InvalidInterfaceException

processCallback

public void processCallback(java.lang.Class<?> interfaze,
                            Contract contract)
                     throws InvalidServiceType
Throws:
InvalidServiceType

injectionAnnotationsPresent

public boolean injectionAnnotationsPresent(java.lang.annotation.Annotation[][] annots)