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.
    • secretRef

      public Optional<String> secretRef()
      Returns the secret reference 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 NB! Any changes to this format must be reflected in valueOf below and must be backwards compatible
      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 four-part string on the form modelId url secretRef path, where each of the elements is either a value not containing space, or empty represented by "". NB! Any changes to this format must be reflected in toString above and must be backwards compatible
    • 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.
    • unresolved

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

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

      public static ModelReference resolved(Path path, UrlReference url)
      Creates a resolved reference where the original URI path is kept.