You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ExtensionStorage.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2015 Decebal Suiu
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.pf4j.processor;
  17. import javax.annotation.processing.Filer;
  18. import javax.lang.model.element.Element;
  19. import java.util.Map;
  20. import java.util.Set;
  21. /**
  22. * @author Decebal Suiu
  23. */
  24. public abstract class ExtensionStorage {
  25. protected final ExtensionAnnotationProcessor processor;
  26. public ExtensionStorage(ExtensionAnnotationProcessor processor) {
  27. this.processor = processor;
  28. }
  29. public abstract Map<String, Set<String>> read();
  30. public abstract void write(Map<String, Set<String>> extensions);
  31. /**
  32. * Helper method.
  33. */
  34. protected Filer getFiler() {
  35. return processor.getProcessingEnvironment().getFiler();
  36. }
  37. /**
  38. * Helper method.
  39. */
  40. protected void error(String message, Object... args) {
  41. processor.error(message, args);
  42. }
  43. /**
  44. * Helper method.
  45. */
  46. protected void error(Element element, String message, Object... args) {
  47. processor.error(element, message, args);
  48. }
  49. /**
  50. * Helper method.
  51. */
  52. protected void info(String message, Object... args) {
  53. processor.info(message, args);
  54. }
  55. /**
  56. * Helper method.
  57. */
  58. protected void info(Element element, String message, Object... args) {
  59. processor.info(element, message, args);
  60. }
  61. }