@Test public void testFromString() throws Exception { Reference<Propoid> reference = Reference.from("propoid: assertEquals(Foo.class, reference.type); assertEquals(1l, reference.id); }
@SuppressWarnings("unchecked") public static <P extends Propoid> Reference<P> from(String string) { try { Matcher matcher = Pattern.compile("propoid: string); if (matcher.matches()) { Class<P> type = (Class<P>) Class.forName(matcher.group(1) + "." + matcher.group(2)); long id = Long.parseLong(matcher.group(3)); return new Reference<P>(type, id); } } catch (Exception noReference) { } return null; }
Reference { @SuppressWarnings("unchecked") public static <P extends Propoid> Reference<P> from(String string) { try { Matcher matcher = Pattern.compile("propoid: string); if (matcher.matches()) { Class<P> type = (Class<P>) Class.forName(matcher.group(1) + "." + matcher.group(2)); long id = Long.parseLong(matcher.group(3)); return new Reference<P>(type, id); } } catch (Exception noReference) { } return null; } }
Reference { @SuppressWarnings("unchecked") public static <P extends Propoid> Reference<P> from(String string) { try { Matcher matcher = Pattern.compile("propoid: string); if (matcher.matches()) { Class<P> type = (Class<P>) Class.forName(matcher.group(1) + "." + matcher.group(2)); long id = Long.parseLong(matcher.group(3)); return new Reference<P>(type, id); } } catch (Exception noReference) { } return null; } @SuppressWarnings("unchecked")  Reference(P propoid);  Reference(Class<? extends P> type, long id); }
Reference { @SuppressWarnings("unchecked") public static <P extends Propoid> Reference<P> from(String string) { try { Matcher matcher = Pattern.compile("propoid: string); if (matcher.matches()) { Class<P> type = (Class<P>) Class.forName(matcher.group(1) + "." + matcher.group(2)); long id = Long.parseLong(matcher.group(3)); return new Reference<P>(type, id); } } catch (Exception noReference) { } return null; } @SuppressWarnings("unchecked")  Reference(P propoid);  Reference(Class<? extends P> type, long id); @Override boolean equals(Object o); @Override int hashCode(); Uri toUri(); String toString(); @SuppressWarnings("unchecked") static Reference<P> from(String string); static Reference<P> from(Uri uri); static Reference<P> from(Intent intent); Intent to(Intent intent); static Reference<P> from(Bundle arguments); Bundle to(Bundle arguments); }
Reference { @SuppressWarnings("unchecked") public static <P extends Propoid> Reference<P> from(String string) { try { Matcher matcher = Pattern.compile("propoid: string); if (matcher.matches()) { Class<P> type = (Class<P>) Class.forName(matcher.group(1) + "." + matcher.group(2)); long id = Long.parseLong(matcher.group(3)); return new Reference<P>(type, id); } } catch (Exception noReference) { } return null; } @SuppressWarnings("unchecked")  Reference(P propoid);  Reference(Class<? extends P> type, long id); @Override boolean equals(Object o); @Override int hashCode(); Uri toUri(); String toString(); @SuppressWarnings("unchecked") static Reference<P> from(String string); static Reference<P> from(Uri uri); static Reference<P> from(Intent intent); Intent to(Intent intent); static Reference<P> from(Bundle arguments); Bundle to(Bundle arguments); final Class<? extends P> type; final long id; }