@Test public void testValueAs() { DiscreteResource resource = Resources.discrete(D1).resource(); Optional<DeviceId> volume = resource.valueAs(DeviceId.class); assertThat(volume.get(), is(D1)); }
@Override public <T> Optional<T> valueAs(Class<T> type) { checkNotNull(type); return id.lastComponentAs(type); }
DiscreteResource implements Resource { @Override public <T> Optional<T> valueAs(Class<T> type) { checkNotNull(type); return id.lastComponentAs(type); } }
DiscreteResource implements Resource { @Override public <T> Optional<T> valueAs(Class<T> type) { checkNotNull(type); return id.lastComponentAs(type); } DiscreteResource(DiscreteResourceId id);   DiscreteResource(); }
DiscreteResource implements Resource { @Override public <T> Optional<T> valueAs(Class<T> type) { checkNotNull(type); return id.lastComponentAs(type); } DiscreteResource(DiscreteResourceId id);   DiscreteResource(); @Override DiscreteResourceId id(); @Override String simpleTypeName(); @Override boolean isTypeOf(Class<?> type); @Override boolean isSubTypeOf(Class<?> ancestor); @Override Optional<T> valueAs(Class<T> type); @Override DiscreteResource child(Object child); @Override ContinuousResource child(Class<?> child, double value); @Override Optional<DiscreteResource> parent(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
DiscreteResource implements Resource { @Override public <T> Optional<T> valueAs(Class<T> type) { checkNotNull(type); return id.lastComponentAs(type); } DiscreteResource(DiscreteResourceId id);   DiscreteResource(); @Override DiscreteResourceId id(); @Override String simpleTypeName(); @Override boolean isTypeOf(Class<?> type); @Override boolean isSubTypeOf(Class<?> ancestor); @Override Optional<T> valueAs(Class<T> type); @Override DiscreteResource child(Object child); @Override ContinuousResource child(Class<?> child, double value); @Override Optional<DiscreteResource> parent(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }