@Test public void testGetAsset() { @SuppressWarnings("serial") class UnknownType extends ImageIcon {}; for (ViewInfo viewInfo : provider.getViews("")) { Assert.assertNotNull(provider.getAsset(viewInfo, ImageIcon.class)); Assert.assertNotNull(provider.getAsset(viewInfo, Icon.class)); Assert.assertNull(provider.getAsset(viewInfo, UnknownType.class)); } TypeInfo<?> unknownInfo = new TypeInfo<UnknownType>(UnknownType.class){}; for (Class<?> type : new Class<?>[] {ImageIcon.class,Icon.class,UnknownType.class}) { Assert.assertNull(provider.getAsset(unknownInfo, type)); } }
@Override public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) { if (assetClass.isAssignableFrom(ImageIcon.class) && typeInfo.getTypeClass().equals(PlotViewManifestation.class)) { return assetClass.cast(ICON); } return super.getAsset(typeInfo, assetClass); }
PlotViewProvider extends AbstractComponentProvider { @Override public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) { if (assetClass.isAssignableFrom(ImageIcon.class) && typeInfo.getTypeClass().equals(PlotViewManifestation.class)) { return assetClass.cast(ICON); } return super.getAsset(typeInfo, assetClass); } }
PlotViewProvider extends AbstractComponentProvider { @Override public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) { if (assetClass.isAssignableFrom(ImageIcon.class) && typeInfo.getTypeClass().equals(PlotViewManifestation.class)) { return assetClass.cast(ICON); } return super.getAsset(typeInfo, assetClass); } PlotViewProvider(); }
PlotViewProvider extends AbstractComponentProvider { @Override public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) { if (assetClass.isAssignableFrom(ImageIcon.class) && typeInfo.getTypeClass().equals(PlotViewManifestation.class)) { return assetClass.cast(ICON); } return super.getAsset(typeInfo, assetClass); } PlotViewProvider(); @Override Collection<ViewInfo> getViews(String componentTypeId); @Override Collection<PolicyInfo> getPolicyInfos(); @Override T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass); }
PlotViewProvider extends AbstractComponentProvider { @Override public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) { if (assetClass.isAssignableFrom(ImageIcon.class) && typeInfo.getTypeClass().equals(PlotViewManifestation.class)) { return assetClass.cast(ICON); } return super.getAsset(typeInfo, assetClass); } PlotViewProvider(); @Override Collection<ViewInfo> getViews(String componentTypeId); @Override Collection<PolicyInfo> getPolicyInfos(); @Override T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass);  }