@Test public void checksIfValidNamespaceName() { assertFalse(ShapeId.isValidNamespace("foo.bar.")); assertFalse(ShapeId.isValidNamespace(".foo.bar")); assertFalse(ShapeId.isValidNamespace("foo.bar#baz")); assertFalse(ShapeId.isValidNamespace("1foo.bar")); assertFalse(ShapeId.isValidNamespace("foo.1bar")); assertFalse(ShapeId.isValidNamespace("foo.bar.1")); assertFalse(ShapeId.isValidNamespace("foo.bar.*")); assertFalse(ShapeId.isValidNamespace("foo.bar..")); assertFalse(ShapeId.isValidNamespace("")); assertTrue(ShapeId.isValidNamespace("foo")); assertTrue(ShapeId.isValidNamespace("Foo.bar")); assertTrue(ShapeId.isValidNamespace("foo._bar")); assertTrue(ShapeId.isValidNamespace("foo.bar")); assertTrue(ShapeId.isValidNamespace("foo.bar1")); assertTrue(ShapeId.isValidNamespace("_foo.bar")); assertTrue(ShapeId.isValidNamespace("f.b")); assertTrue(ShapeId.isValidNamespace("f.b1.c_d")); assertTrue(ShapeId.isValidNamespace("f.b1.c_d_.e")); assertTrue(ShapeId.isValidNamespace("f.b1.c_d_.e")); assertTrue(ShapeId.isValidNamespace("f.b1.c_d_1234.e")); }
public static boolean isValidNamespace(CharSequence namespace) { if (namespace == null) { return false; } else if (namespace.equals(Prelude.NAMESPACE)) { return true; } int length = namespace.length(); if (length == 0) { return false; } int position = 0; while (true) { position = parseIdentifier(namespace, position); if (position == -1) { return false; } else if (position == length) { return true; } else if (namespace.charAt(position) != '.') { return false; } else if (++position >= length) { return false; } } }
ShapeId implements ToShapeId, Comparable<ShapeId> { public static boolean isValidNamespace(CharSequence namespace) { if (namespace == null) { return false; } else if (namespace.equals(Prelude.NAMESPACE)) { return true; } int length = namespace.length(); if (length == 0) { return false; } int position = 0; while (true) { position = parseIdentifier(namespace, position); if (position == -1) { return false; } else if (position == length) { return true; } else if (namespace.charAt(position) != '.') { return false; } else if (++position >= length) { return false; } } } }
ShapeId implements ToShapeId, Comparable<ShapeId> { public static boolean isValidNamespace(CharSequence namespace) { if (namespace == null) { return false; } else if (namespace.equals(Prelude.NAMESPACE)) { return true; } int length = namespace.length(); if (length == 0) { return false; } int position = 0; while (true) { position = parseIdentifier(namespace, position); if (position == -1) { return false; } else if (position == length) { return true; } else if (namespace.charAt(position) != '.') { return false; } else if (++position >= length) { return false; } } } private  ShapeId(String absoluteName, String namespace, String name, String member); private  ShapeId(String namespace, String name, String member); }
ShapeId implements ToShapeId, Comparable<ShapeId> { public static boolean isValidNamespace(CharSequence namespace) { if (namespace == null) { return false; } else if (namespace.equals(Prelude.NAMESPACE)) { return true; } int length = namespace.length(); if (length == 0) { return false; } int position = 0; while (true) { position = parseIdentifier(namespace, position); if (position == -1) { return false; } else if (position == length) { return true; } else if (namespace.charAt(position) != '.') { return false; } else if (++position >= length) { return false; } } } 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(); }
ShapeId implements ToShapeId, Comparable<ShapeId> { public static boolean isValidNamespace(CharSequence namespace) { if (namespace == null) { return false; } else if (namespace.equals(Prelude.NAMESPACE)) { return true; } int length = namespace.length(); if (length == 0) { return false; } int position = 0; while (true) { position = parseIdentifier(namespace, position); if (position == -1) { return false; } else if (position == length) { return true; } else if (namespace.charAt(position) != '.') { return false; } else if (++position >= length) { return false; } } } 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();  }