Annotation Interface Singleton


@Inherited @Documented @Target(TYPE) @Retention(RUNTIME) public @interface Singleton
Types that are annotated with this annotation will be instantiated only once.
It might be possible to get the instance of the class by:
  • Calling the static method getInstance()
  • Accessing the public static field INSTANCE
If an interface is annotated with this annotation,
all classes that implement this interface will be instantiated only once.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The method to obtain the instance of the singleton class.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Returns the method to get the instance of the singleton class.
  • Element Details

    • value

      @NotNull @NotNull Singleton.Method value
      Returns the method to get the instance of the singleton class.
      Returns:
      The method to get the singleton
      Default:
      UNDEFINED