org.oclparser.internal.core.typecheck
Class JdtFacade

java.lang.Object
  extended byorg.oclparser.internal.core.typecheck.JdtFacade
All Implemented Interfaces:
tudresden.ocl.check.types.ModelFacade

public class JdtFacade
extends java.lang.Object
implements tudresden.ocl.check.types.ModelFacade

JdtFacade implements ModelFacadeby extracting the required information from the JDT model and also from compiled Java classes via Java Reflection.

While this approach is very flexible, it has some serious drawbacks. Association ends with a multiplicity greater than one are usually represented in Java classes as some Java collection type, e.g. java.util.Vector. Through static examination of the class it is not possible to find out the element type of the OCL collection type that is the result of navigation along this association in an OCL constraint. Hence the iterator type can not be determined whenever the expression contains a call to one of the iterating methods, and type checking will fail.

For the same reason it is not possible to type-check the properties first and last defined for the OCL type Sequence.

Another problem with getting model information through reflection is that the security manager might deny access to non-public fields.

In addition, the mapping of OCL types to Java types is usually not a homomorphism. For further explanation, see the description of the method navigate(String name, Type[] params).

See Also:
JdtTypeAny.navigateParameterized(String name, Type[] params), IJdtAdapter

Constructor Summary
JdtFacade(org.eclipse.jdt.core.IJavaProject javaProject, java.lang.String[] packageNames, IJdtAdapter reflAdapter, tudresden.ocl.lib.NameAdapter nameAdapter)
           
JdtFacade(org.eclipse.jdt.core.IJavaProject javaProject, java.lang.String[] packageNames, IJdtAdapter reflAdapter, tudresden.ocl.lib.NameAdapter nameAdapter, tudresden.ocl.check.types.ReflectionExtender extender)
           
 
Method Summary
 tudresden.ocl.check.types.Any getClassifier(java.lang.String name)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdtFacade

public JdtFacade(org.eclipse.jdt.core.IJavaProject javaProject,
                 java.lang.String[] packageNames,
                 IJdtAdapter reflAdapter,
                 tudresden.ocl.lib.NameAdapter nameAdapter,
                 tudresden.ocl.check.types.ReflectionExtender extender)
Parameters:
javaProject - the Java project that contains type information.
packageNames - the names of the Java packages that contain the types that will be queried for model information, without trailing dot character ("."); null or the empty string denote the root package (containing all classes not assign to a package through Java's package statement); when a class is searched for the package names are tried in their order in the array
reflAdapter - maps OCL types to Java types and vice versa
nameAdapter - maps OCL names to Java names and vice versa; see explanation in tudresden.ocl.lib.NameAdapter documentation
extender -

JdtFacade

public JdtFacade(org.eclipse.jdt.core.IJavaProject javaProject,
                 java.lang.String[] packageNames,
                 IJdtAdapter reflAdapter,
                 tudresden.ocl.lib.NameAdapter nameAdapter)
Method Detail

getClassifier

public tudresden.ocl.check.types.Any getClassifier(java.lang.String name)
Specified by:
getClassifier in interface tudresden.ocl.check.types.ModelFacade
Returns:
the Any object corresponding to the given type name (class/interface).

toString

public java.lang.String toString()