/** A nested POJO. */ @DefaultSchema(JavaFieldSchema.class) public static class POJO2 { public String field1 = "field1"; public POJO1 field2 = new POJO1(); }
/** Test POJO. */ @DefaultSchema(JavaFieldSchema.class) public static class InferredPojo { public String stringField; public Integer integerField; public InferredPojo(String stringField, Integer integerField) { this.stringField = stringField; this.integerField = integerField; } public InferredPojo() {} }
@DefaultSchema(TestDefaultSchemaProvider.class) static class TestDefaultSchemaClass {}
/** A pojo matching the schema resulting from selection field1, field3. */ @DefaultSchema(JavaFieldSchema.class) public static class POJO1Selected { public String field1 = "field1"; public Double field3 = 3.14; @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJO1Selected that = (POJO1Selected) o; return Objects.equals(field1, that.field1) && Objects.equals(field3, that.field3); } @Override public int hashCode() { return Objects.hash(field1, field3); } }
/** A pojo matching the schema results from selection field2.*. */ @DefaultSchema(JavaFieldSchema.class) public static class POJO2NestedAll { public POJO1 field2 = new POJO1(); @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJO2NestedAll that = (POJO2NestedAll) o; return Objects.equals(field2, that.field2); } @Override public int hashCode() { return Objects.hash(field2); } }
/** A pojo matching the schema results from selection field2.field1, field2.field3. */ @DefaultSchema(JavaFieldSchema.class) public static class POJO2NestedPartial { public POJO1Selected field2 = new POJO1Selected(); @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJO2NestedPartial that = (POJO2NestedPartial) o; return Objects.equals(field2, that.field2); } @Override public int hashCode() { return Objects.hash(field2); } }
/** Test inner POJO. * */ @DefaultSchema(JavaFieldSchema.class) public static class POJO1Nested { public String yard1 = "yard2"; public long yard2 = 43; @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJO1Nested that = (POJO1Nested) o; return yard2 == that.yard2 && Objects.equals(yard1, that.yard1); } @Override public int hashCode() { return Objects.hash(yard1, yard2); } }
/** A POJO containing arrays of complex classes. * */ @DefaultSchema(JavaFieldSchema.class) public static class NestedArrayPOJO { public SimplePOJO[] pojos; public NestedArrayPOJO(SimplePOJO... pojos) { this.pojos = pojos; } public NestedArrayPOJO() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NestedArrayPOJO that = (NestedArrayPOJO) o; return Arrays.equals(pojos, that.pojos); } @Override public int hashCode() { return Arrays.hashCode(pojos); } }
/** A POJO containing a map of a complex type. * */ @DefaultSchema(JavaFieldSchema.class) public static class NestedMapPOJO { public Map<String, SimplePOJO> map; public NestedMapPOJO(Map<String, SimplePOJO> map) { this.map = map; } public NestedMapPOJO() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NestedMapPOJO that = (NestedMapPOJO) o; return Objects.equals(map, that.map); } @Override public int hashCode() { return Objects.hash(map); } }
/** Test inner POJO. Different but equivalent schema. * */ @DefaultSchema(JavaFieldSchema.class) public static class POJO2Nested { public long yard2 = 43; public String yard1 = "yard2"; @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJO2Nested that = (POJO2Nested) o; return yard2 == that.yard2 && Objects.equals(yard1, that.yard1); } @Override public int hashCode() { return Objects.hash(yard2, yard1); } }
/** A class for testing nested aggregation. */ @DefaultSchema(JavaFieldSchema.class) public static class OuterAggregate implements Serializable { public AggregatePojos inner; public OuterAggregate(AggregatePojos inner) { this.inner = inner; } public OuterAggregate() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OuterAggregate that = (OuterAggregate) o; return Objects.equals(inner, that.inner); } @Override public int hashCode() { return Objects.hash(inner); } }
/** A POJO containing a {@link List} of a complex type. * */ @DefaultSchema(JavaFieldSchema.class) public static class NestedCollectionPOJO { public List<SimplePOJO> simples; public NestedCollectionPOJO(List<SimplePOJO> simples) { this.simples = simples; } public NestedCollectionPOJO() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NestedCollectionPOJO that = (NestedCollectionPOJO) o; return Objects.equals(simples, that.simples); } @Override public int hashCode() { return Objects.hash(simples); } }
/** A POJO containing a simple {@link Map}. * */ @DefaultSchema(JavaFieldSchema.class) public static class PrimitiveMapPOJO { public Map<String, Integer> map; public PrimitiveMapPOJO(Map<String, Integer> map) { this.map = map; } public PrimitiveMapPOJO() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PrimitiveMapPOJO that = (PrimitiveMapPOJO) o; return Objects.equals(map, that.map); } @Override public int hashCode() { return Objects.hash(map); } }
/** A POJO containing byte arrays. * */ @DefaultSchema(JavaFieldSchema.class) public static class POJOWithByteArray { public byte[] bytes1; public ByteBuffer bytes2; public POJOWithByteArray(byte[] bytes1, ByteBuffer bytes2) { this.bytes1 = bytes1; this.bytes2 = bytes2; } public POJOWithByteArray() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJOWithByteArray that = (POJOWithByteArray) o; return Arrays.equals(bytes1, that.bytes1) && Objects.equals(bytes2, that.bytes2); } @Override public int hashCode() { int result = Objects.hash(bytes2); result = 31 * result + Arrays.hashCode(bytes1); return result; } }
/** A bean containing arrays of arrays. * */ @DefaultSchema(JavaFieldSchema.class) public static class NestedArraysPOJO { public List<List<String>> lists; public NestedArraysPOJO(List<List<String>> lists) { this.lists = lists; } public NestedArraysPOJO() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NestedArraysPOJO that = (NestedArraysPOJO) o; return Objects.equals(lists, that.lists); } @Override public int hashCode() { return Objects.hash(lists); } }
/** POJO for {@link CastTest#testTypeWiden()}. */ @DefaultSchema(JavaFieldSchema.class) @VisibleForTesting public static class TypeWiden2 { public Integer field1 = 42; public Long field2 = 1337L; @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final TypeWiden2 typeWiden2 = (TypeWiden2) o; return Objects.equals(field1, typeWiden2.field1) && Objects.equals(field2, typeWiden2.field2); } @Override public int hashCode() { return Objects.hash(field1, field2); } @Override public String toString() { return "TypeWiden2{" + "field1=" + field1 + ", field2=" + field2 + '}'; } }
/** A POJO containing one nullable and one non-nullable type. */ @DefaultSchema(JavaFieldSchema.class) public static class POJOWithNullables { @Nullable public String str; public int anInt; public POJOWithNullables(@Nullable String str, int anInt) { this.str = str; this.anInt = anInt; } public POJOWithNullables() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJOWithNullables that = (POJOWithNullables) o; return anInt == that.anInt && Objects.equals(str, that.str); } @Override public int hashCode() { return Objects.hash(str, anInt); } }
/** POJO for {@link CastTest#testProjection()}. */ @DefaultSchema(JavaFieldSchema.class) @VisibleForTesting public static class Projection2 { public Integer field2 = 1337; @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Projection2 that = (Projection2) o; return Objects.equals(field2, that.field2); } @Override public int hashCode() { return Objects.hash(field2); } @Override public String toString() { return "Projection2{" + "field2=" + field2 + '}'; } }
/** a POJO containing a nested nullable field. * */ @DefaultSchema(JavaFieldSchema.class) public static class POJOWithNestedNullable { @Nullable public POJOWithNullables nested; public POJOWithNestedNullable(@Nullable POJOWithNullables nested) { this.nested = nested; } public POJOWithNestedNullable() {} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } POJOWithNestedNullable that = (POJOWithNestedNullable) o; return Objects.equals(nested, that.nested); } @Override public int hashCode() { return Objects.hash(nested); } }
/** POJO for {@link CastTest#testWeakedNullable()}. */ @DefaultSchema(JavaFieldSchema.class) @VisibleForTesting public static class Nullable2 { public @Nullable Integer field1 = 42; public @Nullable Long field2 = null; @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Nullable2 nullable2 = (Nullable2) o; return Objects.equals(field1, nullable2.field1) && Objects.equals(field2, nullable2.field2); } @Override public int hashCode() { return Objects.hash(field1, field2); } @Override public String toString() { return "Nullable2{" + "field1=" + field1 + ", field2=" + field2 + '}'; } }