Annotation Type Mixin


  • @Documented
    @Retention(CLASS)
    @Target(TYPE)
    public @interface Mixin
    The Mixin annotation can be applied on classes to mark them as a mixin. It's presence is however mostly used in order know what classes are targeted by the mixin, as the mixin itself is resolved through the mixin config

    In order for this annotation to work, either targets() or value() needs to be defined. If neither are defined, an exception is thrown while parsing the mixin. The micromixin implementation will thus not add the mixin.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      int priority
      The relative priority of the mixin, which defines the order in which the mixin is applied.
      java.lang.String[] targets
      The fully qualified names of the target classes.
      java.lang.Class<?>[] value
      The Class instances of the targeted classes.
    • Element Detail

      • priority

        int priority
        The relative priority of the mixin, which defines the order in which the mixin is applied. The default value can be set through the mixin config.
        Returns:
        The priority of the mixin.
        Default:
        1000
      • targets

        java.lang.String[] targets
        The fully qualified names of the target classes. The spongeian implementation will warn if targets() is used where value() could be used instead, but the Micromixin implementation does not warn in such instances.

        Packages can both be separated with dots (e.g. java.lang.Object) like is done in Java source code, or be separated with slashes (e.g. java/lang/Object). Inner classes are always separated with the dollar symbol (e.g. java/util/AbstractMap$SimpleImmutableEntry) - using dots instead is not permissible (note that it will cause the mixin to fail silently as technically a class within the specified package could be loaded - it is permissible for classes and packages to be named similarly).

        Returns:
        The targeted classes.
        Default:
        {}
      • value

        java.lang.Class<?>[] value
        The Class instances of the targeted classes. If the class cannot be referenced (for example because they are package-private), targets() should be used instead.
        Returns:
        The targeted classes.
        Default:
        {}