Tabnine Logo
Version.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.wlqq.mavenversion.Version
constructor

Best Java code snippets using com.wlqq.mavenversion.Version.<init> (Showing top 12 results out of 315)

origin: ManbangGroup/Phantom

@Test
public void testCreateVersion() throws Exception {
  // org.infinispan:infinispan-directory-provider:9.2.0.Alpha2
  Version version = new Version("9.2.0.Alpha2");
  // junit:junit:4.12
  version = new Version("4.12");
  // org.json:json:20171018
  version = new Version("20171018");
  // io.reactivex.rxjava2:rxjava:2.1.6
  version = new Version("2.1.6");
  // io.reactivex.rxjava2:rxjava:2.1.6-SNAPSHOT
  version = new Version("2.1.6-SNAPSHOT");
}
origin: ManbangGroup/Phantom

  @Override
  public Expression parse(String input) throws ParseException {
    boolean isGte = false;
    String versionText;
    if (input.startsWith(">=")) {
      isGte = true;
      // strip operator
      versionText = input.substring(2);
    } else {
      versionText = input;
    }

    final Version parsedVersion = new Version(versionText);
    if (isGte) {
      return new GreaterOrEqual(parsedVersion);
    } else {
      return new Equal(parsedVersion);
    }
  }
}
origin: ManbangGroup/Phantom

/**
 * Check lib version satisfies lib version requirements
 *
 * @param versions     e.g. <code>{"junit:junit": "4.12", "com.android.support:support-v4": "25.3.1"}</code>
 * @param requirements e.g. <code>{"junit:junit": "4.12", "com.android.support:support-v4": ">=25"}</code>
 * @return verify result
 * @see Result
 */
public static Result satisfies(Map<String, String> versions, Map<String, String> requirements) {
  for (Map.Entry<String, String> entry : requirements.entrySet()) {
    final String lib = entry.getKey();
    final String requirement = entry.getValue();
    final String version = versions.get(lib);
    if (version == null) {
      // lib not exist
      return Result.createFailResult(lib, String.format(Locale.ENGLISH, "required lib [%s] not exist", lib));
    }
    if (!new Version(version).satisfies(requirement)) {
      // lib version requirement not satisfied
      return Result.createFailResult(lib, String.format(Locale.ENGLISH,
              "required lib [%s:%s] not satisfies [%s:%s]", lib, version, lib, requirement));
    }
  }
  return Result.createSuccessResult();
}
origin: ManbangGroup/Phantom

@Test
public void testCompareVersionEquals2() throws Exception {
  {
    Version version1 = new Version("27.0.0");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.equals(version2));
  }
  {
    Version version1 = new Version("27.0");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.equals(version2));
  }
  {
    Version version1 = new Version("27");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.equals(version2));
  }
  {
    Version version1 = new Version("27");
    Version version2 = new Version("27.0");
    Assert.assertTrue(version1.equals(version2));
  }
  {
    Version version1 = new Version("27.0");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.equals(version2));
  }
}
origin: ManbangGroup/Phantom

@Test
public void testCompareVersionEquals() throws Exception {
  {
    Version version1 = new Version("27.0.0");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.compareTo(version2) == 0);
  }
  {
    Version version1 = new Version("27.0");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.compareTo(version2) == 0);
  }
  {
    Version version1 = new Version("27");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.compareTo(version2) == 0);
  }
  {
    Version version1 = new Version("27");
    Version version2 = new Version("27.0");
    Assert.assertTrue(version1.compareTo(version2) == 0);
  }
  {
    Version version1 = new Version("27.0");
    Version version2 = new Version("27.0.0");
    Assert.assertTrue(version1.compareTo(version2) == 0);
  }
}
origin: ManbangGroup/Phantom

@Test
public void testCompareVersionGreater() throws Exception {
    Version version1 = new Version("27.0.0");
    Version version2 = new Version("26.0.0");
    Version version1 = new Version("26.0.1");
    Version version2 = new Version("26.0.0");
    Version version1 = new Version("26.0.1");
    Version version2 = new Version("26.0");
    Version version1 = new Version("26.0.1");
    Version version2 = new Version("26");
    Version version1 = new Version("26.1");
    Version version2 = new Version("26");
    Version version1 = new Version("20171218");
    Version version2 = new Version("20171018");
    Assert.assertTrue(version1.compareTo(version2) > 0);
origin: ManbangGroup/Phantom

@Test
public void testInvalidExpressionSatisfiesShouldReturnFalse() throws Exception {
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("=27.0.0"));
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("==27.0.0"));
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies(">27.0.0"));
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("<27.0.0"));
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("<=27.0.0"));
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("!=27.0.0"));
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("27.0.0-prerelease"));
origin: ManbangGroup/Phantom

@Test
public void testSatisfiesEqual() throws Exception {
  {
    Version version = new Version("27.0.0");
    Assert.assertTrue(version.satisfies("27.0.0"));
  }
  {
    Version version = new Version("27.0.0");
    Assert.assertTrue(version.satisfies("27.0"));
  }
  {
    Version version = new Version("27.0.0");
    Assert.assertTrue(version.satisfies("27"));
  }
  {
    Version version = new Version("27.0.0");
    Assert.assertFalse(version.satisfies("27.0.1"));
  }
  {
    Version version = new Version("27.0.0-SNAPSHOT");
    Assert.assertTrue(version.satisfies("27.0.0-SNAPSHOT"));
    Assert.assertFalse(version.satisfies("27.0.1-SNAPSHOT"));
    Assert.assertFalse(version.satisfies("27.0.0"));
  }
}
origin: ManbangGroup/Phantom

Version version = new Version("27.0.0");
Assert.assertTrue(version.satisfies(">=27.0.0"));
Version version = new Version("27.0.1");
Assert.assertTrue(version.satisfies(">=27.0"));
Version version = new Version("27.1.0");
Assert.assertTrue(version.satisfies(">=27"));
Version version = new Version("27.0.0");
Assert.assertFalse(version.satisfies(">=27.1.0"));
Version version = new Version("27");
Assert.assertTrue(version.satisfies(">=26.9999999.9999999.99999999.99999999999"));
Version version = new Version("20171018");
Assert.assertTrue(version.satisfies(">=20161018"));
Assert.assertFalse(version.satisfies("20161018"));
Version version = new Version("27.0.0");
Assert.assertFalse(version.satisfies("27.0.0-SNAPSHOT"));
Assert.assertTrue(version.satisfies(">=27.0.0-SNAPSHOT"));
Version version = new Version("28.0.0");
Assert.assertFalse(version.satisfies("27.0.0-SNAPSHOT"));
Assert.assertTrue(version.satisfies(">=27.0.0-SNAPSHOT"));
Version version = new Version("28.0.0");
Assert.assertTrue(version.satisfies(">=28.0.0-beta.2"));
origin: com.wlqq.phantom/maven-version

  @Override
  public Expression parse(String input) throws ParseException {
    boolean isGte = false;
    String versionText;
    if (input.startsWith(">=")) {
      isGte = true;
      // strip operator
      versionText = input.substring(2);
    } else {
      versionText = input;
    }

    final Version parsedVersion = new Version(versionText);
    if (isGte) {
      return new GreaterOrEqual(parsedVersion);
    } else {
      return new Equal(parsedVersion);
    }
  }
}
origin: com.wlqq.phantom/maven-version

/**
 * Check lib version satisfies lib version requirements
 *
 * @param versions     e.g. <code>{"junit:junit": "4.12", "com.android.support:support-v4": "25.3.1"}</code>
 * @param requirements e.g. <code>{"junit:junit": "4.12", "com.android.support:support-v4": ">=25"}</code>
 * @return verify result
 * @see Result
 */
public static Result satisfies(Map<String, String> versions, Map<String, String> requirements) {
  for (Map.Entry<String, String> entry : requirements.entrySet()) {
    final String lib = entry.getKey();
    final String requirement = entry.getValue();
    final String version = versions.get(lib);
    if (version == null) {
      // lib not exist
      return Result.createFailResult(lib, String.format(Locale.ENGLISH, "required lib [%s] not exist", lib));
    }
    if (!new Version(version).satisfies(requirement)) {
      // lib version requirement not satisfied
      return Result.createFailResult(lib, String.format(Locale.ENGLISH,
              "required lib [%s:%s] not satisfies [%s:%s]", lib, version, lib, requirement));
    }
  }
  return Result.createSuccessResult();
}
origin: ManbangGroup/Phantom

final String newVersion = parts[2];
final String oldVersion = librariesMap.get(lib);
if (oldVersion != null && new Version(newVersion).lessThan(new Version(oldVersion))) {
com.wlqq.mavenversionVersion<init>

Javadoc

Creates a new instance of Version as a result of parsing the specified version string.

Popular methods of Version

  • compareTo
  • equals
  • satisfies
    Checks if this version satisfies the specified SemVer Expression string. Supported expression: * e
  • parseItem
  • parseVersion
  • lessThan
    Checks if this version is less than the other version.

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now