Skip to content

Commit 6652b12

Browse files
committed
Update READMEs
1 parent aefab49 commit 6652b12

File tree

2 files changed

+77
-5
lines changed

2 files changed

+77
-5
lines changed

scijava/scijava-discovery-therapi/README.md

+65-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
1-
# SciJava Discovery: A library for the abstraction of service discovery mechanisms
1+
# SciJava Discovery Therapi: A Discoverer implementation backed by Therapi
22

3-
This module provides the `Discoverer` interface, an abstraction for service discovery.
3+
This module provides the `TherapiDiscover`, a `Discoverer` implementation that uses [`therapi-runtime-javadoc`](https://github.com/dnault/therapi-runtime-javadoc) to discover tagged elements through javadoc tags.
4+
5+
`TherapiDiscoverer` **only** implements `Discoverer.elementsTaggedWith(String tag)`.
6+
7+
To make tags discoverable via `TherapiDiscoverer`, one must first enable therapi's annotation processor.
8+
9+
```java
10+
<properties>
11+
<therapi.version>0.12.0</therapi.version>
12+
<therapi-runtime-javadoc-scribe.version>${therapi.version}</therapi-runtime-javadoc-scribe.version>
13+
<therapi.packages></therapi.packages>
14+
</properties>
15+
```
16+
17+
This sets the therapi version, and denotes the packages (using the `<therapi.packages>` tag) that should be processed. This can be left blank to indicate all packages, or can be a comma-delimited list to process **only** those packages.
18+
19+
```java
20+
<build>
21+
<plugins>
22+
<plugin>
23+
<artifactId>maven-compiler-plugin</artifactId>
24+
<configuration>
25+
<annotationProcessorPaths>
26+
<path>
27+
<groupId>com.github.therapi</groupId>
28+
<artifactId>therapi-runtime-javadoc-scribe</artifactId>
29+
<version>${therapi-runtime-javadoc-scribe.version}</version>
30+
</path>
31+
</annotationProcessorPaths>
32+
<fork>true</fork>
33+
<compilerArgs>
34+
<arg>-Ajavadoc.packages="${therapi.packages}"</arg>
35+
</compilerArgs>
36+
</configuration>
37+
</plugin>
38+
</plugins>
39+
</build>
40+
```
41+
42+
These elements already live in `scijava-incubator`, and will be moved upstream to `pom-scijava` at a later date. This means that all incubator projects (and later all SciJava projects) will have therapi capabilities for free. This behavior is **opt-in**; to enable therapi's annotation processor (and thus any functionality from `TherapiDiscoverer`) one must add `<therapi.packages></therapi.packages>` to the `properties` section of their POM.
43+
44+
## Tag Structure
45+
46+
To add a tag to any [`AnnotatedElement`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/reflect/AnnotatedElement.html), one can simply insert the [`@implNote`](https://nipafx.dev/javadoc-tags-apiNote-implSpec-implNote/) tag into the javadoc of that `AnnotatedElement`. Tags should be structured as
47+
48+
```java
49+
@implNote <tagType> <tagBody>
50+
```
51+
52+
Where `tagType` is the `String` under which this `AnnotatedElement` should be discovered, and `tagBody` is any set of options relevant for the `tagType`. **TODO: `tagBody` structure**
53+
54+
An example might look like
55+
56+
```java
57+
58+
/**
59+
* @implNote foo
60+
*/
61+
public void taggedMethod(...) {
62+
...
63+
}
64+
```
65+
66+
Assuming therapi processes the package containing `taggedMethod`, `taggedMethod` can then be retrieved using `TherapiDiscoverer.elementsTaggedWith("foo")`.
467

5-
WIP

scijava/scijava-discovery/README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# SciJava Discovery: A library for the abstraction of service discovery mechanisms
22

3-
This module provides the `Discoverer` interface, an abstraction for service discovery.
3+
This module provides the `Discoverer` interface, an abstraction for service discovery. `Discoverer`s are designed to return `Discovery` objects, which combine the discovered `Object` with a tag (explained below). `Discoverer`s should implement one (or both) of `Discoverer`'s methods:
44

5-
WIP
5+
## `List<Discovery<? extends Class<T>>> Discoverer.implsOfType(Class<T> c)`
6+
7+
This method is designed to return a list of implementations of some `Class<?> c`. In other words, `c` is a superclass extended by/interface implemented by each of the returned `Class`es.
8+
9+
## `List<Discovery<AnnotatedElement>> Discoverer.elementsTaggedWith(String tagType)`
10+
11+
This method is designed to return a list of `AnnotatedElements` (`Class`es, `Method`s, or `Field`s) tagged with the given tag type.
12+
13+
## Tags
14+
15+
** TODO**

0 commit comments

Comments
 (0)