RangeTypeMaskPersistableSpi implements DimapPersistableSpi { @Override public boolean canPersist(Object object) { if (object instanceof Mask) { Mask mask = (Mask) object; if(mask.getImageType() == Mask.RangeType.INSTANCE) { return true; } } return false; }  @Override boolean canDecode(Element element); @Override boolean canPersist(Object object); @Override DimapPersistable createPersistable();  }
@Test public void testCanPersist() { final Mask mask = new Mask("b", 2, 2, Mask.RangeType.INSTANCE); assertTrue(_persistableSpi.canPersist(mask)); assertFalse(_persistableSpi.canPersist(new ArrayList())); assertFalse(_persistableSpi.canPersist(new Object())); assertFalse(_persistableSpi.canPersist(new Band("b", ProductData.TYPE_INT8, 2, 2))); }