@Test public void testParse() { Object obj = new Object(); String spec = obj.toString(); OID oid = OID.parse(spec); assertEquals(obj.getClass().getName(), oid.getType()); assertEquals(obj.hashCode(), oid.getHash()); assertEquals(spec, oid.toString()); }
public static OID parse(final String spec) { assert spec != null; String[] items = spec.split("@"); if (items.length != 2) { throw new IllegalArgumentException(); } return new OID(items[0], Integer.parseInt(items[1], 16)); }
OID implements ID { public static OID parse(final String spec) { assert spec != null; String[] items = spec.split("@"); if (items.length != 2) { throw new IllegalArgumentException(); } return new OID(items[0], Integer.parseInt(items[1], 16)); } }
OID implements ID { public static OID parse(final String spec) { assert spec != null; String[] items = spec.split("@"); if (items.length != 2) { throw new IllegalArgumentException(); } return new OID(items[0], Integer.parseInt(items[1], 16)); } private  OID(final String type, final int hash); private  OID(); }
OID implements ID { public static OID parse(final String spec) { assert spec != null; String[] items = spec.split("@"); if (items.length != 2) { throw new IllegalArgumentException(); } return new OID(items[0], Integer.parseInt(items[1], 16)); } private  OID(final String type, final int hash); private  OID(); String getType(); int getHash(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); static OID get(final Object obj); static OID oid(final Object obj); static OID parse(final String spec); static String render(final Object obj); static T find(final Collection<T> items, final String id); static T find(final Collection<T> items, final OID id); }
OID implements ID { public static OID parse(final String spec) { assert spec != null; String[] items = spec.split("@"); if (items.length != 2) { throw new IllegalArgumentException(); } return new OID(items[0], Integer.parseInt(items[1], 16)); } private  OID(final String type, final int hash); private  OID(); String getType(); int getHash(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); static OID get(final Object obj); static OID oid(final Object obj); static OID parse(final String spec); static String render(final Object obj); static T find(final Collection<T> items, final String id); static T find(final Collection<T> items, final OID id); static final OID NULL; }