Class ApplicationVersion

  • All Implemented Interfaces:
    java.lang.Comparable<ApplicationVersion>

    public class ApplicationVersion
    extends java.lang.Object
    implements java.lang.Comparable<ApplicationVersion>
    An application package version, identified by a source revision and a build number.
    Author:
    bratseth, mpolden, jonmv
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ApplicationVersion unknown
      Used in cases where application version cannot be determined, such as manual deployments (e.g.
    • Constructor Summary

      Constructors 
      Constructor Description
      ApplicationVersion​(java.util.Optional<SourceRevision> source, java.util.OptionalLong buildNumber, java.util.Optional<java.lang.String> authorEmail, java.util.Optional<com.yahoo.component.Version> compileVersion, java.util.Optional<java.time.Instant> buildTime, java.util.Optional<java.lang.String> sourceUrl, java.util.Optional<java.lang.String> commit)
      Public for serialisation only.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<java.lang.String> authorEmail()
      Returns the email of the author of commit of this version, if known
      java.util.OptionalLong buildNumber()
      Returns the build number that built this version
      java.util.Optional<java.time.Instant> buildTime()
      Returns the time this package was built, if known.
      java.util.Optional<java.lang.String> commit()
      Returns the commit name of this application version.
      int compareTo​(ApplicationVersion o)  
      java.util.Optional<com.yahoo.component.Version> compileVersion()
      Returns the Vespa version this package was compiled against, if known.
      boolean equals​(java.lang.Object o)  
      static ApplicationVersion from​(SourceRevision source, long buildNumber)
      Create an application package version from a completed build, without an author email
      static ApplicationVersion from​(SourceRevision source, long buildNumber, java.lang.String authorEmail)
      Creates an version from a completed build and an author email.
      static ApplicationVersion from​(SourceRevision source, long buildNumber, java.lang.String authorEmail, com.yahoo.component.Version compileVersion, java.time.Instant buildTime)
      Creates an version from a completed build, an author email, and build meta data.
      static ApplicationVersion from​(java.util.Optional<SourceRevision> source, long buildNumber, java.util.Optional<java.lang.String> authorEmail, java.util.Optional<com.yahoo.component.Version> compileVersion, java.util.Optional<java.time.Instant> buildTime, java.util.Optional<java.lang.String> sourceUrl, java.util.Optional<java.lang.String> commit)
      Creates an version from a completed build, an author email, and build meta data.
      int hashCode()  
      java.lang.String id()
      Returns an unique identifier for this version or "unknown" if version is not known
      boolean isUnknown()
      Returns whether this is unknown
      java.util.Optional<SourceRevision> source()
      Returns information about the source of this revision, or empty if the source is not know/defined (which is the case for command-line deployment from developers, but never for deployment jobs)
      java.util.Optional<java.lang.String> sourceUrl()
      Returns the source URL for this application version.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • unknown

        public static final ApplicationVersion unknown
        Used in cases where application version cannot be determined, such as manual deployments (e.g. in dev environment)
    • Constructor Detail

      • ApplicationVersion

        public ApplicationVersion​(java.util.Optional<SourceRevision> source,
                                  java.util.OptionalLong buildNumber,
                                  java.util.Optional<java.lang.String> authorEmail,
                                  java.util.Optional<com.yahoo.component.Version> compileVersion,
                                  java.util.Optional<java.time.Instant> buildTime,
                                  java.util.Optional<java.lang.String> sourceUrl,
                                  java.util.Optional<java.lang.String> commit)
        Public for serialisation only.
    • Method Detail

      • from

        public static ApplicationVersion from​(SourceRevision source,
                                              long buildNumber)
        Create an application package version from a completed build, without an author email
      • from

        public static ApplicationVersion from​(SourceRevision source,
                                              long buildNumber,
                                              java.lang.String authorEmail)
        Creates an version from a completed build and an author email.
      • from

        public static ApplicationVersion from​(SourceRevision source,
                                              long buildNumber,
                                              java.lang.String authorEmail,
                                              com.yahoo.component.Version compileVersion,
                                              java.time.Instant buildTime)
        Creates an version from a completed build, an author email, and build meta data.
      • from

        public static ApplicationVersion from​(java.util.Optional<SourceRevision> source,
                                              long buildNumber,
                                              java.util.Optional<java.lang.String> authorEmail,
                                              java.util.Optional<com.yahoo.component.Version> compileVersion,
                                              java.util.Optional<java.time.Instant> buildTime,
                                              java.util.Optional<java.lang.String> sourceUrl,
                                              java.util.Optional<java.lang.String> commit)
        Creates an version from a completed build, an author email, and build meta data.
      • id

        public java.lang.String id()
        Returns an unique identifier for this version or "unknown" if version is not known
      • source

        public java.util.Optional<SourceRevision> source()
        Returns information about the source of this revision, or empty if the source is not know/defined (which is the case for command-line deployment from developers, but never for deployment jobs)
      • buildNumber

        public java.util.OptionalLong buildNumber()
        Returns the build number that built this version
      • authorEmail

        public java.util.Optional<java.lang.String> authorEmail()
        Returns the email of the author of commit of this version, if known
      • compileVersion

        public java.util.Optional<com.yahoo.component.Version> compileVersion()
        Returns the Vespa version this package was compiled against, if known.
      • buildTime

        public java.util.Optional<java.time.Instant> buildTime()
        Returns the time this package was built, if known.
      • sourceUrl

        public java.util.Optional<java.lang.String> sourceUrl()
        Returns the source URL for this application version.
      • commit

        public java.util.Optional<java.lang.String> commit()
        Returns the commit name of this application version.
      • isUnknown

        public boolean isUnknown()
        Returns whether this is unknown
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object