@Test public void testCoercionInt() { PortRanges.init(); PortRange r = TypeCoercions.coerce(80, PortRange.class); assertContents(r, 80); }
@SuppressWarnings("rawtypes") public static void init() { if (initialized.get()) return; synchronized (initialized) { if (initialized.get()) return; TypeCoercions.registerAdapter(Integer.class, PortRange.class, new Function<Integer,PortRange>() { public PortRange apply(Integer x) { return fromInteger(x); } }); TypeCoercions.registerAdapter(String.class, PortRange.class, new Function<String,PortRange>() { public PortRange apply(String x) { return fromString(x); } }); TypeCoercions.registerAdapter(Iterable.class, PortRange.class, new Function<Iterable,PortRange>() { public PortRange apply(Iterable x) { return fromIterable(x); } }); initialized.set(true); } }
PortRanges { @SuppressWarnings("rawtypes") public static void init() { if (initialized.get()) return; synchronized (initialized) { if (initialized.get()) return; TypeCoercions.registerAdapter(Integer.class, PortRange.class, new Function<Integer,PortRange>() { public PortRange apply(Integer x) { return fromInteger(x); } }); TypeCoercions.registerAdapter(String.class, PortRange.class, new Function<String,PortRange>() { public PortRange apply(String x) { return fromString(x); } }); TypeCoercions.registerAdapter(Iterable.class, PortRange.class, new Function<Iterable,PortRange>() { public PortRange apply(Iterable x) { return fromIterable(x); } }); initialized.set(true); } } }
PortRanges { @SuppressWarnings("rawtypes") public static void init() { if (initialized.get()) return; synchronized (initialized) { if (initialized.get()) return; TypeCoercions.registerAdapter(Integer.class, PortRange.class, new Function<Integer,PortRange>() { public PortRange apply(Integer x) { return fromInteger(x); } }); TypeCoercions.registerAdapter(String.class, PortRange.class, new Function<String,PortRange>() { public PortRange apply(String x) { return fromString(x); } }); TypeCoercions.registerAdapter(Iterable.class, PortRange.class, new Function<Iterable,PortRange>() { public PortRange apply(Iterable x) { return fromIterable(x); } }); initialized.set(true); } }  }
PortRanges { @SuppressWarnings("rawtypes") public static void init() { if (initialized.get()) return; synchronized (initialized) { if (initialized.get()) return; TypeCoercions.registerAdapter(Integer.class, PortRange.class, new Function<Integer,PortRange>() { public PortRange apply(Integer x) { return fromInteger(x); } }); TypeCoercions.registerAdapter(String.class, PortRange.class, new Function<String,PortRange>() { public PortRange apply(String x) { return fromString(x); } }); TypeCoercions.registerAdapter(Iterable.class, PortRange.class, new Function<Iterable,PortRange>() { public PortRange apply(Iterable x) { return fromIterable(x); } }); initialized.set(true); } }  static PortRange fromInteger(int x); static PortRange fromIterable(Iterable<?> c); static PortRange fromString(String s); @SuppressWarnings("rawtypes") static void init(); }
PortRanges { @SuppressWarnings("rawtypes") public static void init() { if (initialized.get()) return; synchronized (initialized) { if (initialized.get()) return; TypeCoercions.registerAdapter(Integer.class, PortRange.class, new Function<Integer,PortRange>() { public PortRange apply(Integer x) { return fromInteger(x); } }); TypeCoercions.registerAdapter(String.class, PortRange.class, new Function<String,PortRange>() { public PortRange apply(String x) { return fromString(x); } }); TypeCoercions.registerAdapter(Iterable.class, PortRange.class, new Function<Iterable,PortRange>() { public PortRange apply(Iterable x) { return fromIterable(x); } }); initialized.set(true); } }  static PortRange fromInteger(int x); static PortRange fromIterable(Iterable<?> c); static PortRange fromString(String s); @SuppressWarnings("rawtypes") static void init(); static final int MAX_PORT; static final PortRange ANY_HIGH_PORT; }