Guest User

Untitled

a guest
Oct 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. interface Calculator {
  2. List<Object> getResults();
  3. List<String> schema();
  4. }
  5.  
  6. default List<String> schema() {
  7. Schema schema = getClass().getAnnotation(Schema.class);
  8. if (schema == null) {
  9. throw new IllegalStateException("Class is missing @Schema annotation: "
  10. + getClass().getName());
  11. }
  12. return schema.getValues();
  13. }
  14.  
  15. @Schema({"e", "pi", "i"})
  16. public class ScientificCalculator implements Calculator { ... }
Add Comment
Please, Sign In to add comment