Skip to content

Instantly share code, notes, and snippets.

@ajinzrathod
Last active July 28, 2021 06:42
Show Gist options
  • Save ajinzrathod/d0465d54a251e4aa1c96e95df42dc519 to your computer and use it in GitHub Desktop.
Save ajinzrathod/d0465d54a251e4aa1c96e95df42dc519 to your computer and use it in GitHub Desktop.
Sharing Annotation Example
interface Deletable {
}
class Entity implements Deletable {
// implementation details
}
class ShapeDao extends Entity {
// other dao methods
public boolean delete(Object object) {
if (!(object instanceof Deletable)) {
return false;
}
// delete implementation details
return true;
}
}
public class UsingMarkerInterface {
public static void main(String[] args) {
ShapeDao sd = new ShapeDao();
System.out.println(sd.delete(sd));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment