Package com.yahoo.config
Class ModelReference
java.lang.Object
com.yahoo.config.ModelReference
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 Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
boolean
Returns whether this is already resolved.modelId()
Returns the id specified for this model, oor null if it is resolved.path()
Returns the path specified for this model, or null if it is resolved.static ModelReference
Creates a resolved reference.toString()
Returns this on the format accepted by valueOfstatic ModelReference
unresolved
(FileReference path) Creates an unresolved reference from a path only.static ModelReference
unresolved
(UrlReference url) Creates an unresolved reference from an url only.static ModelReference
unresolved
(String modelId) Creates an unresolved reference from a model id only.static ModelReference
unresolved
(Optional<String> modelId, Optional<UrlReference> url, Optional<FileReference> path) Creates an unresolved reference.url()
Returns the url specified for this model, or null if it is resolved.value()
Returns the path to the file containing this model, or null if this is unresolved.static ModelReference
Creates a model reference which is either a single string with no spaces if resolved, or if unresolved a three-part string on the formmodelId url path
, where each of the elements is either a value not containing space, or empty represented by "".
-
Method Details
-
isResolved
public boolean isResolved()Returns whether this is already resolved. -
modelId
Returns the id specified for this model, oor null if it is resolved. -
url
Returns the url specified for this model, or null if it is resolved. -
path
Returns the path specified for this model, or null if it is resolved. -
value
Returns the path to the file containing this model, or null if this is unresolved. -
equals
-
hashCode
public int hashCode() -
toString
Returns this on the format accepted by valueOf -
valueOf
Creates a model reference which is either a single string with no spaces if resolved, or if unresolved a three-part string on the formmodelId url path
, where each of the elements is either a value not containing space, or empty represented by "". -
unresolved
Creates an unresolved reference from a model id only. -
unresolved
Creates an unresolved reference from an url only. -
unresolved
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
Creates a resolved reference.
-