Class ModelReference

java.lang.Object
com.yahoo.config.ModelReference

public class ModelReference extends Object
An immutable reference to a model. This is a file path when read by a client but is set in a config instance either as a path, url or id resolved to an url during deployment.
Author:
bratseth
  • Method Details

    • isResolved

      public boolean isResolved()
      Returns whether this is already resolved.
    • modelId

      public Optional<String> modelId()
      Returns the id specified for this model, oor null if it is resolved.
    • url

      public Optional<UrlReference> url()
      Returns the url specified for this model, or null if it is resolved.
    • path

      public Optional<FileReference> path()
      Returns the path specified for this model, or null if it is resolved.
    • value

      public Path value()
      Returns the path to the file containing this model, or null if this is unresolved.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns this on the format accepted by valueOf
      Overrides:
      toString in class Object
    • valueOf

      public static ModelReference valueOf(String s)
      Creates a model reference which is either a single string with no spaces if resolved, or if unresolved a three-part string on the form modelId url path, where each of the elements is either a value not containing space, or empty represented by "".
    • unresolved

      public static ModelReference unresolved(String modelId)
      Creates an unresolved reference from a model id only.
    • unresolved

      public static ModelReference unresolved(UrlReference url)
      Creates an unresolved reference from an url only.
    • unresolved

      public static ModelReference unresolved(FileReference path)
      Creates an unresolved reference from a path only.
    • unresolved

      public static ModelReference unresolved(Optional<String> modelId, Optional<UrlReference> url, Optional<FileReference> path)
      Creates an unresolved reference.
    • resolved

      public static ModelReference resolved(Path path)
      Creates a resolved reference.