YumPackageName { public String toName() { StringBuilder builder = new StringBuilder(); epoch.ifPresent(ep -> builder.append(ep).append(':')); builder.append(name); version.ifPresent(ver -> builder.append('-').append(ver)); release.ifPresent(rel -> builder.append('-').append(rel)); architecture.ifPresent(arch -> builder.append('.').append(arch)); return builder.toString(); } private  YumPackageName(Optional<String> epoch,
                           String name,
                           Optional<String> version,
                           Optional<String> release,
                           Optional<String> architecture); static YumPackageName fromString(final String packageSpec); static Optional<YumPackageName> parseString(final String packageSpec); Optional<String> getEpoch(); String getName(); Optional<String> getVersion(); Optional<String> getRelease(); Optional<String> getArchitecture(); String toName(); String toVersionLockName(); boolean isSubsetOf(YumPackageName other); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testBuilder() { YumPackageName yumPackage = new YumPackageName.Builder("docker") .setEpoch("2") .setVersion("1.12.6") .setRelease("71.git3e8e77d.el7.centos.1") .setArchitecture("x86_64") .build(); assertEquals("2:docker-1.12.6-71.git3e8e77d.el7.centos.1.x86_64", yumPackage.toName()); }