Class AndroidVersions.AndroidRelease

java.lang.Object
org.robolectric.versioning.AndroidVersions.AndroidRelease
All Implemented Interfaces:
Comparable<AndroidVersions.AndroidRelease>
Direct Known Subclasses:
AndroidVersions.J, AndroidVersions.JMR1, AndroidVersions.JMR2, AndroidVersions.K, AndroidVersions.L, AndroidVersions.LMR1, AndroidVersions.M, AndroidVersions.N, AndroidVersions.NMR1, AndroidVersions.O, AndroidVersions.OMR1, AndroidVersions.P, AndroidVersions.Q, AndroidVersions.R, AndroidVersions.S, AndroidVersions.Sv2, AndroidVersions.T, AndroidVersions.U, AndroidVersions.V
Enclosing class:
AndroidVersions

public abstract static class AndroidVersions.AndroidRelease extends Object implements Comparable<AndroidVersions.AndroidRelease>
Representation of an android release, one that has occurred, or is expected.
  • Constructor Details

    • AndroidRelease

      public AndroidRelease()
  • Method Details

    • getSdkInt

      public int getSdkInt()
      true if this release has already occurred, false otherwise. If unreleased, the getSdkInt may still be that of the prior release.
    • getShortCode

      public String getShortCode()
      single character short code for the release, multiple characters for minor releases (only minor version numbers increment - usually within the same year).
    • isReleased

      public boolean isReleased()
      true if this release has already occurred, false otherwise. If unreleased, the getSdkInt will guess at the likely sdk number. Your code will need to recompile if this value changes - including most modern build tools; bazle, soong all are full build systems - and as such organizations using them have no concerns.
    • getVersion

      public String getVersion()
      major.minor version number as String.
    • compareTo

      public int compareTo(AndroidVersions.AndroidRelease other)
      Implements comparable.
      Specified by:
      compareTo in interface Comparable<AndroidVersions.AndroidRelease>
      Parameters:
      other - the object to be compared.
      Returns:
      1 if this is greater than other, 0 if equal, -1 if less
      Throws:
      RuntimeException - if other is not an instance of AndroidRelease.
    • toString

      public String toString()
      Overrides:
      toString in class Object