GeneratedMixin

Indicates an interface which is used for extending generated code using default methods declared in the interface.

In order to generate a class which implements a custom interface:

  1. Create the interface and mark it with this annotation.
  2. Declare methods of interest following the Protobuf convention for the accessor methods. For example, if a message has a property named foo_bar, the method to declare will be getFooBar().
  3. Add default methods. Presumably bodies of these methods will call accessor methods declared earlier.
  4. Mark corresponding proto messages using the (is).java_type option (if for one message), or (every_is).java_type option for a file, if the interface is common for all the message declared in this file. These options instruct Spine Model Compiler to make the generated code implement this interface.

The annotation should NOT be used on interfaces that do not provide default methods, as implementing classes would not be mixins.

See also

io.spine.option.IsOption

Inherited functions

Link copied to clipboard
public abstract Class<? extends Annotation> annotationType()
Link copied to clipboard
public abstract boolean equals(Object p)
Link copied to clipboard
public abstract int hashCode()
Link copied to clipboard
public abstract String toString()