org.eclipse.ocl.examples.codegen.java.types
Class AbstractDescriptor

java.lang.Object
  extended by org.eclipse.ocl.examples.codegen.java.types.AbstractDescriptor
All Implemented Interfaces:
TypeDescriptor
Direct Known Subclasses:
AbstractCollectionDescriptor, AbstractValueDescriptor, FutureEObjectDescriptor, RootObjectDescriptor, SimpleDataTypeDescriptor

public abstract class AbstractDescriptor
extends java.lang.Object
implements TypeDescriptor

An AbstractDescriptor provides the most fundamental capabilities of any type description: the correspondence to a pivot ElementId.


Nested Class Summary
protected static class AbstractDescriptor.NamedFuture
          NamedFuture is a placeholder for classes that have yet to be created.
 
Field Summary
protected  ElementId elementId
           
 
Constructor Summary
AbstractDescriptor(ElementId elementId)
           
 
Method Summary
 java.lang.Boolean appendBox(JavaStream js, JavaLocalContext localContext, CGBoxExp cgBoxExp, CGValuedElement unboxedValue)
           
 void appendCast(JavaStream js, java.lang.Class<?> actualJavaClass, JavaStream.SubStream subStream)
          Append the actualJavaClass subStream to js wrapped in a cast to this type.g.
 void appendCastTerm(JavaStream js, CGValuedElement cgElement)
          Append a cgElement to js wrapped in a cast to this type
 void appendEqualsValue(JavaStream js, CGValuedElement thisValue, CGValuedElement thatValue, boolean notEquals)
          Append an expression term that evaluates whether (this TypedDescriptor and) thisValue is not equals/ notEquals to thatValue.
 void appendNotEqualsTerm(JavaStream js, CGValuedElement thisValue, TypeDescriptor thatTypeDescriptor, java.lang.String thatName)
          Append an expression term that evaluates whether (this TypedDescriptor and) thisValue is not equal to thatTypeDescriptor and thatName.
 java.lang.Boolean appendUnboxStatements(JavaStream js, JavaLocalContext localContext, CGUnboxExp cgUnboxExp, CGValuedElement boxedValue)
           
 CollectionDescriptor asCollectionDescriptor()
          Return a non-null Collection type descriptor if this type descriptor describes a Collection.
 org.eclipse.emf.ecore.EClassifier getEClassifier()
          Return the Ecore EClassifier described by this type.
 ElementId getElementId()
           
 TypeDescriptor getPrimitiveDescriptor()
          Return the type descriptor for use when a primitive type would be appropriate.
 boolean isAssignableTo(java.lang.Class<?> javaClass)
          Return true if an instance described by this typeDescriptor may be assigned to a javaClass.
protected static java.lang.Class<?> reClass(java.lang.Class<?> javaClass)
          Convert an AS javaClass to its underlying Domain interface.
 java.lang.String toString()
           
protected  boolean zzisBoxedType(MetaModelManager metaModelManager, CGValuedElement cgValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.codegen.generator.TypeDescriptor
append, getClassName, getJavaClass, getUnboxedDescriptor, hasJavaClass, isAssignableFrom
 

Field Detail

elementId

@NonNull
protected final ElementId elementId
Constructor Detail

AbstractDescriptor

public AbstractDescriptor(@NonNull
                          ElementId elementId)
Method Detail

reClass

@NonNull
protected static java.lang.Class<?> reClass(@NonNull
                                                    java.lang.Class<?> javaClass)
Convert an AS javaClass to its underlying Domain interface. FIXME Avoid two-level AS interfaces


appendBox

@NonNull
public java.lang.Boolean appendBox(@NonNull
                                           JavaStream js,
                                           @NonNull
                                           JavaLocalContext localContext,
                                           @NonNull
                                           CGBoxExp cgBoxExp,
                                           @NonNull
                                           CGValuedElement unboxedValue)
Specified by:
appendBox in interface TypeDescriptor

appendCast

public void appendCast(@NonNull
                       JavaStream js,
                       @Nullable
                       java.lang.Class<?> actualJavaClass,
                       @Nullable
                       JavaStream.SubStream subStream)
Description copied from interface: TypeDescriptor
Append the actualJavaClass subStream to js wrapped in a cast to this type.g. "(typename)subStream"

Specified by:
appendCast in interface TypeDescriptor

appendCastTerm

public void appendCastTerm(@NonNull
                           JavaStream js,
                           @NonNull
                           CGValuedElement cgElement)
Description copied from interface: TypeDescriptor
Append a cgElement to js wrapped in a cast to this type

Specified by:
appendCastTerm in interface TypeDescriptor

appendNotEqualsTerm

public void appendNotEqualsTerm(@NonNull
                                JavaStream js,
                                @NonNull
                                CGValuedElement thisValue,
                                @NonNull
                                TypeDescriptor thatTypeDescriptor,
                                @NonNull
                                java.lang.String thatName)
Description copied from interface: TypeDescriptor
Append an expression term that evaluates whether (this TypedDescriptor and) thisValue is not equal to thatTypeDescriptor and thatName.

Specified by:
appendNotEqualsTerm in interface TypeDescriptor

appendUnboxStatements

@NonNull
public java.lang.Boolean appendUnboxStatements(@NonNull
                                                       JavaStream js,
                                                       @NonNull
                                                       JavaLocalContext localContext,
                                                       @NonNull
                                                       CGUnboxExp cgUnboxExp,
                                                       @NonNull
                                                       CGValuedElement boxedValue)
Specified by:
appendUnboxStatements in interface TypeDescriptor

zzisBoxedType

protected boolean zzisBoxedType(@NonNull
                                MetaModelManager metaModelManager,
                                @NonNull
                                CGValuedElement cgValue)

appendEqualsValue

public void appendEqualsValue(@NonNull
                              JavaStream js,
                              @NonNull
                              CGValuedElement thisValue,
                              @NonNull
                              CGValuedElement thatValue,
                              boolean notEquals)
Description copied from interface: TypeDescriptor
Append an expression term that evaluates whether (this TypedDescriptor and) thisValue is not equals/ notEquals to thatValue.
It is assumed that all the degenerate constant cases have been optimzed away.

Specified by:
appendEqualsValue in interface TypeDescriptor

asCollectionDescriptor

@Nullable
public CollectionDescriptor asCollectionDescriptor()
Description copied from interface: TypeDescriptor
Return a non-null Collection type descriptor if this type descriptor describes a Collection.

Specified by:
asCollectionDescriptor in interface TypeDescriptor

getEClassifier

@Nullable
public org.eclipse.emf.ecore.EClassifier getEClassifier()
Description copied from interface: TypeDescriptor
Return the Ecore EClassifier described by this type. In the case of collection types, this method returns the EClassifier of the collection elements. May return null when no EClssifier available.

Specified by:
getEClassifier in interface TypeDescriptor

getElementId

@NonNull
public ElementId getElementId()

getPrimitiveDescriptor

@NonNull
public TypeDescriptor getPrimitiveDescriptor()
Description copied from interface: TypeDescriptor
Return the type descriptor for use when a primitive type would be appropriate. Returns this when there is no distinction for primitive types.

Specified by:
getPrimitiveDescriptor in interface TypeDescriptor

isAssignableTo

public boolean isAssignableTo(@NonNull
                              java.lang.Class<?> javaClass)
Description copied from interface: TypeDescriptor
Return true if an instance described by this typeDescriptor may be assigned to a javaClass.

Specified by:
isAssignableTo in interface TypeDescriptor

toString

@NonNull
public java.lang.String toString()
Overrides:
toString in class java.lang.Object