Interface IJavaReferenceResolveResult<ReferenceType extends EObject>

Type Parameters:
ReferenceType - the type of the references that can be contained in this result.
All Known Implementing Classes:
JavaDelegatingResolveResult, JavaReferenceResolveResult

public interface IJavaReferenceResolveResult<ReferenceType extends EObject>
The result of a single attempt to resolve an identifier. The result can either be successful (identifier was resolved to one or more objects) or failed (identifier was not resolved). In the case of failure, the result provides an error message. This interface must not be implemented by clients.
  • Method Details

    • getErrorMessage

      String getErrorMessage()
      Returns the error message that describes what went wrong while resolving a reference.
      Returns:
      the error message.
    • setErrorMessage

      void setErrorMessage(String message)
      Sets the error message that describes what went wrong while resolving a reference. If a mapping for the reference was already found (i.e., addMapping() was called before), the call to this method is ignored. If addMapping() is called afterwards, the error message is also discarded.
      Parameters:
      message - the error that prevented resolving the reference.
    • addMapping

      void addMapping(String identifier, ReferenceType target)
      Adds a mapping from the given identifier to the given object. Adding such a mapping means that the identifier was resolved to reference the target object. Previous errors as well as future ones will be discarded. Once a mapping is found, resolve errors have no meaning anymore. The target must not be null and implementations of this method can throw an IllegalArgumentException if this rule is violated.
      Parameters:
      identifier - the given identifier.
      target - the resolved target object for the identifier.
    • wasResolved

      boolean wasResolved()
      Indicates the type of the result. Depending on the type of the result, different information is available (e.g., the error message is only set if the resolve operation failed).
      Returns:
      true if the reference was successfully resolved.
    • wasResolvedUniquely

      boolean wasResolvedUniquely()
      Indicates the type of the result. Depending on the type of the result, different information is available (e.g., the unique mapping is only set if the resolve operation returned a unique result).
      Returns:
      true if the reference was resolved to exactly one target object.
    • wasResolvedMultiple

      boolean wasResolvedMultiple()
      Indicates the type of the result. Depending on the type of the result, different information is available (e.g., the multiple mappings are only set if the resolve operation returned multiple result).
      Returns:
      true the reference was resolved to more than one target object.
    • getMappings

      Returns all mappings that were found while resolving an identifier.
      Returns:
      the mappings.