org.apache.sis.util.Version.toString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.sis.util.Version.toString()方法的一些代码示例,展示了Version.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.toString()方法的具体详情如下:
包路径:org.apache.sis.util.Version
类名称:Version
方法名:toString

Version.toString介绍

[英]Returns the version string. This is the string specified at construction time.
[中]返回版本字符串。这是构造时指定的字符串。

代码示例

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Build a new exception report.
 *
 * @param version The version of the web service in which the error occured.
 * @param details The reasons for the failure.
 */
public ServiceExceptionReport(final Version version, final ServiceExceptionType... details) {
  for (final ServiceExceptionType element : details) {
    serviceExceptions.add(element);
  }
  this.version = (version != null) ? version.toString() : null;
}

代码示例来源:origin: apache/sis

/**
 * Verify the given output of an {@code about} command.
 */
private static void verify(final String result) {
  String expected = Version.SIS.toString();
  assertTrue(expected, result.contains(expected));
  expected = System.getProperty("java.version");
  assertTrue(expected, result.contains(expected));
  expected = System.getProperty("os.name");
  assertTrue(expected, result.contains(expected));
  expected = System.getProperty("user.home");
  assertTrue(expected, result.contains(expected));
}

代码示例来源:origin: apache/sis

/**
 * Tests the sub-command with the {@code --brief} option.
 *
 * @throws Exception should never happen.
 */
@Test
public void testBrief() throws Exception {
  final AboutCommand test = new AboutCommand(0, CommandRunner.TEST, "--brief");
  test.run();
  final String result = getSingleton(CharSequences.splitOnEOL(test.outputBuffer.toString().trim())).toString();
  assertTrue(result, result.contains(Version.SIS.toString()));
}

代码示例来源:origin: apache/sis

/**
 * Returns a more complete description of the GPX format.
 * The format will be part of the metadata returned by {@link #getMetadata()}.
 *
 * @see StoreProvider#getFormat()
 * @see org.apache.sis.internal.storage.gpx.Metadata#getResourceFormats()
 */
final Format getFormat() {
  assert Thread.holdsLock(this);
  Format format = ((StoreProvider) provider).getFormat(listeners);
  if (version != null) {
    final DefaultFormat df = new DefaultFormat(format);
    final DefaultCitation citation = new DefaultCitation(df.getFormatSpecificationCitation());
    citation.setEdition(new SimpleInternationalString(version.toString()));
    df.setFormatSpecificationCitation(citation);
    format = df;
  }
  return format;
}

代码示例来源:origin: apache/sis

writer.writeStartElement(Tags.GPX);
writer.writeDefaultNamespace(namespace);
writer.writeAttribute(Attributes.VERSION, ver.toString());
if (metadata != null) {
  final String creator = metadata.creator;

代码示例来源:origin: apache/sis

/**
 * Tests the cached values of {@link Version#valueOf(int[])}.
 */
@Test
@DependsOnMethod("testValueOf")
public void testCachedValueOf() {
  for (int major=1; major<=2; major++) {
    final Version version = Version.valueOf(major);
    assertSame(version.toString(), version, Version.valueOf(major));
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link Version#valueOf(int[])} method.
 */
@Test
public void testValueOf() {
  Version version = Version.valueOf(1);
  assertEquals("1", version.toString());
  assertEquals( 1,  version.getMajor());
  assertNull  (     version.getMinor());
  assertNull  (     version.getRevision());
  version = Version.valueOf(10);
  assertEquals("10", version.toString());
  assertEquals( 10,  version.getMajor());
  assertNull  (      version.getMinor());
  assertNull  (      version.getRevision());
  version = Version.valueOf(0, 4);
  assertEquals("0.4", version.toString());
  assertEquals( 0,    version.getMajor());
  assertEquals(   4,  version.getMinor());
  assertNull  (       version.getRevision());
  version = Version.valueOf(6, 11, 2);
  assertEquals("6.11.2", version.toString());
  assertEquals( 6,       version.getMajor());
  assertEquals(   11,    version.getMinor());
  assertEquals(      2,  version.getRevision());
}

代码示例来源:origin: apache/sis

/**
 * Tests a alpha-numeric version.
 */
@Test
@DependsOnMethod("testNumeric")
public void testAlphaNumeric() {
  final Version version = new Version("1.6.b2");
  assertEquals("1.6.b2", version.toString());
  assertEquals( 1, version.getMajor());
  assertEquals( 6, version.getMinor());
  assertEquals("b2", version.getRevision());
  assertSame(version.getRevision(), version.getComponent(2));
  assertNull(version.getComponent(3));
  assertTrue(version.compareTo(new Version("1.6.b2")) == 0);
  assertTrue(version.compareTo(new Version("1.6.b1"))  > 0);
  assertTrue(version.compareTo(new Version("1.07.b1")) < 0);
}

代码示例来源:origin: apache/sis

/**
 * Tests a numeric-only version.
 */
@Test
public void testNumeric() {
  final Version version = new Version("6.11.2");
  assertEquals("6.11.2", version.toString());
  assertEquals( 6, version.getMajor());
  assertEquals(11, version.getMinor());
  assertEquals( 2, version.getRevision());
  assertSame(version.getRevision(), version.getComponent(2));
  assertNull(version.getComponent(3));
  assertTrue(version.compareTo(new Version("6.11.2")) == 0);
  assertTrue(version.compareTo(new Version("6.8"   )) >  0);
  assertTrue(version.compareTo(new Version("6.12.0")) <  0);
  assertTrue(version.compareTo(new Version("6.11"  )) >  0);
}

相关文章