@Test public void ofPattern() { Assert.assertEquals(Arrays.asList(Gavtc.of("g:a:v:pom"), Gavtc.of("g:a:v:jar")), Gavtc.ofPattern("g:a:v:[pom,jar]")); Assert.assertEquals(Arrays.asList(Gavtc.of("g:a:v:pom")), Gavtc.ofPattern("g:a:v:[pom]")); Assert.assertEquals(Arrays.asList(Gavtc.of("g:a:v:pom")), Gavtc.ofPattern("g:a:v:pom")); }
public static List<Gavtc> ofPattern(String gavtcPattern) { StringTokenizer st = new StringTokenizer(gavtcPattern, ":"); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gav.class.getName(), gavtcPattern)); } else { final String g = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String a = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String v = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String t = st.nextToken(); final String c = st.hasMoreTokens() ? st.nextToken() : null; List<Gavtc> result = new ArrayList<>(); StringTokenizer typeTokenizer = new StringTokenizer(t, "[,]"); while (typeTokenizer.hasMoreTokens()) { String type = typeTokenizer.nextToken(); result.add(new Gavtc(g, a, v, type, c)); } return Collections.unmodifiableList(result); } } } } }
Gavtc extends Gav { public static List<Gavtc> ofPattern(String gavtcPattern) { StringTokenizer st = new StringTokenizer(gavtcPattern, ":"); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gav.class.getName(), gavtcPattern)); } else { final String g = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String a = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String v = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String t = st.nextToken(); final String c = st.hasMoreTokens() ? st.nextToken() : null; List<Gavtc> result = new ArrayList<>(); StringTokenizer typeTokenizer = new StringTokenizer(t, "[,]"); while (typeTokenizer.hasMoreTokens()) { String type = typeTokenizer.nextToken(); result.add(new Gavtc(g, a, v, type, c)); } return Collections.unmodifiableList(result); } } } } } }
Gavtc extends Gav { public static List<Gavtc> ofPattern(String gavtcPattern) { StringTokenizer st = new StringTokenizer(gavtcPattern, ":"); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gav.class.getName(), gavtcPattern)); } else { final String g = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String a = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String v = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String t = st.nextToken(); final String c = st.hasMoreTokens() ? st.nextToken() : null; List<Gavtc> result = new ArrayList<>(); StringTokenizer typeTokenizer = new StringTokenizer(t, "[,]"); while (typeTokenizer.hasMoreTokens()) { String type = typeTokenizer.nextToken(); result.add(new Gavtc(g, a, v, type, c)); } return Collections.unmodifiableList(result); } } } } } Gavtc(String groupId, String artifactId, String version, String type);  Gavtc(String groupId, String artifactId, String version, String type, String classifier); }
Gavtc extends Gav { public static List<Gavtc> ofPattern(String gavtcPattern) { StringTokenizer st = new StringTokenizer(gavtcPattern, ":"); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gav.class.getName(), gavtcPattern)); } else { final String g = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String a = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String v = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String t = st.nextToken(); final String c = st.hasMoreTokens() ? st.nextToken() : null; List<Gavtc> result = new ArrayList<>(); StringTokenizer typeTokenizer = new StringTokenizer(t, "[,]"); while (typeTokenizer.hasMoreTokens()) { String type = typeTokenizer.nextToken(); result.add(new Gavtc(g, a, v, type, c)); } return Collections.unmodifiableList(result); } } } } } Gavtc(String groupId, String artifactId, String version, String type);  Gavtc(String groupId, String artifactId, String version, String type, String classifier); static Gavtc of(String gavtcString); static List<Gavtc> ofPattern(String gavtcPattern); @Override int compareTo(Gav other); @Override boolean equals(Object obj); String getClassifier(); String getGavtcString(); String getType(); @Override int hashCode(); @Override String toString(); }
Gavtc extends Gav { public static List<Gavtc> ofPattern(String gavtcPattern) { StringTokenizer st = new StringTokenizer(gavtcPattern, ":"); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gav.class.getName(), gavtcPattern)); } else { final String g = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String a = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String v = st.nextToken(); if (!st.hasMoreTokens()) { throw new IllegalStateException( String.format("Cannot parse [%s] to a " + Gavtc.class.getName(), gavtcPattern)); } else { final String t = st.nextToken(); final String c = st.hasMoreTokens() ? st.nextToken() : null; List<Gavtc> result = new ArrayList<>(); StringTokenizer typeTokenizer = new StringTokenizer(t, "[,]"); while (typeTokenizer.hasMoreTokens()) { String type = typeTokenizer.nextToken(); result.add(new Gavtc(g, a, v, type, c)); } return Collections.unmodifiableList(result); } } } } } Gavtc(String groupId, String artifactId, String version, String type);  Gavtc(String groupId, String artifactId, String version, String type, String classifier); static Gavtc of(String gavtcString); static List<Gavtc> ofPattern(String gavtcPattern); @Override int compareTo(Gav other); @Override boolean equals(Object obj); String getClassifier(); String getGavtcString(); String getType(); @Override int hashCode(); @Override String toString();  }