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.

Extension.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2012-present the original author or authors.
  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;
  17. import static java.lang.annotation.ElementType.TYPE;
  18. import static java.lang.annotation.RetentionPolicy.RUNTIME;
  19. import java.lang.annotation.Documented;
  20. import java.lang.annotation.Inherited;
  21. import java.lang.annotation.Retention;
  22. import java.lang.annotation.Target;
  23. /**
  24. * @author Decebal Suiu
  25. */
  26. @Retention(RUNTIME)
  27. @Target(TYPE)
  28. @Inherited
  29. @Documented
  30. public @interface Extension {
  31. int ordinal() default 0;
  32. /**
  33. * An array of extension points, that are implemented by this extension.
  34. * This explicit configuration overrides the automatic detection of extension points in the
  35. * {@link org.pf4j.processor.ExtensionAnnotationProcessor}.
  36. * <p>
  37. * In case your extension is directly derived from an extension point this attribute is NOT required.
  38. * But under certain <a href="https://github.com/pf4j/pf4j/issues/264">more complex scenarios</a> it
  39. * might be useful to explicitly set the extension points for an extension.
  40. *
  41. * @return classes of extension points, that are implemented by this extension
  42. */
  43. Class<? extends ExtensionPoint>[] points() default {};
  44. /**
  45. * An array of plugin IDs, that have to be available in order to load this extension.
  46. * The {@link AbstractExtensionFinder} won't load this extension, if these plugins are not
  47. * available / started at runtime.
  48. * <p>
  49. * Notice: This feature requires the optional <a href="https://asm.ow2.io/">ASM library</a>
  50. * to be available on the applications classpath and has to be explicitly enabled via
  51. * {@link AbstractExtensionFinder#setCheckForExtensionDependencies(boolean)}.
  52. *
  53. * @return plugin IDs, that have to be available in order to load this extension
  54. */
  55. String[] plugins() default {};
  56. }