| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Operations, or "op"s, are algorithms that fulfill a particular contract. To be an Op, an algorithm must:
By fulfilling this contract, Ops provide a few key benefits:
There are three main ways of declaring Ops:
Classes can be discovered as an Op using the @OpClass annotation:
@OpClass(names = "foo.bar")
public class FooBarOp implements Producer<String> {
@Override
public void create() {
return "foobar";
}
}Fields can be discovered within classes implementing the OpCollection marker interface. The fields themselves must be annotated using the @OpField annotation:
public class FieldOpCollection implements OpCollection {
@OpField(names = "foo.bar")
public final Producer<String> fooBarField = () -> "foobar";
}Just like fields, methods can be discovered within OpCollection classes. The methods must be annotated using the @OpMethod annotation. For methods, it is important to specify the type that the method is attempting to mimic.
public class MethodOpCollection implements OpCollection {
@OpMethod(names = "foo.bar", type = Producer.class)
public static String fooBarMethod() {
return "foobar";
}
}| Back | FazBrowse Home | New Git URL |