1 package examples;
2
3 import org.pojomatic.Pojomatic;
4 import org.pojomatic.annotations.AutoProperty;
5 import org.pojomatic.annotations.PropertyFormat;
6
7 @AutoProperty
8 public class Customer {
9 private final String firstName;
10
11 private final String lastName;
12
13 @PropertyFormat(IpAddressFormatter.class)
14 private final byte[] ipAddress;
15
16 public Customer(String firstName, String lastName, byte[] ipAddress) {
17 this.firstName = firstName;
18 this.lastName = lastName;
19 this.ipAddress = ipAddress;
20 }
21
22 public String getFirstName() { return firstName; }
23 public String getLastName() { return lastName; }
24 public byte[] getIpAddress() { return ipAddress; }
25
26 @Override public int hashCode() {
27 return Pojomatic.hashCode(this);
28 }
29
30 @Override public String toString() {
31 return Pojomatic.toString(this);
32 }
33
34 @Override public boolean equals(Object o) {
35 return Pojomatic.equals(this, o);
36 }
37
38 public static void main(String[] args) {
39 System.out.println(new Customer("Joe", "Blow", new byte[] {127, 0, 0, 1}));
40 }
41 }