ShapeId implements ToShapeId, Comparable<ShapeId> { public static ShapeId fromRelative(String namespace, String relativeName) { Objects.requireNonNull(namespace, "Shape ID namespace must not be null"); Objects.requireNonNull(relativeName, "Shape ID relative name must not be null"); if (relativeName.contains("#")) { throw new ShapeIdSyntaxException("Relative shape ID must not contain a namespace: " + relativeName); } return from(namespace + "#" + relativeName); } private  ShapeId(String absoluteName, String namespace, String name, String member); private  ShapeId(String namespace, String name, String member); static ShapeId from(String id); static boolean isValidNamespace(CharSequence namespace); static boolean isValidIdentifier(CharSequence identifier); static ShapeId fromParts(String namespace, String name, String member); static ShapeId fromParts(String namespace, String name); static ShapeId fromRelative(String namespace, String relativeName); static ShapeId fromOptionalNamespace(String defaultNamespace, String shapeName); ShapeId withMember(String member); @Override ShapeId toShapeId(); @Override int compareTo(ShapeId other); ShapeId withoutMember(); String getNamespace(); String getName(); Optional<String> getMember(); String asRelativeReference(); ShapeId withNamespace(String namespace); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode();  }
@Test public void fromRelative() { ShapeId id = ShapeId.fromRelative("name.space", "Name$member"); assertEquals("name.space", id.getNamespace()); assertEquals("Name", id.getName()); assertEquals("member", id.getMember().get()); }
@Test public void fromRelativeContainingNamespace() { Assertions.assertThrows(IllegalArgumentException.class, () -> { ShapeId.fromRelative("name.space", "name.space#Name$member"); }); }