mirror of
https://github.com/JHUAPL/Jackfruit.git
synced 2026-01-08 21:58:09 -05:00
Resolve "Add sources to jar"
This commit is contained in:
37
README.md
37
README.md
@@ -55,7 +55,6 @@ public interface DemoConfig {
|
||||
This corresponds to this Apache Configuration file:
|
||||
```
|
||||
# field comment
|
||||
# field comment
|
||||
prefix.key = 0
|
||||
prefix.doubleMethod = 0.0
|
||||
prefix.StringMethod = Default String
|
||||
@@ -106,4 +105,38 @@ The annotation processor generates a class called DemoConfigFactory. An example
|
||||
|
||||
// get one of the config object's properties
|
||||
System.out.printf("config.StringMethod() = %s\n", template.StringMethod());
|
||||
```
|
||||
```
|
||||
|
||||
## Supported Annotations
|
||||
|
||||
The `@Jackfruit` annotation goes on the interface. The remaining annotations are for use on the interface methods.
|
||||
|
||||
### Jackfruit
|
||||
This annotation goes on the interface to signify that it should be run through the annotation processor. There is an optional "prefix" argument that can be used to add a prefix to all of the configuration keys created by the processor.
|
||||
|
||||
### Comment
|
||||
|
||||
The `@Comment` annotation specifies the comment that appears in the configuration file above the parameter itself.
|
||||
|
||||
### DefaultValue
|
||||
|
||||
The `@DefaultValue` annotation is a String used to initialize the parameter. This is a required annotation. Strings and primitives (and their corresponding wrapper types) are read natively. Other objects will need to use the `@ParserClass` annotation to specify a class which implements the `jackfruit.annotations.Parser` interface to convert the object to and from a String.
|
||||
|
||||
### Key
|
||||
|
||||
The `@Key` annotation can be used to specify the name for the configuration key. The default is to use the name of the method.
|
||||
|
||||
### ParserClass
|
||||
|
||||
The `@ParserClass` annotation specifies a class which implements the `jackfruit.annotations.Parser` interface to convert an object to and from a String. The `Parser` interface implements two methods:
|
||||
|
||||
```
|
||||
public interface Parser<T> {
|
||||
public T fromString(String s);
|
||||
|
||||
public String toString(T t);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,18 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Use this annotation to signify that it should be run through the annotation processor. There is
|
||||
* an optional "prefix" argument that can be used to add a prefix to all of the configuration keys
|
||||
* created by the processor.
|
||||
* <p>
|
||||
* For example:
|
||||
*
|
||||
* @Jackfruit(prefix = "myPrefix")
|
||||
*
|
||||
* @author nairah1
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Jackfruit {
|
||||
|
||||
21
pom.xml
21
pom.xml
@@ -60,8 +60,7 @@
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
@@ -83,7 +82,23 @@
|
||||
</plugins>
|
||||
|
||||
</pluginManagement>
|
||||
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<modules>
|
||||
|
||||
Reference in New Issue
Block a user