Interface ISource


public interface ISource
A descriptor that identifies where a given constraint was defined.
  • Method Details

    • moduleSource

      @NonNull static ISource moduleSource(@NonNull IModule module)
      Get the descriptor for a ISource.SourceLocation.MODEL source with as associated resource.
      Parameters:
      module - the Metaschema module the constraint was defined in
      Returns:
      the source descriptor
      Since:
      2.0.0
    • externalSource

      @NonNull static ISource externalSource(@NonNull String location)
      Get the descriptor for a ISource.SourceLocation.EXTERNAL source for the provided resource.
      Parameters:
      location - the resource used as the source
      Returns:
      the source descriptor
    • externalSource

      @NonNull static ISource externalSource(@NonNull URI location)
      Get the descriptor for a ISource.SourceLocation.EXTERNAL source for the provided resource.
      Parameters:
      location - the resource used as the source
      Returns:
      the source descriptor
    • externalSource

      @NonNull static ISource externalSource(@NonNull StaticContext staticContext, boolean useCached)
      Get the descriptor for a ISource.SourceLocation.EXTERNAL source with as associated resource.

      The provided static context idenfies the location of this source based on the StaticContext.getBaseUri() method.

      Parameters:
      staticContext - the static Metapath context to use for compiling Metapath expressions in this source
      useCached - if true use a previously cached source, otherwise create a new one
      Returns:
      the source descriptor
    • getSourceType

      @NonNull ISource.SourceLocation getSourceType()
      Get the type of source.
      Returns:
      the type
    • getSource

      @Nullable URI getSource()
      Get the resource where the constraint was defined, if known.
      Returns:
      the resource or null if the resource is not known
    • getLocationHint

      @NonNull String getLocationHint()
      Get a hint about where the source is location.

      This value will typically be a URI or class name.

      Returns:
      the hint
    • getStaticContext

      @NonNull StaticContext getStaticContext()
      Get the static Metapath context to use when compiling Metapath expressions.
      Returns:
      the static Metapath context