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.
01.
<
repository
>
02.
<
id
>maven.hyper9.com</
id
>
03.
<
name
>Hyper9 Maven Repository</
name
>
04.
<
url
>http://maven.hyper9.com/repo/<;/
url
>
05.
<
layout
>default</
layout
>
06.
<
releases
>
07.
<
updatePolicy
>never</
updatePolicy
>
08.
<
checksumPolicy
>fail</
checksumPolicy
>
09.
</
releases
>
10.
<
snapshots
>
11.
<
updatePolicy
>always</
updatePolicy
>
12.
<
checksumPolicy
>fail</
checksumPolicy
>
13.
</
snapshots
>
14.
</
repository
>
2. List Hyper9 Common as a dependency in your project's POM file.
1.
<
dependency
>
2.
<
groupId
>com.hyper9</
groupId
>
3.
<
artifactId
>hyper9-common</
artifactId
>
4.
<
version
>0.0.1</
version
>
5.
<
type
>jar</
type
>
6.
<
scope
>compile</
scope
>
7.
</
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:
01.
@SerializedInterface
02.
public
interface
MyInterface
extends
Bean
03.
{
04.
...
05.
}
06.
07.
public
class
MyClass
implements
MyInterface
08.
{
09.
...
10.
}
11.
12.
...
13.
14.
MyClass mc =
new
MyClass();
15.
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:
1.
{
2.
type: "MyInterface"
3.
...
4.
}
The Transient annotation is used to denote bean reader methods that should not be serialized along with the rest of the bean.