## org.eclipse.ocl.parser
Class ValidationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

    java.lang.Object
      org.eclipse.ocl.parser.ValidationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

All Implemented Interfaces:
  Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>

    public class ValidationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

extends Object
implements Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>

Checks the well-formedness rules for the expressions package

Constructor Summary
`protected` `ValidationVisitor(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)` Initializes me to validate expressions in the specified environment.

Method Summary

`static

`<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

`

`getInstance(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)`
Obtains an instance of the validation visitor that validates against the specified environment, which presumably was used in parsing the OCL in the first place.

`protected C` `getOCLType(Object metaElement)` Obtains the type of a meta-element, ensuring that the result is canonicalized with respect to the current environment (via its type resolver).
`protected Boolean` `validatorError(Object problemObject, String problemMessage, String problemContext)` Pass a problemMessage generated for a problemObject at some validationContext to env.getErrorHandler().
`Boolean` `visitAssociationClassCallExp(AssociationClassCallExp<C,P> ae)` Callback for an AssociationClassCallExp visit.
`Boolean` `visitBooleanLiteralExp(BooleanLiteralExp<C> bl)` Callback for a BooleanLiteralExp visit.
`Boolean` `visitCollectionItem(CollectionItem<C> item)`
`Boolean` `visitCollectionLiteralExp(CollectionLiteralExp<C> cl)` Callback for a CollectionLiteralExp visit.
`Boolean` `visitCollectionRange(CollectionRange<C> range)`
`Boolean` `visitConstraint(CT constraint)` Applies well-formedness rules to constraints.
`Boolean` `visitEnumLiteralExp(EnumLiteralExp<C,EL> el)` Callback for an EnumLiteralExp visit.
`Boolean` `visitExpressionInOCL(ExpressionInOCL<C,PM> expression)`
`Boolean` `visitIfExp(IfExp<C> i)` Callback for an IfExp visit.
`Boolean` `visitIntegerLiteralExp(IntegerLiteralExp<C> il)` Callback for an IntegerLiteralExp visit.
`Boolean` `visitInvalidLiteralExp(InvalidLiteralExp<C> il)`
`Boolean` `visitIterateExp(IterateExp<C,PM> ie)` Callback for an IterateExp visit.
`Boolean` `visitIteratorExp(IteratorExp<C,PM> ie)` Callback for an IteratorExp visit.
`Boolean` `visitLetExp(LetExp<C,PM> l)` Callback for LetExp visit.
`Boolean` `visitMessageExp(MessageExp<C,COA,SSA> m)`
`Boolean` `visitNullLiteralExp(NullLiteralExp<C> il)`
`Boolean` `visitOperationCallExp(OperationCallExp<C,O> oc)` Callback for an OperationCallExp visit.
`Boolean` `visitPropertyCallExp(PropertyCallExp<C,P> pc)` Callback for an PropertyCallExp visit.
`Boolean` `visitRealLiteralExp(RealLiteralExp<C> rl)` Callback for a RealLiteralExp visit.
`Boolean` `visitStateExp(StateExp<C,S> s)`
`Boolean` `visitStringLiteralExp(StringLiteralExp<C> sl)` Callback for a StringLiteralExp visit.
`Boolean` `visitTupleLiteralExp(TupleLiteralExp<C,P> tl)` Callback for a TupleLiteralExp visit.
`Boolean` `visitTupleLiteralPart(TupleLiteralPart<C,P> tp)`
`Boolean` `visitTypeExp(TypeExp<C> t)` Callback for a TypeExp visit.
`Boolean` `visitUnlimitedNaturalLiteralExp(UnlimitedNaturalLiteralExp<C> unl)` Callback for an UnlimitedNaturalLiteralExp visit.
`Boolean` `visitUnspecifiedValueExp(UnspecifiedValueExp<C> uv)` Callback for an UnspecifiedValueExp visit.
`Boolean` `visitVariable(Variable<C,PM> vd)` Callback for a VariableDeclaration visit.
`Boolean` `visitVariableExp(VariableExp<C,PM> v)` Callback for a VariableExp visit.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ValidationVisitor

    protected ValidationVisitor(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)

  Initializes me to validate expressions in the specified environment.

  Parameters:
    `environment` - the environment
  Since:
    1.2

Method Detail

### getInstance

    public static <PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT> getInstance(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)

  Obtains an instance of the validation visitor that validates against the specified environment, which presumably was used in parsing the OCL in the first place.

  Parameters:
    `environment` - an OCL environment (must no be `null`)
  Returns:
    a validation visitor instance for the specified environment

### validatorError

    protected Boolean validatorError(Object problemObject,
                                     String problemMessage,
                                     String problemContext)

  Pass a problemMessage generated for a problemObject at some validationContext to env.getErrorHandler().

  Parameters:
    `problemObject` - The object being validated, may be null if unknown
    `problemMessage` - The problem with problemObject
    `validationContext` - Optional context of the validator, may be null
  Returns:
    TRUE always, since a validation error has been reported.

### visitOperationCallExp

    public Boolean visitOperationCallExp(OperationCallExp<C,O> oc)

  Callback for an OperationCallExp visit. Well-formedness rule: All of the arguments must conform to the parameters of the referred operation. There must be exactly as many arguments as the referred operation has parameters.

  Specified by:
    `visitOperationCallExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `oc` - the operation call expression
  Returns:
    Boolean -- true if validated

### visitEnumLiteralExp

    public Boolean visitEnumLiteralExp(EnumLiteralExp<C,EL> el)

  Callback for an EnumLiteralExp visit. Well-formedness rule: The type of an enum Literal expression is the type of the referred literal.

  Specified by:
    `visitEnumLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `el` - the enumeration literal expresion
  Returns:
    Boolean -- true if validated

### visitVariableExp

    public Boolean visitVariableExp(VariableExp<C,PM> v)

  Callback for a VariableExp visit. Well-formedness rule: The type of a VariableExp is the type of the Variable to which it refers.

  Specified by:
    `visitVariableExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `v` - the variable expression
  Returns:
    Boolean -- true if validated

### visitPropertyCallExp

    public Boolean visitPropertyCallExp(PropertyCallExp<C,P> pc)

  Callback for an PropertyCallExp visit. Well-formedness rule: The type of the PropertyCallExp is the type of the referred EStructuralFeature.

  Specified by:
    `visitPropertyCallExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `pc` - the property call expression
  Returns:
    Boolean -- true if validated

### visitAssociationClassCallExp

    public Boolean visitAssociationClassCallExp(AssociationClassCallExp<C,P> ae)

  Callback for an AssociationClassCallExp visit. Well-formedness rules:
  - the type of the AssociationClassCallExp is the type of the referenced EReference
  - the referenced EReference is an AssociationClassEnd, and its associationClass reference is not null

  Specified by:
    `visitAssociationClassCallExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `ae` - the association end expression
  Returns:
    Boolean -- true if validated

### visitVariable

    public Boolean visitVariable(Variable<C,PM> vd)

  Callback for a VariableDeclaration visit. Well-formedness rule: The type of the initExpression must conform to the type of the declared variable.

  Specified by:
    `visitVariable` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `vd` - -- variable declaration
  Returns:
    Boolean -- true if validated

### visitIfExp

    public Boolean visitIfExp(IfExp<C> i)

  Callback for an IfExp visit. Well-formedness Rule: The type of the condition must be Boolean. The type of the if expression is the common supertype of the then and else

  Specified by:
    `visitIfExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `i` - - if expression
  Returns:
    Boolean -- true if validated

### visitMessageExp

    public Boolean visitMessageExp(MessageExp<C,COA,SSA> m)

  Description copied from interface: `Visitor`

  Specified by:
    `visitMessageExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitUnspecifiedValueExp

    public Boolean visitUnspecifiedValueExp(UnspecifiedValueExp<C> uv)

  Callback for an UnspecifiedValueExp visit.

  Specified by:
    `visitUnspecifiedValueExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `uv` - -- unspecified value expression
  Returns:
    Boolean -- true if validated

### visitTypeExp

    public Boolean visitTypeExp(TypeExp<C> t)

  Callback for a TypeExp visit.

  Specified by:
    `visitTypeExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitIntegerLiteralExp

    public Boolean visitIntegerLiteralExp(IntegerLiteralExp<C> il)

  Callback for an IntegerLiteralExp visit. Well-formedness rule: The type of an integer Literal expression is the type Integer

  Specified by:
    `visitIntegerLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `il` - - integer literal expression
  Returns:
    Boolean -- true if validated

### visitUnlimitedNaturalLiteralExp

    public Boolean visitUnlimitedNaturalLiteralExp(UnlimitedNaturalLiteralExp<C> unl)

  Callback for an UnlimitedNaturalLiteralExp visit. Well-formedness rule: The type of an unlimited natural Literal expression is the type UnlimitedNatural

  Specified by:
    `visitUnlimitedNaturalLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `unl` - - unlimited literal expression
  Returns:
    Boolean -- true if validated

### visitRealLiteralExp

    public Boolean visitRealLiteralExp(RealLiteralExp<C> rl)

  Callback for a RealLiteralExp visit. Well-formedness rule: The type of a real literal expression is the type Real.

  Specified by:
    `visitRealLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `rl` - -- real literal expression
  Returns:
    Boolean -- true if validated

### visitStringLiteralExp

    public Boolean visitStringLiteralExp(StringLiteralExp<C> sl)

  Callback for a StringLiteralExp visit. Well-formedness rule: The type of a string literal expression is the type of the string.

  Specified by:
    `visitStringLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `sl` - -- string literal expression
  Returns:
    Boolean -- true if validated

### visitBooleanLiteralExp

    public Boolean visitBooleanLiteralExp(BooleanLiteralExp<C> bl)

  Callback for a BooleanLiteralExp visit. Well-formedness rule: The type of a Boolean Literal expression is the type of the boolean.

  Specified by:
    `visitBooleanLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `bl` - - boolean literal expression
  Returns:
    Boolean - true if validated

### visitLetExp

    public Boolean visitLetExp(LetExp<C,PM> l)

  Callback for LetExp visit. Well-formedness rule: The type of the Let expression is the type of the in expression.

  Specified by:
    `visitLetExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `l` - -- let expression
  Returns:
    Boolean -- true if validated

### visitIterateExp

    public Boolean visitIterateExp(IterateExp<C,PM> ie)

  Callback for an IterateExp visit. *Well-formedness rule: The type of the iterate is the type of the result variable. The type of the body expression must conform to the declared type of the result variable. *A result variable must have an init expression. *The type of a source expression must be a collection. *The loop variable has no init expression. *The type of the iterator variable must be the type of the elements of the *source collection.

  Specified by:
    `visitIterateExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `ie` - - iterate expression
  Returns:
    Boolean -- true if validated

### visitIteratorExp

    public Boolean visitIteratorExp(IteratorExp<C,PM> ie)

  Callback for an IteratorExp visit. Well-formedness rule: If the iterator is "forall", "isUnique", "any", "one", or "exists", the type of the iterator must be Boolean. The result type of the collect operation on a sequence type is a sequence; the result type of collect on any other type is a bag. The select and reject iterators have the same type as its source. They type of the body of the select, reject, forall, exists must be boolean. The type of a source expression must be a collection. The loop variable has no init expression. The type of the iterator variable must be the type of the elements of the source collection.

  Specified by:
    `visitIteratorExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `ie` - -- iterator expression
  Returns:
    Boolean -- true if validated

### visitCollectionLiteralExp

    public Boolean visitCollectionLiteralExp(CollectionLiteralExp<C> cl)

  Callback for a CollectionLiteralExp visit. Well-formedness rule: The type of a collection literal expression is determined by the collection kind selection, and the common supertype of all elements. The empty collection has a Classifier as element type.

  Specified by:
    `visitCollectionLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `cl` - -- collection literal expression
  Returns:
    Boolean -- true if validated

### visitCollectionItem

    public Boolean visitCollectionItem(CollectionItem<C> item)

  Description copied from interface: `Visitor`

  Specified by:
    `visitCollectionItem` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitCollectionRange

    public Boolean visitCollectionRange(CollectionRange<C> range)

  Description copied from interface: `Visitor`

  Specified by:
    `visitCollectionRange` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitTupleLiteralExp

    public Boolean visitTupleLiteralExp(TupleLiteralExp<C,P> tl)

  Callback for a TupleLiteralExp visit. Well-formedness rule: The type of a tuple literal is a TupleType the specified parts All tuple literal expression parts must have unique names. The type of each attribute in a tuple literal part must match the type of the initialization expression.

  Specified by:
    `visitTupleLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `tl` - tuple literal expression
  Returns:
    Boolean

### visitTupleLiteralPart

    public Boolean visitTupleLiteralPart(TupleLiteralPart<C,P> tp)

  Description copied from interface: `Visitor`

  Specified by:
    `visitTupleLiteralPart` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitStateExp

    public Boolean visitStateExp(StateExp<C,S> s)

  Description copied from interface: `Visitor`

  Specified by:
    `visitStateExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitInvalidLiteralExp

    public Boolean visitInvalidLiteralExp(InvalidLiteralExp<C> il)

  Description copied from interface: `Visitor`

  Specified by:
    `visitInvalidLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitNullLiteralExp

    public Boolean visitNullLiteralExp(NullLiteralExp<C> il)

  Description copied from interface: `Visitor`

  Specified by:
    `visitNullLiteralExp` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitExpressionInOCL

    public Boolean visitExpressionInOCL(ExpressionInOCL<C,PM> expression)

  Description copied from interface: `Visitor`

  Specified by:
    `visitExpressionInOCL` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`

### visitConstraint

    public Boolean visitConstraint(CT constraint)

  Applies well-formedness rules to constraints.

  Specified by:
    `visitConstraint` in interface `Visitor<Boolean,C,O,P,EL,PM,S,COA,SSA,CT>`
  Parameters:
    `constraint` - the constraint to validate

### getOCLType

    protected C getOCLType(Object metaElement)

  Obtains the type of a meta-element, ensuring that the result is canonicalized with respect to the current environment (via its type resolver).

  Parameters:
    `metaElement` - a typed meta-element
  Returns:
    the OCL type corresponding to the element's type
  Since:
    1.2
  See Also:
    `UMLReflection.getOCLType(Object)`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.