org.eclipse.ocl
Class LookupException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.eclipse.ocl.ParserException
              extended by org.eclipse.ocl.SemanticException
                  extended by org.eclipse.ocl.LookupException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AmbiguousLookupException, InvalidLookupException

public class LookupException
extends SemanticException

Exception indicating a semantic error in looking up a definition, typically resulting from an ambiguity.

Actual instances of this exception are usually more specific, being either AmbiguousLookupExceptions or InvalidLookupExceptions.

Since:
1.2
See Also:
AmbiguousLookupException, InvalidLookupException, Serialized Form

Constructor Summary
LookupException(String msg)
          Initializes me with a user-friendly message describing the nature of the lookup failure.
LookupException(String msg, List<?> matches)
          Initializes me with a user-friendly message describing the nature of the lookup that resulted in these zero or more matches.
LookupException(String msg, Object firstMatch, Object secondMatch, Object... otherMatches)
          Initializes me with a user-friendly message describing the nature of the lookup failure and at least two objects that were ambiguous matches.
 
Method Summary
 List<?> getAmbiguousMatches()
          Obtains the list of ambiguous matches, if the problem was one of ambiguity, in the order in which they were found.
 List<?> getMatches()
          Obtains all matches, in the order in which they were found.
 
Methods inherited from class org.eclipse.ocl.ParserException
getDiagnostic
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LookupException

public LookupException(String msg)
Initializes me with a user-friendly message describing the nature of the lookup failure.

Parameters:
msg - the exception message

LookupException

public LookupException(String msg,
                       List<?> matches)
Initializes me with a user-friendly message describing the nature of the lookup that resulted in these zero or more matches.

Parameters:
msg - the exception message
matches - the objects found by the lookup

LookupException

public LookupException(String msg,
                       Object firstMatch,
                       Object secondMatch,
                       Object... otherMatches)
Initializes me with a user-friendly message describing the nature of the lookup failure and at least two objects that were ambiguous matches.

Parameters:
msg - the exception message
firstMatch - the first object found by the look-up
secondMatch - the second object found by the look-up
otherMatches - any further objects found by the look-up
Method Detail

getMatches

public List<?> getMatches()
Obtains all matches, in the order in which they were found. The number of results (0, 1, or more) depends on the specific kind of look-up problem that I represent.

Returns:
the matches found by the look-up
See Also:
getAmbiguousMatches(), InvalidLookupException.getInvalidMatch()

getAmbiguousMatches

public List<?> getAmbiguousMatches()
Obtains the list of ambiguous matches, if the problem was one of ambiguity, in the order in which they were found.

Returns:
the ambiguous matches, or an empty list if the look-up problem was not a matter of ambiguity
See Also:
InvalidLookupException.getInvalidMatch(), getMatches()

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