|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttudresden.ocl.lib.Ocl
This class constitutes the central interface to generating classes in
the OCL class library. An application should call one of the
getOclRepresentationFor
class methods whenever it wants to use
any object or value with the library. This method than consults the
installed OclFactory to create the correct representative for this object
or value. The getFor
methods are nothing but a shorthand for
getOclRepresentationFor
, which is self-speaking but tedious
to write.
If the OCL class library is to be used in a new context, especially with
a new code generator, a new OclFactory might become necessary. It can be
installed in the Ocl class using the setFactory
method.
Adaptation to name changes by code generators is possible through
NameAdapter
. A standard implementation of this interface is
contained in the library with SimpleNameAdapter
and
ArgoNameAdapter
, but that is not set by default.
Also, an implementation of OclStateAdapter
might become necessary if
the operation oclInState
of OclAny
is to be used.
The implementation must be registered using setStateAdapter
.
In contrast to OclFactory
, there is no standard
implementation for OclStateAdapter
. The same is true for the
interface AllInstancesAdapter
. Implemenentations might access
a CASE platforms repository.
Additionally, the switch STRICT_VALUE_TYPES
can be set in
this class to determine the runtime behaviour of the class library.
OclFactory
,
DefaultOclFactory
,
NameAdapter
,
ArgoNameAdapter
,
SimpleNameAdapter
,
OclStateAdapter
,
AllInstancesAdapter
,
setFactory(OclFactory of)
,
setNameAdapter(NameAdapter na)
,
STRICT_VALUE_TYPES
Field Summary | |
protected static AllInstancesAdapter |
allInstancesAdapter
setting this adapter makes the operation allInstances evaluatable |
protected static OclFactory |
factory
this objects contains factory methods to generate OCL representations for application objects and values |
static boolean |
JAVA_CLASS_NAMES
This class attribute determines wether OclType.name() will return fully-qualified or simple class names (i.e. |
protected static NameAdapter |
nameAdapter
This object transforms diagram names to possible implementation names. |
protected static OclStateAdapter |
stateAdapter
a reference to the object that will be consulted if oclInState is called; by default it is
null |
static boolean |
STRICT_FLATTENING
If this class attribute is set to true , a new OclCollection
is automatically flattened upon creation. |
static boolean |
STRICT_VALUE_TYPES
Some methods can be implemented more runtime efficient if their value type nature is ignored. |
static boolean |
TAKE_VECTORS_AS_SET
Determines, whether attributes of type java.util.Vector are treated as Sequences or Sets. |
static boolean |
TOLERATE_NONEXISTENT_FIELDS
If this attribute is set to true, an access to a non-existent attribute or method is evaluated as an undefined value; otherwise, an exception is thrown. |
Constructor Summary | |
Ocl()
|
Method Summary | |
static OclSet |
getAllInstances(OclType t)
|
static OclBoolean |
getFor(boolean b)
|
static OclRoot |
getFor(byte b)
|
static OclRoot |
getFor(char c)
|
static OclRoot |
getFor(double d)
|
static OclRoot |
getFor(float f)
|
static OclRoot |
getFor(int i)
|
static OclRoot |
getFor(long l)
|
static OclRoot |
getFor(Object o)
|
static OclRoot |
getFor(short s)
|
static String[] |
getNames(String n)
Use the NameAdapter to find possible implementation names. |
static OclBoolean |
getOclRepresentationFor(boolean b)
the representation of boolean is restricted to be OclBoolean |
static OclRoot |
getOclRepresentationFor(byte b)
|
static OclRoot |
getOclRepresentationFor(char c)
|
static OclRoot |
getOclRepresentationFor(double d)
|
static OclRoot |
getOclRepresentationFor(float f)
|
static OclRoot |
getOclRepresentationFor(int i)
|
static OclRoot |
getOclRepresentationFor(long l)
|
static OclRoot |
getOclRepresentationFor(Object o)
|
static OclRoot |
getOclRepresentationFor(short s)
|
static OclRoot |
getOclRepresentationForNull(Class c)
|
static OclSequence |
getOclSequenceFor(Object o)
This method uses the factory to create an OclSequence representation for the given Object. |
static OclState |
getOclStateFor(String s)
|
static String[] |
getPossibleAssociationNames(String n)
Use the NameAdapter to find association names that might have been converted into the given implementation name. |
static OclBoolean |
objectInState(Object o,
OclState state)
|
static Object |
reconvert(Class type,
OclRoot oclObject)
calls the factory to retransform the OCL library representation of an object into the application representation denoted by the parameter type |
static void |
setAllInstancesAdapter(AllInstancesAdapter aia)
|
static void |
setFactory(OclFactory of)
|
static void |
setNameAdapter(NameAdapter na)
makes the methods getName and
getPossibleAssociationNames use the given name adapter
The ocl library will not work until a NameAdapter is provided. |
static void |
setStateAdapter(OclStateAdapter adapter)
|
static OclAddable |
toOclAddable(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclAddable; if casting fails, this method will return an appropriate undefined value. |
static OclAny |
toOclAny(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclAny; if casting fails, this method will return an appropriate undefined value. |
static OclAnyImpl |
toOclAnyImpl(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclAnyImpl; if casting fails, this method will return an appropriate undefined value. |
static OclBag |
toOclBag(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclBag; if casting fails, this method will return an appropriate undefined value. |
static OclBoolean |
toOclBoolean(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclBoolean; if casting fails, this method will return an appropriate undefined value. |
static OclCollection |
toOclCollection(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclCollection; if casting fails, this method will return an appropriate undefined value. |
static OclComparable |
toOclComparable(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclComparable; if casting fails, this method will return an appropriate undefined value. |
static OclInteger |
toOclInteger(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclInteger; if casting fails, this method will return an appropriate undefined value. |
static OclMultiplyable |
toOclMultiplyable(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclMultiplyable; if casting fails, this method will return an appropriate undefined value. |
static OclReal |
toOclReal(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclReal; if casting fails, this method will return an appropriate undefined value. |
static OclSequence |
toOclSequence(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclSequence; if casting fails, this method will return an appropriate undefined value. |
static OclSet |
toOclSet(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclSet; if casting fails, this method will return an appropriate undefined value. |
static OclSizable |
toOclSizable(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclSizable; if casting fails, this method will return an appropriate undefined value. |
static OclString |
toOclString(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclString; if casting fails, this method will return an appropriate undefined value. |
static OclSubtractable |
toOclSubtractable(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclSubtractable; if casting fails, this method will return an appropriate undefined value. |
static OclUnsortedCollection |
toOclUnsortedCollection(OclRoot or)
use this method instead of a Java cast to downcast objects of type OclRoot to OclUnsortedCollection; if casting fails, this method will return an appropriate undefined value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean TOLERATE_NONEXISTENT_FIELDS
true
.
public static boolean STRICT_VALUE_TYPES
including
defined on Collections. Its faster to just add the
new Object to the existing collection and return this than to create a copy of
the collection, add the new object to the copy and then return the copy.STRICT_VALUE_TYPES
. The value of this attribute is copied
in the concerning classes constructor from the class attribute
Ocl.STRICT_VALUE_TYPES
, which is set to true
by default.
public static boolean JAVA_CLASS_NAMES
false
public static boolean STRICT_FLATTENING
true
, a new OclCollection
is automatically flattened upon creation. This means that every element
of the java.util.Collection
given as constructor parameter
is tested for being an OclCollection
object itself and,
if so, is flattened. Flattening means that the original collection is
removed from the new collection and instead all its elements are stored
in the new collection. By default, this is set to false
for performance reasons. The collection constructors are not
called illegally from within the library, so strict flattening is not
necessary usually.
public static boolean TAKE_VECTORS_AS_SET
DefaultOclFactory.getOclRepresentationFor(Object)
,
DefaultReflectionAdapter.getTypeForClass(java.lang.Class)
protected static OclFactory factory
setFactory(OclFactory of)
protected static OclStateAdapter stateAdapter
oclInState
is called; by default it is
null
OclAny.oclInState(OclState stat)
protected static AllInstancesAdapter allInstancesAdapter
OclType.allInstances()
protected static NameAdapter nameAdapter
setNameAdapter(tudresden.ocl.lib.NameAdapter)
Constructor Detail |
public Ocl()
Method Detail |
public static OclRoot getFor(Object o)
public static OclRoot getOclRepresentationFor(Object o)
public static OclRoot getOclRepresentationForNull(Class c)
public static OclBoolean getFor(boolean b)
public static OclBoolean getOclRepresentationFor(boolean b)
boolean
is restricted to be OclBoolean
public static OclRoot getFor(byte b)
public static OclRoot getOclRepresentationFor(byte b)
public static OclRoot getFor(short s)
public static OclRoot getOclRepresentationFor(short s)
public static OclRoot getFor(int i)
public static OclRoot getOclRepresentationFor(int i)
public static OclRoot getFor(long l)
public static OclRoot getOclRepresentationFor(long l)
public static OclRoot getFor(float f)
public static OclRoot getOclRepresentationFor(float f)
public static OclRoot getFor(double d)
public static OclRoot getOclRepresentationFor(double d)
public static OclRoot getFor(char c)
public static OclRoot getOclRepresentationFor(char c)
public static Object reconvert(Class type, OclRoot oclObject)
OclFactory.reconvert(Class c, OclRoot or)
public static OclSequence getOclSequenceFor(Object o)
OclFactory.getOclSequenceFor(Object o)
,
OclAnyImpl.getFeatureAsSequence(String s)
public static void setFactory(OclFactory of)
public static OclState getOclStateFor(String s)
public static void setStateAdapter(OclStateAdapter adapter)
public static OclBoolean objectInState(Object o, OclState state)
public static void setNameAdapter(NameAdapter na)
getName
and
getPossibleAssociationNames
use the given name adapter
The ocl library will not work until a NameAdapter is provided.
getNames(String n)
,
getPossibleAssociationNames(String n)
public static String[] getNames(String n)
setNameAdapter(tudresden.ocl.lib.NameAdapter)
public static String[] getPossibleAssociationNames(String n)
setNameAdapter(tudresden.ocl.lib.NameAdapter)
public static OclSizable toOclSizable(OclRoot or)
public static OclCollection toOclCollection(OclRoot or)
public static OclSubtractable toOclSubtractable(OclRoot or)
public static OclUnsortedCollection toOclUnsortedCollection(OclRoot or)
public static OclSet toOclSet(OclRoot or)
public static OclBag toOclBag(OclRoot or)
public static OclSequence toOclSequence(OclRoot or)
public static OclString toOclString(OclRoot or)
public static OclBoolean toOclBoolean(OclRoot or)
public static OclComparable toOclComparable(OclRoot or)
public static OclAddable toOclAddable(OclRoot or)
public static OclMultiplyable toOclMultiplyable(OclRoot or)
public static OclReal toOclReal(OclRoot or)
public static OclInteger toOclInteger(OclRoot or)
public static OclAny toOclAny(OclRoot or)
public static OclAnyImpl toOclAnyImpl(OclRoot or)
public static void setAllInstancesAdapter(AllInstancesAdapter aia)
public static OclSet getAllInstances(OclType t)
OclException
- no AllInstancesAdapter has been set
|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |