Class JavaDelegatingResolveResult<ReferenceType extends EObject,T extends ReferenceType>

java.lang.Object
org.emftext.language.java.resolver.result.JavaDelegatingResolveResult<ReferenceType,T>
Type Parameters:
ReferenceType - the type of the references that can be contained in the wrapped result.
T - the type of the references that can be contained in this result.
All Implemented Interfaces:
IJavaReferenceResolveResult<T>

public class JavaDelegatingResolveResult<ReferenceType extends EObject,T extends ReferenceType> extends Object implements IJavaReferenceResolveResult<T>
An implementation of the ResolveResult interface that delegates all method calls to another ResolveResult. Client may subclass this class to easily create custom ResolveResults.
  • Constructor Details

  • Method Details

    • getErrorMessage

      public String getErrorMessage()
      Description copied from interface: IJavaReferenceResolveResult
      Returns the error message that describes what went wrong while resolving a reference.
      Specified by:
      getErrorMessage in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Returns:
      the error message.
    • getMappings

      public Collection<IJavaReferenceMapping<T>> getMappings()
      Description copied from interface: IJavaReferenceResolveResult
      Returns all mappings that were found while resolving an identifier.
      Specified by:
      getMappings in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Returns:
      the mappings.
    • wasResolved

      public boolean wasResolved()
      Description copied from interface: IJavaReferenceResolveResult
      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).
      Specified by:
      wasResolved in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Returns:
      true if the reference was successfully resolved.
    • wasResolvedMultiple

      public boolean wasResolvedMultiple()
      Description copied from interface: IJavaReferenceResolveResult
      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).
      Specified by:
      wasResolvedMultiple in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Returns:
      true the reference was resolved to more than one target object.
    • wasResolvedUniquely

      public boolean wasResolvedUniquely()
      Description copied from interface: IJavaReferenceResolveResult
      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).
      Specified by:
      wasResolvedUniquely in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Returns:
      true if the reference was resolved to exactly one target object.
    • setErrorMessage

      public void setErrorMessage(String message)
      Description copied from interface: IJavaReferenceResolveResult
      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.
      Specified by:
      setErrorMessage in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Parameters:
      message - the error that prevented resolving the reference.
    • addMapping

      public void addMapping(String identifier, T target)
      Description copied from interface: IJavaReferenceResolveResult
      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.
      Specified by:
      addMapping in interface IJavaReferenceResolveResult<ReferenceType extends EObject>
      Parameters:
      identifier - the given identifier.
      target - the resolved target object for the identifier.