1 package org.pojomatic.internal;
2
3 import java.util.List;
4
5 public interface Type {
6
7 /**
8 * @return the class represented by this type
9 */
10 Class<?> getClazz();
11
12 /**
13 * @return a list of sample values for the type
14 */
15 List<Object> getSampleValues();
16
17 /**
18 * @return the number of array levels in this type. 0 for primitives or non-array classes, 1 for arrays thereof, etc.
19 */
20 int arrayDepth();
21
22 /**
23 * Compute the hashCode for a value of this type. Do not recursively process arrays
24 * @param value
25 * @return the non-recursive hashCode for {@code value}.
26 */
27 int hashCode(Object value);
28
29 /**
30 * Compute the hashCode for a value of this type, recursing into arrays as needed.
31 * @param value
32 * @return recursive hashCode for {@code value}
33 */
34 int deepHashCode(Object value);
35
36 /**
37 * Compute the desired toString representation for a value of this type.
38 * @param value
39 * @return the desired non-recursive toString representation for {@code value}.
40 */
41 String toString(Object value);
42
43 /**
44 * Compute the desired toString representation for a value of this type, recursing into arrays as needed.
45 * @param value
46 * @return the desired recursive toString representation for {@code value}.
47 */
48 String deepToString(Object value);
49 }