Installing Hyper9 Common is a simple two step process:
1. Add the Hyper9 Maven Repository to your Maven settings file or to your project's POM file.
<repository> <id>maven.hyper9.com</id> <name>Hyper9 Maven Repository</name> <url>http://maven.hyper9.com/repo/</url> <layout>default</layout> <releases> <updatePolicy>never</updatePolicy> <checksumPolicy>fail</checksumPolicy> </releases> <snapshots> <updatePolicy>always</updatePolicy> <checksumPolicy>fail</checksumPolicy> </snapshots> </repository>
2. List Hyper9 Common as a dependency in your project's POM file.
<dependency> <groupId>com.hyper9</groupId> <artifactId>hyper9-common</artifactId> <version>0.0.1</version> <type>jar</type> <scope>compile</scope> </dependency>
And that's all there is to installing Hyper9 Common.
Hyper9 Common provides several utility classes to assist rapid development. A few of these classes include:
Hyper9 Common defines two Java 6 annotations.
SerializedInterface is an annotation that marks an interface as the type to represent a serialized object with. For example:
@SerializedInterface public interface MyInterface extends Bean { ... } public class MyClass implements MyInterface { ... } ... MyClass mc = new MyClass(); System.out.println(mc.toString());
Because 'MyClass' implements 'MyInterface' which in turn is a 'Bean', and because 'MyInterface' is decorated with the 'SerialzedInterface' annotation, when the object is printed to stdout (JSON by default) it will look like:
{ type: "MyInterface" ... }
The Transient annotation is used to denote bean reader methods that should not be serialized along with the rest of the bean.