/beans-annotation-processor

Primary LanguageJavaApache License 2.0Apache-2.0

Beans annotation processor

Use it to generate property names for your bean classes.

Setup

  1. Add dependency to your maven project:
<dependency>
	<groupId>den.spb.su</groupId>
	<artifactId>beans-annotation-proc</artifactId>
	<version>1.0-SNAPSHOT</version>
	<scope>provided</scope>
	<optional>true</optional>
</dependency>
  1. Configure maven compiler plugin to use annotation processor:
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <annotationProcessors>
                    <annotationProcessor>
			su.spb.den.processor.PropertiesAnnotationProcessor
		    </annotationProcessor>
		</annotationProcessors>
	    </configuration>
        </plugin>
    </plugins>
</build>

Usage

Annotate your bean class with @BeanProperties annotation. Run mvn clean compile. A new interface with property names defined as constants will be generated inside target/generated-sources/annotations folder of your project. If com.example.SomeType is the name of a bean class then the generated interface name is com.example.SomeTypeProperties.