index
int64
0
0
repo_id
stringlengths
9
205
file_path
stringlengths
31
246
content
stringlengths
1
12.2M
__index_level_0__
int64
0
10k
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/FreeDrinkPromotion.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.FreeDrinkPromotion in pizza.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Object; import java.lang.Override; import okio.ByteString; public final class FreeDrinkPromotion extends Message<FreeDrinkPromotion, FreeDrinkPromotion.Builder> { public static final ProtoAdapter<FreeDrinkPromotion> ADAPTER = ProtoAdapter.newMessageAdapter(FreeDrinkPromotion.class, "type.googleapis.com/squareup.proto3.FreeDrinkPromotion", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "squareup.proto3.FreeDrinkPromotion$Drink#ADAPTER", label = WireField.Label.OMIT_IDENTITY ) public final Drink drink; public FreeDrinkPromotion(Drink drink) { this(drink, ByteString.EMPTY); } public FreeDrinkPromotion(Drink drink, ByteString unknownFields) { super(ADAPTER, unknownFields); if (drink == null) { throw new IllegalArgumentException("drink == null"); } this.drink = drink; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.drink = drink; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof FreeDrinkPromotion)) return false; FreeDrinkPromotion o = (FreeDrinkPromotion) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(drink, o.drink); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (drink != null ? drink.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<FreeDrinkPromotion, Builder> { public Drink drink; public Builder() { drink = Drink.UNKNOWN; } public Builder drink(Drink drink) { this.drink = drink; return this; } @Override public FreeDrinkPromotion build() { return new FreeDrinkPromotion(drink, super.buildUnknownFields()); } } public enum Drink implements WireEnum { UNKNOWN(0), PEPSI(1), MOUNTAIN_DEW(2), ROOT_BEER(9); public static final ProtoAdapter<Drink> ADAPTER = ProtoAdapter.newEnumAdapter(Drink.class); private final int value; Drink(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static Drink fromValue(int value) { switch (value) { case 0: return UNKNOWN; case 1: return PEPSI; case 2: return MOUNTAIN_DEW; case 9: return ROOT_BEER; default: return null; } } @Override public int getValue() { return value; } } }
7,100
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/AllStructs.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.AllStructs in all_structs.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.Void; import java.util.List; import java.util.Map; import okio.ByteString; public final class AllStructs extends Message<AllStructs, AllStructs.Builder> { public static final ProtoAdapter<AllStructs> ADAPTER = ProtoAdapter.newMessageAdapter(AllStructs.class, "type.googleapis.com/squareup.proto3.AllStructs", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", label = WireField.Label.OMIT_IDENTITY ) public final Map<String, ?> struct; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_LIST", label = WireField.Label.OMIT_IDENTITY ) public final List<?> list; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_NULL", label = WireField.Label.OMIT_IDENTITY, jsonName = "nullValue" ) public final Void null_value; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.OMIT_IDENTITY, jsonName = "valueA" ) public final Object value_a; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.OMIT_IDENTITY, jsonName = "valueB" ) public final Object value_b; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.OMIT_IDENTITY, jsonName = "valueC" ) public final Object value_c; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.OMIT_IDENTITY, jsonName = "valueD" ) public final Object value_d; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.OMIT_IDENTITY, jsonName = "valueE" ) public final Object value_e; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.OMIT_IDENTITY, jsonName = "valueF" ) public final Object value_f; @WireField( tag = 101, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", label = WireField.Label.REPEATED, jsonName = "repStruct" ) public final List<Map<String, ?>> rep_struct; @WireField( tag = 102, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_LIST", label = WireField.Label.REPEATED, jsonName = "repList" ) public final List<List<?>> rep_list; @WireField( tag = 103, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", label = WireField.Label.REPEATED, jsonName = "repValueA" ) public final List<Object> rep_value_a; @WireField( tag = 104, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_NULL", label = WireField.Label.REPEATED, jsonName = "repNullValue" ) public final List<Void> rep_null_value; @WireField( tag = 301, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", jsonName = "mapInt32Struct" ) public final Map<Integer, Map<String, ?>> map_int32_struct; @WireField( tag = 302, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#STRUCT_LIST", jsonName = "mapInt32List" ) public final Map<Integer, List<?>> map_int32_list; @WireField( tag = 303, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#STRUCT_VALUE", jsonName = "mapInt32ValueA" ) public final Map<Integer, Object> map_int32_value_a; @WireField( tag = 304, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#STRUCT_NULL", jsonName = "mapInt32NullValue" ) public final Map<Integer, Void> map_int32_null_value; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", jsonName = "oneofStruct", oneofName = "choice" ) public final Map<String, ?> oneof_struct; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_LIST", jsonName = "oneofList", oneofName = "choice" ) public final List<?> oneof_list; public AllStructs(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_struct, builder.oneof_list) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_struct, builder.oneof_list may be non-null"); } this.struct = Internal.immutableCopyOfStruct("struct", builder.struct); this.list = Internal.immutableCopyOfStruct("list", builder.list); this.null_value = Internal.immutableCopyOfStruct("null_value", builder.null_value); this.value_a = Internal.immutableCopyOfStruct("value_a", builder.value_a); this.value_b = Internal.immutableCopyOfStruct("value_b", builder.value_b); this.value_c = Internal.immutableCopyOfStruct("value_c", builder.value_c); this.value_d = Internal.immutableCopyOfStruct("value_d", builder.value_d); this.value_e = Internal.immutableCopyOfStruct("value_e", builder.value_e); this.value_f = Internal.immutableCopyOfStruct("value_f", builder.value_f); this.rep_struct = Internal.immutableCopyOfStruct("rep_struct", builder.rep_struct); this.rep_list = Internal.immutableCopyOfStruct("rep_list", builder.rep_list); this.rep_value_a = Internal.immutableCopyOfStruct("rep_value_a", builder.rep_value_a); this.rep_null_value = Internal.immutableCopyOfStruct("rep_null_value", builder.rep_null_value); this.map_int32_struct = Internal.immutableCopyOfMapWithStructValues("map_int32_struct", builder.map_int32_struct); this.map_int32_list = Internal.immutableCopyOfMapWithStructValues("map_int32_list", builder.map_int32_list); this.map_int32_value_a = Internal.immutableCopyOfMapWithStructValues("map_int32_value_a", builder.map_int32_value_a); this.map_int32_null_value = Internal.immutableCopyOfMapWithStructValues("map_int32_null_value", builder.map_int32_null_value); this.oneof_struct = Internal.immutableCopyOfStruct("oneof_struct", builder.oneof_struct); this.oneof_list = Internal.immutableCopyOfStruct("oneof_list", builder.oneof_list); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.struct = struct; builder.list = list; builder.null_value = null_value; builder.value_a = value_a; builder.value_b = value_b; builder.value_c = value_c; builder.value_d = value_d; builder.value_e = value_e; builder.value_f = value_f; builder.rep_struct = Internal.copyOf(rep_struct); builder.rep_list = Internal.copyOf(rep_list); builder.rep_value_a = Internal.copyOf(rep_value_a); builder.rep_null_value = Internal.copyOf(rep_null_value); builder.map_int32_struct = Internal.copyOf(map_int32_struct); builder.map_int32_list = Internal.copyOf(map_int32_list); builder.map_int32_value_a = Internal.copyOf(map_int32_value_a); builder.map_int32_null_value = Internal.copyOf(map_int32_null_value); builder.oneof_struct = oneof_struct; builder.oneof_list = oneof_list; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof AllStructs)) return false; AllStructs o = (AllStructs) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(struct, o.struct) && Internal.equals(list, o.list) && Internal.equals(null_value, o.null_value) && Internal.equals(value_a, o.value_a) && Internal.equals(value_b, o.value_b) && Internal.equals(value_c, o.value_c) && Internal.equals(value_d, o.value_d) && Internal.equals(value_e, o.value_e) && Internal.equals(value_f, o.value_f) && rep_struct.equals(o.rep_struct) && rep_list.equals(o.rep_list) && rep_value_a.equals(o.rep_value_a) && rep_null_value.equals(o.rep_null_value) && map_int32_struct.equals(o.map_int32_struct) && map_int32_list.equals(o.map_int32_list) && map_int32_value_a.equals(o.map_int32_value_a) && map_int32_null_value.equals(o.map_int32_null_value) && Internal.equals(oneof_struct, o.oneof_struct) && Internal.equals(oneof_list, o.oneof_list); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (struct != null ? struct.hashCode() : 0); result = result * 37 + (list != null ? list.hashCode() : 0); result = result * 37 + (null_value != null ? null_value.hashCode() : 0); result = result * 37 + (value_a != null ? value_a.hashCode() : 0); result = result * 37 + (value_b != null ? value_b.hashCode() : 0); result = result * 37 + (value_c != null ? value_c.hashCode() : 0); result = result * 37 + (value_d != null ? value_d.hashCode() : 0); result = result * 37 + (value_e != null ? value_e.hashCode() : 0); result = result * 37 + (value_f != null ? value_f.hashCode() : 0); result = result * 37 + rep_struct.hashCode(); result = result * 37 + rep_list.hashCode(); result = result * 37 + rep_value_a.hashCode(); result = result * 37 + rep_null_value.hashCode(); result = result * 37 + map_int32_struct.hashCode(); result = result * 37 + map_int32_list.hashCode(); result = result * 37 + map_int32_value_a.hashCode(); result = result * 37 + map_int32_null_value.hashCode(); result = result * 37 + (oneof_struct != null ? oneof_struct.hashCode() : 0); result = result * 37 + (oneof_list != null ? oneof_list.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<AllStructs, Builder> { public Map<String, ?> struct; public List<?> list; public Void null_value; public Object value_a; public Object value_b; public Object value_c; public Object value_d; public Object value_e; public Object value_f; public List<Map<String, ?>> rep_struct; public List<List<?>> rep_list; public List<Object> rep_value_a; public List<Void> rep_null_value; public Map<Integer, Map<String, ?>> map_int32_struct; public Map<Integer, List<?>> map_int32_list; public Map<Integer, Object> map_int32_value_a; public Map<Integer, Void> map_int32_null_value; public Map<String, ?> oneof_struct; public List<?> oneof_list; public Builder() { rep_struct = Internal.newMutableList(); rep_list = Internal.newMutableList(); rep_value_a = Internal.newMutableList(); rep_null_value = Internal.newMutableList(); map_int32_struct = Internal.newMutableMap(); map_int32_list = Internal.newMutableMap(); map_int32_value_a = Internal.newMutableMap(); map_int32_null_value = Internal.newMutableMap(); } public Builder struct(Map<String, ?> struct) { this.struct = struct; return this; } public Builder list(List<?> list) { this.list = list; return this; } public Builder null_value(Void null_value) { this.null_value = null_value; return this; } public Builder value_a(Object value_a) { this.value_a = value_a; return this; } public Builder value_b(Object value_b) { this.value_b = value_b; return this; } public Builder value_c(Object value_c) { this.value_c = value_c; return this; } public Builder value_d(Object value_d) { this.value_d = value_d; return this; } public Builder value_e(Object value_e) { this.value_e = value_e; return this; } public Builder value_f(Object value_f) { this.value_f = value_f; return this; } public Builder rep_struct(List<Map<String, ?>> rep_struct) { Internal.checkElementsNotNull(rep_struct); this.rep_struct = rep_struct; return this; } public Builder rep_list(List<List<?>> rep_list) { Internal.checkElementsNotNull(rep_list); this.rep_list = rep_list; return this; } public Builder rep_value_a(List<Object> rep_value_a) { Internal.checkElementsNotNull(rep_value_a); this.rep_value_a = rep_value_a; return this; } public Builder rep_null_value(List<Void> rep_null_value) { Internal.checkElementsNotNull(rep_null_value); this.rep_null_value = rep_null_value; return this; } public Builder map_int32_struct(Map<Integer, Map<String, ?>> map_int32_struct) { Internal.checkElementsNotNull(map_int32_struct); this.map_int32_struct = map_int32_struct; return this; } public Builder map_int32_list(Map<Integer, List<?>> map_int32_list) { Internal.checkElementsNotNull(map_int32_list); this.map_int32_list = map_int32_list; return this; } public Builder map_int32_value_a(Map<Integer, Object> map_int32_value_a) { Internal.checkElementsNotNull(map_int32_value_a); this.map_int32_value_a = map_int32_value_a; return this; } public Builder map_int32_null_value(Map<Integer, Void> map_int32_null_value) { Internal.checkElementsNotNull(map_int32_null_value); this.map_int32_null_value = map_int32_null_value; return this; } public Builder oneof_struct(Map<String, ?> oneof_struct) { this.oneof_struct = oneof_struct; this.oneof_list = null; return this; } public Builder oneof_list(List<?> oneof_list) { this.oneof_list = oneof_list; this.oneof_struct = null; return this; } @Override public AllStructs build() { return new AllStructs(this, super.buildUnknownFields()); } } }
7,101
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/PizzaDelivery.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.PizzaDelivery in pizza.proto package squareup.proto3; import com.squareup.wire.AnyMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.time.Duration; import java.time.Instant; import java.util.List; import java.util.Map; import okio.ByteString; public final class PizzaDelivery extends Message<PizzaDelivery, PizzaDelivery.Builder> { public static final ProtoAdapter<PizzaDelivery> ADAPTER = ProtoAdapter.newMessageAdapter(PizzaDelivery.class, "type.googleapis.com/squareup.proto3.PizzaDelivery", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.OMIT_IDENTITY, jsonName = "phoneNumber" ) public final String phone_number; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.OMIT_IDENTITY ) public final String address; @WireField( tag = 3, adapter = "squareup.proto3.Pizza#ADAPTER", label = WireField.Label.REPEATED ) public final List<Pizza> pizzas; @WireField( tag = 4, adapter = "com.squareup.wire.AnyMessage#ADAPTER", label = WireField.Label.OMIT_IDENTITY ) public final AnyMessage promotion; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#DURATION", label = WireField.Label.OMIT_IDENTITY, jsonName = "deliveredWithinOrFree" ) public final Duration delivered_within_or_free; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", label = WireField.Label.OMIT_IDENTITY ) public final Map<String, ?> loyalty; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#INSTANT", label = WireField.Label.OMIT_IDENTITY, jsonName = "orderedAt" ) public final Instant ordered_at; public PizzaDelivery(String phone_number, String address, List<Pizza> pizzas, AnyMessage promotion, Duration delivered_within_or_free, Map<String, ?> loyalty, Instant ordered_at) { this(phone_number, address, pizzas, promotion, delivered_within_or_free, loyalty, ordered_at, ByteString.EMPTY); } public PizzaDelivery(String phone_number, String address, List<Pizza> pizzas, AnyMessage promotion, Duration delivered_within_or_free, Map<String, ?> loyalty, Instant ordered_at, ByteString unknownFields) { super(ADAPTER, unknownFields); if (phone_number == null) { throw new IllegalArgumentException("phone_number == null"); } this.phone_number = phone_number; if (address == null) { throw new IllegalArgumentException("address == null"); } this.address = address; this.pizzas = Internal.immutableCopyOf("pizzas", pizzas); this.promotion = promotion; this.delivered_within_or_free = delivered_within_or_free; this.loyalty = Internal.immutableCopyOfStruct("loyalty", loyalty); this.ordered_at = ordered_at; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.phone_number = phone_number; builder.address = address; builder.pizzas = Internal.copyOf(pizzas); builder.promotion = promotion; builder.delivered_within_or_free = delivered_within_or_free; builder.loyalty = loyalty; builder.ordered_at = ordered_at; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof PizzaDelivery)) return false; PizzaDelivery o = (PizzaDelivery) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(phone_number, o.phone_number) && Internal.equals(address, o.address) && pizzas.equals(o.pizzas) && Internal.equals(promotion, o.promotion) && Internal.equals(delivered_within_or_free, o.delivered_within_or_free) && Internal.equals(loyalty, o.loyalty) && Internal.equals(ordered_at, o.ordered_at); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (phone_number != null ? phone_number.hashCode() : 0); result = result * 37 + (address != null ? address.hashCode() : 0); result = result * 37 + pizzas.hashCode(); result = result * 37 + (promotion != null ? promotion.hashCode() : 0); result = result * 37 + (delivered_within_or_free != null ? delivered_within_or_free.hashCode() : 0); result = result * 37 + (loyalty != null ? loyalty.hashCode() : 0); result = result * 37 + (ordered_at != null ? ordered_at.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<PizzaDelivery, Builder> { public String phone_number; public String address; public List<Pizza> pizzas; public AnyMessage promotion; public Duration delivered_within_or_free; public Map<String, ?> loyalty; public Instant ordered_at; public Builder() { phone_number = ""; address = ""; pizzas = Internal.newMutableList(); } public Builder phone_number(String phone_number) { this.phone_number = phone_number; return this; } public Builder address(String address) { this.address = address; return this; } public Builder pizzas(List<Pizza> pizzas) { Internal.checkElementsNotNull(pizzas); this.pizzas = pizzas; return this; } public Builder promotion(AnyMessage promotion) { this.promotion = promotion; return this; } public Builder delivered_within_or_free(Duration delivered_within_or_free) { this.delivered_within_or_free = delivered_within_or_free; return this; } public Builder loyalty(Map<String, ?> loyalty) { this.loyalty = loyalty; return this; } public Builder ordered_at(Instant ordered_at) { this.ordered_at = ordered_at; return this; } @Override public PizzaDelivery build() { return new PizzaDelivery(phone_number, address, pizzas, promotion, delivered_within_or_free, loyalty, ordered_at, super.buildUnknownFields()); } } }
7,102
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/All32.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.All32 in all32.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.util.List; import java.util.Map; import okio.ByteString; public final class All32 extends Message<All32, All32.Builder> { public static final ProtoAdapter<All32> ADAPTER = ProtoAdapter.newMessageAdapter(All32.class, "type.googleapis.com/squareup.proto3.All32", Syntax.PROTO_3); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_ONEOF_INT32 = 0; public static final Integer DEFAULT_ONEOF_SFIXED32 = 0; /** * Prefixing so the generated code doesn't rename it weirdly. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.OMIT_IDENTITY, jsonName = "myInt32" ) public final int my_int32; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.OMIT_IDENTITY, jsonName = "myUint32" ) public final int my_uint32; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySint32" ) public final int my_sint32; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.OMIT_IDENTITY, jsonName = "myFixed32" ) public final int my_fixed32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySfixed32" ) public final int my_sfixed32; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED, jsonName = "repInt32" ) public final List<Integer> rep_int32; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED, jsonName = "repUint32" ) public final List<Integer> rep_uint32; @WireField( tag = 203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED, jsonName = "repSint32" ) public final List<Integer> rep_sint32; @WireField( tag = 204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED, jsonName = "repFixed32" ) public final List<Integer> rep_fixed32; @WireField( tag = 205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED, jsonName = "repSfixed32" ) public final List<Integer> rep_sfixed32; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED, jsonName = "packInt32" ) public final List<Integer> pack_int32; @WireField( tag = 302, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED, jsonName = "packUint32" ) public final List<Integer> pack_uint32; @WireField( tag = 303, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED, jsonName = "packSint32" ) public final List<Integer> pack_sint32; @WireField( tag = 304, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED, jsonName = "packFixed32" ) public final List<Integer> pack_fixed32; @WireField( tag = 305, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED, jsonName = "packSfixed32" ) public final List<Integer> pack_sfixed32; @WireField( tag = 501, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32", jsonName = "mapInt32Int32" ) public final Map<Integer, Integer> map_int32_int32; @WireField( tag = 502, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#UINT32", jsonName = "mapInt32Uint32" ) public final Map<Integer, Integer> map_int32_uint32; @WireField( tag = 503, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#SINT32", jsonName = "mapInt32Sint32" ) public final Map<Integer, Integer> map_int32_sint32; @WireField( tag = 504, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#FIXED32", jsonName = "mapInt32Fixed32" ) public final Map<Integer, Integer> map_int32_fixed32; @WireField( tag = 505, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", jsonName = "mapInt32Sfixed32" ) public final Map<Integer, Integer> map_int32_sfixed32; @WireField( tag = 401, adapter = "com.squareup.wire.ProtoAdapter#INT32", jsonName = "oneofInt32", oneofName = "choice" ) public final Integer oneof_int32; @WireField( tag = 402, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", jsonName = "oneofSfixed32", oneofName = "choice" ) public final Integer oneof_sfixed32; public All32(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_int32, builder.oneof_sfixed32) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_int32, builder.oneof_sfixed32 may be non-null"); } this.my_int32 = builder.my_int32; this.my_uint32 = builder.my_uint32; this.my_sint32 = builder.my_sint32; this.my_fixed32 = builder.my_fixed32; this.my_sfixed32 = builder.my_sfixed32; this.rep_int32 = Internal.immutableCopyOf("rep_int32", builder.rep_int32); this.rep_uint32 = Internal.immutableCopyOf("rep_uint32", builder.rep_uint32); this.rep_sint32 = Internal.immutableCopyOf("rep_sint32", builder.rep_sint32); this.rep_fixed32 = Internal.immutableCopyOf("rep_fixed32", builder.rep_fixed32); this.rep_sfixed32 = Internal.immutableCopyOf("rep_sfixed32", builder.rep_sfixed32); this.pack_int32 = Internal.immutableCopyOf("pack_int32", builder.pack_int32); this.pack_uint32 = Internal.immutableCopyOf("pack_uint32", builder.pack_uint32); this.pack_sint32 = Internal.immutableCopyOf("pack_sint32", builder.pack_sint32); this.pack_fixed32 = Internal.immutableCopyOf("pack_fixed32", builder.pack_fixed32); this.pack_sfixed32 = Internal.immutableCopyOf("pack_sfixed32", builder.pack_sfixed32); this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", builder.map_int32_int32); this.map_int32_uint32 = Internal.immutableCopyOf("map_int32_uint32", builder.map_int32_uint32); this.map_int32_sint32 = Internal.immutableCopyOf("map_int32_sint32", builder.map_int32_sint32); this.map_int32_fixed32 = Internal.immutableCopyOf("map_int32_fixed32", builder.map_int32_fixed32); this.map_int32_sfixed32 = Internal.immutableCopyOf("map_int32_sfixed32", builder.map_int32_sfixed32); this.oneof_int32 = builder.oneof_int32; this.oneof_sfixed32 = builder.oneof_sfixed32; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.my_int32 = my_int32; builder.my_uint32 = my_uint32; builder.my_sint32 = my_sint32; builder.my_fixed32 = my_fixed32; builder.my_sfixed32 = my_sfixed32; builder.rep_int32 = Internal.copyOf(rep_int32); builder.rep_uint32 = Internal.copyOf(rep_uint32); builder.rep_sint32 = Internal.copyOf(rep_sint32); builder.rep_fixed32 = Internal.copyOf(rep_fixed32); builder.rep_sfixed32 = Internal.copyOf(rep_sfixed32); builder.pack_int32 = Internal.copyOf(pack_int32); builder.pack_uint32 = Internal.copyOf(pack_uint32); builder.pack_sint32 = Internal.copyOf(pack_sint32); builder.pack_fixed32 = Internal.copyOf(pack_fixed32); builder.pack_sfixed32 = Internal.copyOf(pack_sfixed32); builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.map_int32_uint32 = Internal.copyOf(map_int32_uint32); builder.map_int32_sint32 = Internal.copyOf(map_int32_sint32); builder.map_int32_fixed32 = Internal.copyOf(map_int32_fixed32); builder.map_int32_sfixed32 = Internal.copyOf(map_int32_sfixed32); builder.oneof_int32 = oneof_int32; builder.oneof_sfixed32 = oneof_sfixed32; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof All32)) return false; All32 o = (All32) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(my_int32, o.my_int32) && Internal.equals(my_uint32, o.my_uint32) && Internal.equals(my_sint32, o.my_sint32) && Internal.equals(my_fixed32, o.my_fixed32) && Internal.equals(my_sfixed32, o.my_sfixed32) && rep_int32.equals(o.rep_int32) && rep_uint32.equals(o.rep_uint32) && rep_sint32.equals(o.rep_sint32) && rep_fixed32.equals(o.rep_fixed32) && rep_sfixed32.equals(o.rep_sfixed32) && pack_int32.equals(o.pack_int32) && pack_uint32.equals(o.pack_uint32) && pack_sint32.equals(o.pack_sint32) && pack_fixed32.equals(o.pack_fixed32) && pack_sfixed32.equals(o.pack_sfixed32) && map_int32_int32.equals(o.map_int32_int32) && map_int32_uint32.equals(o.map_int32_uint32) && map_int32_sint32.equals(o.map_int32_sint32) && map_int32_fixed32.equals(o.map_int32_fixed32) && map_int32_sfixed32.equals(o.map_int32_sfixed32) && Internal.equals(oneof_int32, o.oneof_int32) && Internal.equals(oneof_sfixed32, o.oneof_sfixed32); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + Integer.hashCode(my_int32); result = result * 37 + Integer.hashCode(my_uint32); result = result * 37 + Integer.hashCode(my_sint32); result = result * 37 + Integer.hashCode(my_fixed32); result = result * 37 + Integer.hashCode(my_sfixed32); result = result * 37 + rep_int32.hashCode(); result = result * 37 + rep_uint32.hashCode(); result = result * 37 + rep_sint32.hashCode(); result = result * 37 + rep_fixed32.hashCode(); result = result * 37 + rep_sfixed32.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + pack_uint32.hashCode(); result = result * 37 + pack_sint32.hashCode(); result = result * 37 + pack_fixed32.hashCode(); result = result * 37 + pack_sfixed32.hashCode(); result = result * 37 + map_int32_int32.hashCode(); result = result * 37 + map_int32_uint32.hashCode(); result = result * 37 + map_int32_sint32.hashCode(); result = result * 37 + map_int32_fixed32.hashCode(); result = result * 37 + map_int32_sfixed32.hashCode(); result = result * 37 + (oneof_int32 != null ? oneof_int32.hashCode() : 0); result = result * 37 + (oneof_sfixed32 != null ? oneof_sfixed32.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<All32, Builder> { public int my_int32; public int my_uint32; public int my_sint32; public int my_fixed32; public int my_sfixed32; public List<Integer> rep_int32; public List<Integer> rep_uint32; public List<Integer> rep_sint32; public List<Integer> rep_fixed32; public List<Integer> rep_sfixed32; public List<Integer> pack_int32; public List<Integer> pack_uint32; public List<Integer> pack_sint32; public List<Integer> pack_fixed32; public List<Integer> pack_sfixed32; public Map<Integer, Integer> map_int32_int32; public Map<Integer, Integer> map_int32_uint32; public Map<Integer, Integer> map_int32_sint32; public Map<Integer, Integer> map_int32_fixed32; public Map<Integer, Integer> map_int32_sfixed32; public Integer oneof_int32; public Integer oneof_sfixed32; public Builder() { my_int32 = 0; my_uint32 = 0; my_sint32 = 0; my_fixed32 = 0; my_sfixed32 = 0; rep_int32 = Internal.newMutableList(); rep_uint32 = Internal.newMutableList(); rep_sint32 = Internal.newMutableList(); rep_fixed32 = Internal.newMutableList(); rep_sfixed32 = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); pack_uint32 = Internal.newMutableList(); pack_sint32 = Internal.newMutableList(); pack_fixed32 = Internal.newMutableList(); pack_sfixed32 = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); map_int32_uint32 = Internal.newMutableMap(); map_int32_sint32 = Internal.newMutableMap(); map_int32_fixed32 = Internal.newMutableMap(); map_int32_sfixed32 = Internal.newMutableMap(); } /** * Prefixing so the generated code doesn't rename it weirdly. */ public Builder my_int32(int my_int32) { this.my_int32 = my_int32; return this; } public Builder my_uint32(int my_uint32) { this.my_uint32 = my_uint32; return this; } public Builder my_sint32(int my_sint32) { this.my_sint32 = my_sint32; return this; } public Builder my_fixed32(int my_fixed32) { this.my_fixed32 = my_fixed32; return this; } public Builder my_sfixed32(int my_sfixed32) { this.my_sfixed32 = my_sfixed32; return this; } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder rep_uint32(List<Integer> rep_uint32) { Internal.checkElementsNotNull(rep_uint32); this.rep_uint32 = rep_uint32; return this; } public Builder rep_sint32(List<Integer> rep_sint32) { Internal.checkElementsNotNull(rep_sint32); this.rep_sint32 = rep_sint32; return this; } public Builder rep_fixed32(List<Integer> rep_fixed32) { Internal.checkElementsNotNull(rep_fixed32); this.rep_fixed32 = rep_fixed32; return this; } public Builder rep_sfixed32(List<Integer> rep_sfixed32) { Internal.checkElementsNotNull(rep_sfixed32); this.rep_sfixed32 = rep_sfixed32; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder pack_uint32(List<Integer> pack_uint32) { Internal.checkElementsNotNull(pack_uint32); this.pack_uint32 = pack_uint32; return this; } public Builder pack_sint32(List<Integer> pack_sint32) { Internal.checkElementsNotNull(pack_sint32); this.pack_sint32 = pack_sint32; return this; } public Builder pack_fixed32(List<Integer> pack_fixed32) { Internal.checkElementsNotNull(pack_fixed32); this.pack_fixed32 = pack_fixed32; return this; } public Builder pack_sfixed32(List<Integer> pack_sfixed32) { Internal.checkElementsNotNull(pack_sfixed32); this.pack_sfixed32 = pack_sfixed32; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } public Builder map_int32_uint32(Map<Integer, Integer> map_int32_uint32) { Internal.checkElementsNotNull(map_int32_uint32); this.map_int32_uint32 = map_int32_uint32; return this; } public Builder map_int32_sint32(Map<Integer, Integer> map_int32_sint32) { Internal.checkElementsNotNull(map_int32_sint32); this.map_int32_sint32 = map_int32_sint32; return this; } public Builder map_int32_fixed32(Map<Integer, Integer> map_int32_fixed32) { Internal.checkElementsNotNull(map_int32_fixed32); this.map_int32_fixed32 = map_int32_fixed32; return this; } public Builder map_int32_sfixed32(Map<Integer, Integer> map_int32_sfixed32) { Internal.checkElementsNotNull(map_int32_sfixed32); this.map_int32_sfixed32 = map_int32_sfixed32; return this; } public Builder oneof_int32(Integer oneof_int32) { this.oneof_int32 = oneof_int32; this.oneof_sfixed32 = null; return this; } public Builder oneof_sfixed32(Integer oneof_sfixed32) { this.oneof_sfixed32 = oneof_sfixed32; this.oneof_int32 = null; return this; } @Override public All32 build() { return new All32(this, super.buildUnknownFields()); } } }
7,103
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/FreeGarlicBreadPromotion.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.FreeGarlicBreadPromotion in pizza.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Boolean; import java.lang.Object; import java.lang.Override; import okio.ByteString; public final class FreeGarlicBreadPromotion extends Message<FreeGarlicBreadPromotion, FreeGarlicBreadPromotion.Builder> { public static final ProtoAdapter<FreeGarlicBreadPromotion> ADAPTER = ProtoAdapter.newMessageAdapter(FreeGarlicBreadPromotion.class, "type.googleapis.com/squareup.proto3.FreeGarlicBreadPromotion", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.OMIT_IDENTITY, jsonName = "isExtraCheesey" ) public final boolean is_extra_cheesey; public FreeGarlicBreadPromotion(boolean is_extra_cheesey) { this(is_extra_cheesey, ByteString.EMPTY); } public FreeGarlicBreadPromotion(boolean is_extra_cheesey, ByteString unknownFields) { super(ADAPTER, unknownFields); this.is_extra_cheesey = is_extra_cheesey; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.is_extra_cheesey = is_extra_cheesey; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof FreeGarlicBreadPromotion)) return false; FreeGarlicBreadPromotion o = (FreeGarlicBreadPromotion) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(is_extra_cheesey, o.is_extra_cheesey); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + Boolean.hashCode(is_extra_cheesey); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<FreeGarlicBreadPromotion, Builder> { public boolean is_extra_cheesey; public Builder() { is_extra_cheesey = false; } public Builder is_extra_cheesey(boolean is_extra_cheesey) { this.is_extra_cheesey = is_extra_cheesey; return this; } @Override public FreeGarlicBreadPromotion build() { return new FreeGarlicBreadPromotion(is_extra_cheesey, super.buildUnknownFields()); } } }
7,104
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/Pizza.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.Pizza in pizza.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.List; import okio.ByteString; public final class Pizza extends Message<Pizza, Pizza.Builder> { public static final ProtoAdapter<Pizza> ADAPTER = ProtoAdapter.newMessageAdapter(Pizza.class, "type.googleapis.com/squareup.proto3.Pizza", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> toppings; public Pizza(List<String> toppings) { this(toppings, ByteString.EMPTY); } public Pizza(List<String> toppings, ByteString unknownFields) { super(ADAPTER, unknownFields); this.toppings = Internal.immutableCopyOf("toppings", toppings); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.toppings = Internal.copyOf(toppings); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Pizza)) return false; Pizza o = (Pizza) other; return unknownFields().equals(o.unknownFields()) && toppings.equals(o.toppings); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + toppings.hashCode(); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<Pizza, Builder> { public List<String> toppings; public Builder() { toppings = Internal.newMutableList(); } public Builder toppings(List<String> toppings) { Internal.checkElementsNotNull(toppings); this.toppings = toppings; return this; } @Override public Pizza build() { return new Pizza(toppings, super.buildUnknownFields()); } } }
7,105
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/BuyOneGetOnePromotion.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.BuyOneGetOnePromotion in pizza.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Object; import java.lang.Override; import java.lang.String; import okio.ByteString; public final class BuyOneGetOnePromotion extends Message<BuyOneGetOnePromotion, BuyOneGetOnePromotion.Builder> { public static final ProtoAdapter<BuyOneGetOnePromotion> ADAPTER = ProtoAdapter.newMessageAdapter(BuyOneGetOnePromotion.class, "type.googleapis.com/squareup.proto3.BuyOneGetOnePromotion", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.OMIT_IDENTITY ) public final String coupon; public BuyOneGetOnePromotion(String coupon) { this(coupon, ByteString.EMPTY); } public BuyOneGetOnePromotion(String coupon, ByteString unknownFields) { super(ADAPTER, unknownFields); if (coupon == null) { throw new IllegalArgumentException("coupon == null"); } this.coupon = coupon; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.coupon = coupon; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof BuyOneGetOnePromotion)) return false; BuyOneGetOnePromotion o = (BuyOneGetOnePromotion) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(coupon, o.coupon); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (coupon != null ? coupon.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<BuyOneGetOnePromotion, Builder> { public String coupon; public Builder() { coupon = ""; } public Builder coupon(String coupon) { this.coupon = coupon; return this; } @Override public BuyOneGetOnePromotion build() { return new BuyOneGetOnePromotion(coupon, super.buildUnknownFields()); } } }
7,106
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/All64.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.All64 in all64.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.util.List; import java.util.Map; import okio.ByteString; public final class All64 extends Message<All64, All64.Builder> { public static final ProtoAdapter<All64> ADAPTER = ProtoAdapter.newMessageAdapter(All64.class, "type.googleapis.com/squareup.proto3.All64", Syntax.PROTO_3); private static final long serialVersionUID = 0L; public static final Long DEFAULT_ONEOF_INT64 = 0L; public static final Long DEFAULT_ONEOF_SFIXED64 = 0L; /** * Prefixing so the generated code doesn't rename it weirdly. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.OMIT_IDENTITY, jsonName = "myInt64" ) public final long my_int64; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.OMIT_IDENTITY, jsonName = "myUint64" ) public final long my_uint64; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySint64" ) public final long my_sint64; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.OMIT_IDENTITY, jsonName = "myFixed64" ) public final long my_fixed64; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySfixed64" ) public final long my_sfixed64; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED, jsonName = "repInt64" ) public final List<Long> rep_int64; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED, jsonName = "repUint64" ) public final List<Long> rep_uint64; @WireField( tag = 203, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED, jsonName = "repSint64" ) public final List<Long> rep_sint64; @WireField( tag = 204, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED, jsonName = "repFixed64" ) public final List<Long> rep_fixed64; @WireField( tag = 205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED, jsonName = "repSfixed64" ) public final List<Long> rep_sfixed64; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED, jsonName = "packInt64" ) public final List<Long> pack_int64; @WireField( tag = 302, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED, jsonName = "packUint64" ) public final List<Long> pack_uint64; @WireField( tag = 303, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED, jsonName = "packSint64" ) public final List<Long> pack_sint64; @WireField( tag = 304, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED, jsonName = "packFixed64" ) public final List<Long> pack_fixed64; @WireField( tag = 305, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED, jsonName = "packSfixed64" ) public final List<Long> pack_sfixed64; @WireField( tag = 501, keyAdapter = "com.squareup.wire.ProtoAdapter#INT64", adapter = "com.squareup.wire.ProtoAdapter#INT64", jsonName = "mapInt64Int64" ) public final Map<Long, Long> map_int64_int64; @WireField( tag = 502, keyAdapter = "com.squareup.wire.ProtoAdapter#INT64", adapter = "com.squareup.wire.ProtoAdapter#UINT64", jsonName = "mapInt64Uint64" ) public final Map<Long, Long> map_int64_uint64; @WireField( tag = 503, keyAdapter = "com.squareup.wire.ProtoAdapter#INT64", adapter = "com.squareup.wire.ProtoAdapter#SINT64", jsonName = "mapInt64Sint64" ) public final Map<Long, Long> map_int64_sint64; @WireField( tag = 504, keyAdapter = "com.squareup.wire.ProtoAdapter#INT64", adapter = "com.squareup.wire.ProtoAdapter#FIXED64", jsonName = "mapInt64Fixed64" ) public final Map<Long, Long> map_int64_fixed64; @WireField( tag = 505, keyAdapter = "com.squareup.wire.ProtoAdapter#INT64", adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", jsonName = "mapInt64Sfixed64" ) public final Map<Long, Long> map_int64_sfixed64; @WireField( tag = 401, adapter = "com.squareup.wire.ProtoAdapter#INT64", jsonName = "oneofInt64", oneofName = "choice" ) public final Long oneof_int64; @WireField( tag = 402, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", jsonName = "oneofSfixed64", oneofName = "choice" ) public final Long oneof_sfixed64; public All64(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_int64, builder.oneof_sfixed64) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_int64, builder.oneof_sfixed64 may be non-null"); } this.my_int64 = builder.my_int64; this.my_uint64 = builder.my_uint64; this.my_sint64 = builder.my_sint64; this.my_fixed64 = builder.my_fixed64; this.my_sfixed64 = builder.my_sfixed64; this.rep_int64 = Internal.immutableCopyOf("rep_int64", builder.rep_int64); this.rep_uint64 = Internal.immutableCopyOf("rep_uint64", builder.rep_uint64); this.rep_sint64 = Internal.immutableCopyOf("rep_sint64", builder.rep_sint64); this.rep_fixed64 = Internal.immutableCopyOf("rep_fixed64", builder.rep_fixed64); this.rep_sfixed64 = Internal.immutableCopyOf("rep_sfixed64", builder.rep_sfixed64); this.pack_int64 = Internal.immutableCopyOf("pack_int64", builder.pack_int64); this.pack_uint64 = Internal.immutableCopyOf("pack_uint64", builder.pack_uint64); this.pack_sint64 = Internal.immutableCopyOf("pack_sint64", builder.pack_sint64); this.pack_fixed64 = Internal.immutableCopyOf("pack_fixed64", builder.pack_fixed64); this.pack_sfixed64 = Internal.immutableCopyOf("pack_sfixed64", builder.pack_sfixed64); this.map_int64_int64 = Internal.immutableCopyOf("map_int64_int64", builder.map_int64_int64); this.map_int64_uint64 = Internal.immutableCopyOf("map_int64_uint64", builder.map_int64_uint64); this.map_int64_sint64 = Internal.immutableCopyOf("map_int64_sint64", builder.map_int64_sint64); this.map_int64_fixed64 = Internal.immutableCopyOf("map_int64_fixed64", builder.map_int64_fixed64); this.map_int64_sfixed64 = Internal.immutableCopyOf("map_int64_sfixed64", builder.map_int64_sfixed64); this.oneof_int64 = builder.oneof_int64; this.oneof_sfixed64 = builder.oneof_sfixed64; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.my_int64 = my_int64; builder.my_uint64 = my_uint64; builder.my_sint64 = my_sint64; builder.my_fixed64 = my_fixed64; builder.my_sfixed64 = my_sfixed64; builder.rep_int64 = Internal.copyOf(rep_int64); builder.rep_uint64 = Internal.copyOf(rep_uint64); builder.rep_sint64 = Internal.copyOf(rep_sint64); builder.rep_fixed64 = Internal.copyOf(rep_fixed64); builder.rep_sfixed64 = Internal.copyOf(rep_sfixed64); builder.pack_int64 = Internal.copyOf(pack_int64); builder.pack_uint64 = Internal.copyOf(pack_uint64); builder.pack_sint64 = Internal.copyOf(pack_sint64); builder.pack_fixed64 = Internal.copyOf(pack_fixed64); builder.pack_sfixed64 = Internal.copyOf(pack_sfixed64); builder.map_int64_int64 = Internal.copyOf(map_int64_int64); builder.map_int64_uint64 = Internal.copyOf(map_int64_uint64); builder.map_int64_sint64 = Internal.copyOf(map_int64_sint64); builder.map_int64_fixed64 = Internal.copyOf(map_int64_fixed64); builder.map_int64_sfixed64 = Internal.copyOf(map_int64_sfixed64); builder.oneof_int64 = oneof_int64; builder.oneof_sfixed64 = oneof_sfixed64; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof All64)) return false; All64 o = (All64) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(my_int64, o.my_int64) && Internal.equals(my_uint64, o.my_uint64) && Internal.equals(my_sint64, o.my_sint64) && Internal.equals(my_fixed64, o.my_fixed64) && Internal.equals(my_sfixed64, o.my_sfixed64) && rep_int64.equals(o.rep_int64) && rep_uint64.equals(o.rep_uint64) && rep_sint64.equals(o.rep_sint64) && rep_fixed64.equals(o.rep_fixed64) && rep_sfixed64.equals(o.rep_sfixed64) && pack_int64.equals(o.pack_int64) && pack_uint64.equals(o.pack_uint64) && pack_sint64.equals(o.pack_sint64) && pack_fixed64.equals(o.pack_fixed64) && pack_sfixed64.equals(o.pack_sfixed64) && map_int64_int64.equals(o.map_int64_int64) && map_int64_uint64.equals(o.map_int64_uint64) && map_int64_sint64.equals(o.map_int64_sint64) && map_int64_fixed64.equals(o.map_int64_fixed64) && map_int64_sfixed64.equals(o.map_int64_sfixed64) && Internal.equals(oneof_int64, o.oneof_int64) && Internal.equals(oneof_sfixed64, o.oneof_sfixed64); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + Long.hashCode(my_int64); result = result * 37 + Long.hashCode(my_uint64); result = result * 37 + Long.hashCode(my_sint64); result = result * 37 + Long.hashCode(my_fixed64); result = result * 37 + Long.hashCode(my_sfixed64); result = result * 37 + rep_int64.hashCode(); result = result * 37 + rep_uint64.hashCode(); result = result * 37 + rep_sint64.hashCode(); result = result * 37 + rep_fixed64.hashCode(); result = result * 37 + rep_sfixed64.hashCode(); result = result * 37 + pack_int64.hashCode(); result = result * 37 + pack_uint64.hashCode(); result = result * 37 + pack_sint64.hashCode(); result = result * 37 + pack_fixed64.hashCode(); result = result * 37 + pack_sfixed64.hashCode(); result = result * 37 + map_int64_int64.hashCode(); result = result * 37 + map_int64_uint64.hashCode(); result = result * 37 + map_int64_sint64.hashCode(); result = result * 37 + map_int64_fixed64.hashCode(); result = result * 37 + map_int64_sfixed64.hashCode(); result = result * 37 + (oneof_int64 != null ? oneof_int64.hashCode() : 0); result = result * 37 + (oneof_sfixed64 != null ? oneof_sfixed64.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<All64, Builder> { public long my_int64; public long my_uint64; public long my_sint64; public long my_fixed64; public long my_sfixed64; public List<Long> rep_int64; public List<Long> rep_uint64; public List<Long> rep_sint64; public List<Long> rep_fixed64; public List<Long> rep_sfixed64; public List<Long> pack_int64; public List<Long> pack_uint64; public List<Long> pack_sint64; public List<Long> pack_fixed64; public List<Long> pack_sfixed64; public Map<Long, Long> map_int64_int64; public Map<Long, Long> map_int64_uint64; public Map<Long, Long> map_int64_sint64; public Map<Long, Long> map_int64_fixed64; public Map<Long, Long> map_int64_sfixed64; public Long oneof_int64; public Long oneof_sfixed64; public Builder() { my_int64 = 0L; my_uint64 = 0L; my_sint64 = 0L; my_fixed64 = 0L; my_sfixed64 = 0L; rep_int64 = Internal.newMutableList(); rep_uint64 = Internal.newMutableList(); rep_sint64 = Internal.newMutableList(); rep_fixed64 = Internal.newMutableList(); rep_sfixed64 = Internal.newMutableList(); pack_int64 = Internal.newMutableList(); pack_uint64 = Internal.newMutableList(); pack_sint64 = Internal.newMutableList(); pack_fixed64 = Internal.newMutableList(); pack_sfixed64 = Internal.newMutableList(); map_int64_int64 = Internal.newMutableMap(); map_int64_uint64 = Internal.newMutableMap(); map_int64_sint64 = Internal.newMutableMap(); map_int64_fixed64 = Internal.newMutableMap(); map_int64_sfixed64 = Internal.newMutableMap(); } /** * Prefixing so the generated code doesn't rename it weirdly. */ public Builder my_int64(long my_int64) { this.my_int64 = my_int64; return this; } public Builder my_uint64(long my_uint64) { this.my_uint64 = my_uint64; return this; } public Builder my_sint64(long my_sint64) { this.my_sint64 = my_sint64; return this; } public Builder my_fixed64(long my_fixed64) { this.my_fixed64 = my_fixed64; return this; } public Builder my_sfixed64(long my_sfixed64) { this.my_sfixed64 = my_sfixed64; return this; } public Builder rep_int64(List<Long> rep_int64) { Internal.checkElementsNotNull(rep_int64); this.rep_int64 = rep_int64; return this; } public Builder rep_uint64(List<Long> rep_uint64) { Internal.checkElementsNotNull(rep_uint64); this.rep_uint64 = rep_uint64; return this; } public Builder rep_sint64(List<Long> rep_sint64) { Internal.checkElementsNotNull(rep_sint64); this.rep_sint64 = rep_sint64; return this; } public Builder rep_fixed64(List<Long> rep_fixed64) { Internal.checkElementsNotNull(rep_fixed64); this.rep_fixed64 = rep_fixed64; return this; } public Builder rep_sfixed64(List<Long> rep_sfixed64) { Internal.checkElementsNotNull(rep_sfixed64); this.rep_sfixed64 = rep_sfixed64; return this; } public Builder pack_int64(List<Long> pack_int64) { Internal.checkElementsNotNull(pack_int64); this.pack_int64 = pack_int64; return this; } public Builder pack_uint64(List<Long> pack_uint64) { Internal.checkElementsNotNull(pack_uint64); this.pack_uint64 = pack_uint64; return this; } public Builder pack_sint64(List<Long> pack_sint64) { Internal.checkElementsNotNull(pack_sint64); this.pack_sint64 = pack_sint64; return this; } public Builder pack_fixed64(List<Long> pack_fixed64) { Internal.checkElementsNotNull(pack_fixed64); this.pack_fixed64 = pack_fixed64; return this; } public Builder pack_sfixed64(List<Long> pack_sfixed64) { Internal.checkElementsNotNull(pack_sfixed64); this.pack_sfixed64 = pack_sfixed64; return this; } public Builder map_int64_int64(Map<Long, Long> map_int64_int64) { Internal.checkElementsNotNull(map_int64_int64); this.map_int64_int64 = map_int64_int64; return this; } public Builder map_int64_uint64(Map<Long, Long> map_int64_uint64) { Internal.checkElementsNotNull(map_int64_uint64); this.map_int64_uint64 = map_int64_uint64; return this; } public Builder map_int64_sint64(Map<Long, Long> map_int64_sint64) { Internal.checkElementsNotNull(map_int64_sint64); this.map_int64_sint64 = map_int64_sint64; return this; } public Builder map_int64_fixed64(Map<Long, Long> map_int64_fixed64) { Internal.checkElementsNotNull(map_int64_fixed64); this.map_int64_fixed64 = map_int64_fixed64; return this; } public Builder map_int64_sfixed64(Map<Long, Long> map_int64_sfixed64) { Internal.checkElementsNotNull(map_int64_sfixed64); this.map_int64_sfixed64 = map_int64_sfixed64; return this; } public Builder oneof_int64(Long oneof_int64) { this.oneof_int64 = oneof_int64; this.oneof_sfixed64 = null; return this; } public Builder oneof_sfixed64(Long oneof_sfixed64) { this.oneof_sfixed64 = oneof_sfixed64; this.oneof_int64 = null; return this; } @Override public All64 build() { return new All64(this, super.buildUnknownFields()); } } }
7,107
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/squareup/proto3/MapTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.MapTypes in map_types.proto package squareup.proto3; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Integer; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.Map; import okio.ByteString; public final class MapTypes extends Message<MapTypes, MapTypes.Builder> { public static final ProtoAdapter<MapTypes> ADAPTER = ProtoAdapter.newMessageAdapter(MapTypes.class, "type.googleapis.com/squareup.proto3.MapTypes", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING", jsonName = "mapStringString" ) public final Map<String, String> map_string_string; @WireField( tag = 2, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32", jsonName = "mapInt32Int32" ) public final Map<Integer, Integer> map_int32_int32; @WireField( tag = 3, keyAdapter = "com.squareup.wire.ProtoAdapter#SINT32", adapter = "com.squareup.wire.ProtoAdapter#SINT32", jsonName = "mapSint32Sint32" ) public final Map<Integer, Integer> map_sint32_sint32; @WireField( tag = 4, keyAdapter = "com.squareup.wire.ProtoAdapter#SFIXED32", adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", jsonName = "mapSfixed32Sfixed32" ) public final Map<Integer, Integer> map_sfixed32_sfixed32; @WireField( tag = 5, keyAdapter = "com.squareup.wire.ProtoAdapter#FIXED32", adapter = "com.squareup.wire.ProtoAdapter#FIXED32", jsonName = "mapFixed32Fixed32" ) public final Map<Integer, Integer> map_fixed32_fixed32; @WireField( tag = 6, keyAdapter = "com.squareup.wire.ProtoAdapter#UINT32", adapter = "com.squareup.wire.ProtoAdapter#UINT32", jsonName = "mapUint32Uint32" ) public final Map<Integer, Integer> map_uint32_uint32; @WireField( tag = 7, keyAdapter = "com.squareup.wire.ProtoAdapter#INT64", adapter = "com.squareup.wire.ProtoAdapter#INT64", jsonName = "mapInt64Int64" ) public final Map<Long, Long> map_int64_int64; @WireField( tag = 8, keyAdapter = "com.squareup.wire.ProtoAdapter#SFIXED64", adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", jsonName = "mapSfixed64Sfixed64" ) public final Map<Long, Long> map_sfixed64_sfixed64; @WireField( tag = 9, keyAdapter = "com.squareup.wire.ProtoAdapter#SINT64", adapter = "com.squareup.wire.ProtoAdapter#SINT64", jsonName = "mapSint64Sint64" ) public final Map<Long, Long> map_sint64_sint64; @WireField( tag = 10, keyAdapter = "com.squareup.wire.ProtoAdapter#FIXED64", adapter = "com.squareup.wire.ProtoAdapter#FIXED64", jsonName = "mapFixed64Fixed64" ) public final Map<Long, Long> map_fixed64_fixed64; @WireField( tag = 11, keyAdapter = "com.squareup.wire.ProtoAdapter#UINT64", adapter = "com.squareup.wire.ProtoAdapter#UINT64", jsonName = "mapUint64Uint64" ) public final Map<Long, Long> map_uint64_uint64; public MapTypes(Map<String, String> map_string_string, Map<Integer, Integer> map_int32_int32, Map<Integer, Integer> map_sint32_sint32, Map<Integer, Integer> map_sfixed32_sfixed32, Map<Integer, Integer> map_fixed32_fixed32, Map<Integer, Integer> map_uint32_uint32, Map<Long, Long> map_int64_int64, Map<Long, Long> map_sfixed64_sfixed64, Map<Long, Long> map_sint64_sint64, Map<Long, Long> map_fixed64_fixed64, Map<Long, Long> map_uint64_uint64) { this(map_string_string, map_int32_int32, map_sint32_sint32, map_sfixed32_sfixed32, map_fixed32_fixed32, map_uint32_uint32, map_int64_int64, map_sfixed64_sfixed64, map_sint64_sint64, map_fixed64_fixed64, map_uint64_uint64, ByteString.EMPTY); } public MapTypes(Map<String, String> map_string_string, Map<Integer, Integer> map_int32_int32, Map<Integer, Integer> map_sint32_sint32, Map<Integer, Integer> map_sfixed32_sfixed32, Map<Integer, Integer> map_fixed32_fixed32, Map<Integer, Integer> map_uint32_uint32, Map<Long, Long> map_int64_int64, Map<Long, Long> map_sfixed64_sfixed64, Map<Long, Long> map_sint64_sint64, Map<Long, Long> map_fixed64_fixed64, Map<Long, Long> map_uint64_uint64, ByteString unknownFields) { super(ADAPTER, unknownFields); this.map_string_string = Internal.immutableCopyOf("map_string_string", map_string_string); this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", map_int32_int32); this.map_sint32_sint32 = Internal.immutableCopyOf("map_sint32_sint32", map_sint32_sint32); this.map_sfixed32_sfixed32 = Internal.immutableCopyOf("map_sfixed32_sfixed32", map_sfixed32_sfixed32); this.map_fixed32_fixed32 = Internal.immutableCopyOf("map_fixed32_fixed32", map_fixed32_fixed32); this.map_uint32_uint32 = Internal.immutableCopyOf("map_uint32_uint32", map_uint32_uint32); this.map_int64_int64 = Internal.immutableCopyOf("map_int64_int64", map_int64_int64); this.map_sfixed64_sfixed64 = Internal.immutableCopyOf("map_sfixed64_sfixed64", map_sfixed64_sfixed64); this.map_sint64_sint64 = Internal.immutableCopyOf("map_sint64_sint64", map_sint64_sint64); this.map_fixed64_fixed64 = Internal.immutableCopyOf("map_fixed64_fixed64", map_fixed64_fixed64); this.map_uint64_uint64 = Internal.immutableCopyOf("map_uint64_uint64", map_uint64_uint64); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.map_string_string = Internal.copyOf(map_string_string); builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.map_sint32_sint32 = Internal.copyOf(map_sint32_sint32); builder.map_sfixed32_sfixed32 = Internal.copyOf(map_sfixed32_sfixed32); builder.map_fixed32_fixed32 = Internal.copyOf(map_fixed32_fixed32); builder.map_uint32_uint32 = Internal.copyOf(map_uint32_uint32); builder.map_int64_int64 = Internal.copyOf(map_int64_int64); builder.map_sfixed64_sfixed64 = Internal.copyOf(map_sfixed64_sfixed64); builder.map_sint64_sint64 = Internal.copyOf(map_sint64_sint64); builder.map_fixed64_fixed64 = Internal.copyOf(map_fixed64_fixed64); builder.map_uint64_uint64 = Internal.copyOf(map_uint64_uint64); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof MapTypes)) return false; MapTypes o = (MapTypes) other; return unknownFields().equals(o.unknownFields()) && map_string_string.equals(o.map_string_string) && map_int32_int32.equals(o.map_int32_int32) && map_sint32_sint32.equals(o.map_sint32_sint32) && map_sfixed32_sfixed32.equals(o.map_sfixed32_sfixed32) && map_fixed32_fixed32.equals(o.map_fixed32_fixed32) && map_uint32_uint32.equals(o.map_uint32_uint32) && map_int64_int64.equals(o.map_int64_int64) && map_sfixed64_sfixed64.equals(o.map_sfixed64_sfixed64) && map_sint64_sint64.equals(o.map_sint64_sint64) && map_fixed64_fixed64.equals(o.map_fixed64_fixed64) && map_uint64_uint64.equals(o.map_uint64_uint64); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + map_string_string.hashCode(); result = result * 37 + map_int32_int32.hashCode(); result = result * 37 + map_sint32_sint32.hashCode(); result = result * 37 + map_sfixed32_sfixed32.hashCode(); result = result * 37 + map_fixed32_fixed32.hashCode(); result = result * 37 + map_uint32_uint32.hashCode(); result = result * 37 + map_int64_int64.hashCode(); result = result * 37 + map_sfixed64_sfixed64.hashCode(); result = result * 37 + map_sint64_sint64.hashCode(); result = result * 37 + map_fixed64_fixed64.hashCode(); result = result * 37 + map_uint64_uint64.hashCode(); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<MapTypes, Builder> { public Map<String, String> map_string_string; public Map<Integer, Integer> map_int32_int32; public Map<Integer, Integer> map_sint32_sint32; public Map<Integer, Integer> map_sfixed32_sfixed32; public Map<Integer, Integer> map_fixed32_fixed32; public Map<Integer, Integer> map_uint32_uint32; public Map<Long, Long> map_int64_int64; public Map<Long, Long> map_sfixed64_sfixed64; public Map<Long, Long> map_sint64_sint64; public Map<Long, Long> map_fixed64_fixed64; public Map<Long, Long> map_uint64_uint64; public Builder() { map_string_string = Internal.newMutableMap(); map_int32_int32 = Internal.newMutableMap(); map_sint32_sint32 = Internal.newMutableMap(); map_sfixed32_sfixed32 = Internal.newMutableMap(); map_fixed32_fixed32 = Internal.newMutableMap(); map_uint32_uint32 = Internal.newMutableMap(); map_int64_int64 = Internal.newMutableMap(); map_sfixed64_sfixed64 = Internal.newMutableMap(); map_sint64_sint64 = Internal.newMutableMap(); map_fixed64_fixed64 = Internal.newMutableMap(); map_uint64_uint64 = Internal.newMutableMap(); } public Builder map_string_string(Map<String, String> map_string_string) { Internal.checkElementsNotNull(map_string_string); this.map_string_string = map_string_string; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } public Builder map_sint32_sint32(Map<Integer, Integer> map_sint32_sint32) { Internal.checkElementsNotNull(map_sint32_sint32); this.map_sint32_sint32 = map_sint32_sint32; return this; } public Builder map_sfixed32_sfixed32(Map<Integer, Integer> map_sfixed32_sfixed32) { Internal.checkElementsNotNull(map_sfixed32_sfixed32); this.map_sfixed32_sfixed32 = map_sfixed32_sfixed32; return this; } public Builder map_fixed32_fixed32(Map<Integer, Integer> map_fixed32_fixed32) { Internal.checkElementsNotNull(map_fixed32_fixed32); this.map_fixed32_fixed32 = map_fixed32_fixed32; return this; } public Builder map_uint32_uint32(Map<Integer, Integer> map_uint32_uint32) { Internal.checkElementsNotNull(map_uint32_uint32); this.map_uint32_uint32 = map_uint32_uint32; return this; } public Builder map_int64_int64(Map<Long, Long> map_int64_int64) { Internal.checkElementsNotNull(map_int64_int64); this.map_int64_int64 = map_int64_int64; return this; } public Builder map_sfixed64_sfixed64(Map<Long, Long> map_sfixed64_sfixed64) { Internal.checkElementsNotNull(map_sfixed64_sfixed64); this.map_sfixed64_sfixed64 = map_sfixed64_sfixed64; return this; } public Builder map_sint64_sint64(Map<Long, Long> map_sint64_sint64) { Internal.checkElementsNotNull(map_sint64_sint64); this.map_sint64_sint64 = map_sint64_sint64; return this; } public Builder map_fixed64_fixed64(Map<Long, Long> map_fixed64_fixed64) { Internal.checkElementsNotNull(map_fixed64_fixed64); this.map_fixed64_fixed64 = map_fixed64_fixed64; return this; } public Builder map_uint64_uint64(Map<Long, Long> map_uint64_uint64) { Internal.checkElementsNotNull(map_uint64_uint64); this.map_uint64_uint64 = map_uint64_uint64; return this; } @Override public MapTypes build() { return new MapTypes(map_string_string, map_int32_int32, map_sint32_sint32, map_sfixed32_sfixed32, map_fixed32_fixed32, map_uint32_uint32, map_int64_int64, map_sfixed64_sfixed64, map_sint64_sint64, map_fixed64_fixed64, map_uint64_uint64, super.buildUnknownFields()); } } }
7,108
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/com/squareup/wire/proto2
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/com/squareup/wire/proto2/alltypes/AllTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.AllTypes in all_types_proto2.proto package com.squareup.wire.proto2.alltypes; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Boolean; import java.lang.Double; import java.lang.Float; import java.lang.Integer; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.List; import java.util.Map; import okio.ByteString; public final class AllTypes extends Message<AllTypes, AllTypes.Builder> { public static final ProtoAdapter<AllTypes> ADAPTER = ProtoAdapter.newMessageAdapter(AllTypes.class, "type.googleapis.com/squareup.proto2.AllTypes", Syntax.PROTO_2); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OPT_INT32 = 0; public static final Integer DEFAULT_OPT_UINT32 = 0; public static final Integer DEFAULT_OPT_SINT32 = 0; public static final Integer DEFAULT_OPT_FIXED32 = 0; public static final Integer DEFAULT_OPT_SFIXED32 = 0; public static final Long DEFAULT_OPT_INT64 = 0L; public static final Long DEFAULT_OPT_UINT64 = 0L; public static final Long DEFAULT_OPT_SINT64 = 0L; public static final Long DEFAULT_OPT_FIXED64 = 0L; public static final Long DEFAULT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_OPT_BOOL = false; public static final Float DEFAULT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_OPT_STRING = ""; public static final ByteString DEFAULT_OPT_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_OPT_NESTED_ENUM = NestedEnum.UNKNOWN; public static final Integer DEFAULT_REQ_INT32 = 0; public static final Integer DEFAULT_REQ_UINT32 = 0; public static final Integer DEFAULT_REQ_SINT32 = 0; public static final Integer DEFAULT_REQ_FIXED32 = 0; public static final Integer DEFAULT_REQ_SFIXED32 = 0; public static final Long DEFAULT_REQ_INT64 = 0L; public static final Long DEFAULT_REQ_UINT64 = 0L; public static final Long DEFAULT_REQ_SINT64 = 0L; public static final Long DEFAULT_REQ_FIXED64 = 0L; public static final Long DEFAULT_REQ_SFIXED64 = 0L; public static final Boolean DEFAULT_REQ_BOOL = false; public static final Float DEFAULT_REQ_FLOAT = 0.0f; public static final Double DEFAULT_REQ_DOUBLE = 0.0d; public static final String DEFAULT_REQ_STRING = ""; public static final ByteString DEFAULT_REQ_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_REQ_NESTED_ENUM = NestedEnum.UNKNOWN; public static final Integer DEFAULT_DEFAULT_INT32 = 2147483647; public static final Integer DEFAULT_DEFAULT_UINT32 = -1; public static final Integer DEFAULT_DEFAULT_SINT32 = -2147483648; public static final Integer DEFAULT_DEFAULT_FIXED32 = -1; public static final Integer DEFAULT_DEFAULT_SFIXED32 = -2147483648; public static final Long DEFAULT_DEFAULT_INT64 = 9223372036854775807L; public static final Long DEFAULT_DEFAULT_UINT64 = -1L; public static final Long DEFAULT_DEFAULT_SINT64 = -9223372036854775808L; public static final Long DEFAULT_DEFAULT_FIXED64 = -1L; public static final Long DEFAULT_DEFAULT_SFIXED64 = -9223372036854775808L; public static final Boolean DEFAULT_DEFAULT_BOOL = true; public static final Float DEFAULT_DEFAULT_FLOAT = 123.456e7f; public static final Double DEFAULT_DEFAULT_DOUBLE = 123.456e78d; public static final String DEFAULT_DEFAULT_STRING = "çok\u0007\b\f\n" + "\r\t\u000b\u0001\u0001\u0001\u000f\u000f~\u0001\u0001\u0011\u0001\u0001\u0011güzel"; public static final ByteString DEFAULT_DEFAULT_BYTES = ByteString.decodeBase64("529rBwgMCg0JCwEBAQ8PfgEBEQEBEWf8emVs"); public static final NestedEnum DEFAULT_DEFAULT_NESTED_ENUM = NestedEnum.A; public static final Integer DEFAULT_EXT_OPT_INT32 = 0; public static final Integer DEFAULT_EXT_OPT_UINT32 = 0; public static final Integer DEFAULT_EXT_OPT_SINT32 = 0; public static final Integer DEFAULT_EXT_OPT_FIXED32 = 0; public static final Integer DEFAULT_EXT_OPT_SFIXED32 = 0; public static final Long DEFAULT_EXT_OPT_INT64 = 0L; public static final Long DEFAULT_EXT_OPT_UINT64 = 0L; public static final Long DEFAULT_EXT_OPT_SINT64 = 0L; public static final Long DEFAULT_EXT_OPT_FIXED64 = 0L; public static final Long DEFAULT_EXT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_EXT_OPT_BOOL = false; public static final Float DEFAULT_EXT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_EXT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_EXT_OPT_STRING = ""; public static final ByteString DEFAULT_EXT_OPT_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_EXT_OPT_NESTED_ENUM = NestedEnum.UNKNOWN; public static final String DEFAULT_ONEOF_STRING = ""; public static final Integer DEFAULT_ONEOF_INT32 = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer opt_int32; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer opt_uint32; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer opt_sint32; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer opt_fixed32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer opt_sfixed32; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long opt_int64; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long opt_uint64; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long opt_sint64; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long opt_fixed64; @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long opt_sfixed64; @WireField( tag = 11, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean opt_bool; @WireField( tag = 12, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float opt_float; @WireField( tag = 13, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double opt_double; @WireField( tag = 14, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String opt_string; @WireField( tag = 15, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString opt_bytes; @WireField( tag = 16, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum opt_nested_enum; @WireField( tag = 17, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage opt_nested_message; @WireField( tag = 101, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer req_int32; @WireField( tag = 102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REQUIRED ) public final Integer req_uint32; @WireField( tag = 103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REQUIRED ) public final Integer req_sint32; @WireField( tag = 104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REQUIRED ) public final Integer req_fixed32; @WireField( tag = 105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REQUIRED ) public final Integer req_sfixed32; @WireField( tag = 106, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REQUIRED ) public final Long req_int64; @WireField( tag = 107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REQUIRED ) public final Long req_uint64; @WireField( tag = 108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REQUIRED ) public final Long req_sint64; @WireField( tag = 109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REQUIRED ) public final Long req_fixed64; @WireField( tag = 110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REQUIRED ) public final Long req_sfixed64; @WireField( tag = 111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REQUIRED ) public final Boolean req_bool; @WireField( tag = 112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REQUIRED ) public final Float req_float; @WireField( tag = 113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REQUIRED ) public final Double req_double; @WireField( tag = 114, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String req_string; @WireField( tag = 115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REQUIRED ) public final ByteString req_bytes; @WireField( tag = 116, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedEnum req_nested_enum; @WireField( tag = 117, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedMessage req_nested_message; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_int32; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_uint32; @WireField( tag = 203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_sint32; @WireField( tag = 204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED ) public final List<Integer> rep_fixed32; @WireField( tag = 205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED ) public final List<Integer> rep_sfixed32; @WireField( tag = 206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED ) public final List<Long> rep_int64; @WireField( tag = 207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED ) public final List<Long> rep_uint64; @WireField( tag = 208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED ) public final List<Long> rep_sint64; @WireField( tag = 209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED ) public final List<Long> rep_fixed64; @WireField( tag = 210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED ) public final List<Long> rep_sfixed64; @WireField( tag = 211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED ) public final List<Boolean> rep_bool; @WireField( tag = 212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> rep_float; @WireField( tag = 213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) public final List<Double> rep_double; @WireField( tag = 214, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> rep_string; @WireField( tag = 215, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED ) public final List<ByteString> rep_bytes; @WireField( tag = 216, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> rep_nested_enum; @WireField( tag = 217, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> rep_nested_message; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> pack_int32; @WireField( tag = 302, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED ) public final List<Integer> pack_uint32; @WireField( tag = 303, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED ) public final List<Integer> pack_sint32; @WireField( tag = 304, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED ) public final List<Integer> pack_fixed32; @WireField( tag = 305, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED ) public final List<Integer> pack_sfixed32; @WireField( tag = 306, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED ) public final List<Long> pack_int64; @WireField( tag = 307, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED ) public final List<Long> pack_uint64; @WireField( tag = 308, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED ) public final List<Long> pack_sint64; @WireField( tag = 309, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED ) public final List<Long> pack_fixed64; @WireField( tag = 310, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED ) public final List<Long> pack_sfixed64; @WireField( tag = 311, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED ) public final List<Boolean> pack_bool; @WireField( tag = 312, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED ) public final List<Float> pack_float; @WireField( tag = 313, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED ) public final List<Double> pack_double; @WireField( tag = 316, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> pack_nested_enum; @WireField( tag = 401, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer default_int32; @WireField( tag = 402, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer default_uint32; @WireField( tag = 403, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer default_sint32; @WireField( tag = 404, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer default_fixed32; @WireField( tag = 405, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer default_sfixed32; @WireField( tag = 406, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long default_int64; @WireField( tag = 407, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long default_uint64; @WireField( tag = 408, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long default_sint64; @WireField( tag = 409, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long default_fixed64; @WireField( tag = 410, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long default_sfixed64; @WireField( tag = 411, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean default_bool; @WireField( tag = 412, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float default_float; @WireField( tag = 413, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double default_double; @WireField( tag = 414, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String default_string; @WireField( tag = 415, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString default_bytes; @WireField( tag = 416, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum default_nested_enum; @WireField( tag = 501, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Map<Integer, Integer> map_int32_int32; @WireField( tag = 502, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final Map<String, String> map_string_string; @WireField( tag = 503, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final Map<String, NestedMessage> map_string_message; @WireField( tag = 504, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final Map<String, NestedEnum> map_string_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1001, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer ext_opt_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1002, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer ext_opt_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1003, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer ext_opt_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1004, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer ext_opt_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1005, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer ext_opt_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1006, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long ext_opt_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1007, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long ext_opt_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1008, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long ext_opt_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1009, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long ext_opt_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1010, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long ext_opt_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1011, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean ext_opt_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1012, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float ext_opt_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1013, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double ext_opt_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1014, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String ext_opt_string; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1015, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString ext_opt_bytes; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1016, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum ext_opt_nested_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1017, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage ext_opt_nested_message; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1101, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1106, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED ) public final List<Boolean> ext_rep_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> ext_rep_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) public final List<Double> ext_rep_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1114, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> ext_rep_string; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED ) public final List<ByteString> ext_rep_bytes; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1116, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> ext_rep_nested_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1117, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> ext_rep_nested_message; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED ) public final List<Boolean> ext_pack_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED ) public final List<Float> ext_pack_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED ) public final List<Double> ext_pack_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1216, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> ext_pack_nested_enum; @WireField( tag = 601, adapter = "com.squareup.wire.ProtoAdapter#STRING", oneofName = "choice" ) public final String oneof_string; @WireField( tag = 602, adapter = "com.squareup.wire.ProtoAdapter#INT32", oneofName = "choice" ) public final Integer oneof_int32; @WireField( tag = 603, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", oneofName = "choice" ) public final NestedMessage oneof_nested_message; public AllTypes(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message may be non-null"); } this.opt_int32 = builder.opt_int32; this.opt_uint32 = builder.opt_uint32; this.opt_sint32 = builder.opt_sint32; this.opt_fixed32 = builder.opt_fixed32; this.opt_sfixed32 = builder.opt_sfixed32; this.opt_int64 = builder.opt_int64; this.opt_uint64 = builder.opt_uint64; this.opt_sint64 = builder.opt_sint64; this.opt_fixed64 = builder.opt_fixed64; this.opt_sfixed64 = builder.opt_sfixed64; this.opt_bool = builder.opt_bool; this.opt_float = builder.opt_float; this.opt_double = builder.opt_double; this.opt_string = builder.opt_string; this.opt_bytes = builder.opt_bytes; this.opt_nested_enum = builder.opt_nested_enum; this.opt_nested_message = builder.opt_nested_message; this.req_int32 = builder.req_int32; this.req_uint32 = builder.req_uint32; this.req_sint32 = builder.req_sint32; this.req_fixed32 = builder.req_fixed32; this.req_sfixed32 = builder.req_sfixed32; this.req_int64 = builder.req_int64; this.req_uint64 = builder.req_uint64; this.req_sint64 = builder.req_sint64; this.req_fixed64 = builder.req_fixed64; this.req_sfixed64 = builder.req_sfixed64; this.req_bool = builder.req_bool; this.req_float = builder.req_float; this.req_double = builder.req_double; this.req_string = builder.req_string; this.req_bytes = builder.req_bytes; this.req_nested_enum = builder.req_nested_enum; this.req_nested_message = builder.req_nested_message; this.rep_int32 = Internal.immutableCopyOf("rep_int32", builder.rep_int32); this.rep_uint32 = Internal.immutableCopyOf("rep_uint32", builder.rep_uint32); this.rep_sint32 = Internal.immutableCopyOf("rep_sint32", builder.rep_sint32); this.rep_fixed32 = Internal.immutableCopyOf("rep_fixed32", builder.rep_fixed32); this.rep_sfixed32 = Internal.immutableCopyOf("rep_sfixed32", builder.rep_sfixed32); this.rep_int64 = Internal.immutableCopyOf("rep_int64", builder.rep_int64); this.rep_uint64 = Internal.immutableCopyOf("rep_uint64", builder.rep_uint64); this.rep_sint64 = Internal.immutableCopyOf("rep_sint64", builder.rep_sint64); this.rep_fixed64 = Internal.immutableCopyOf("rep_fixed64", builder.rep_fixed64); this.rep_sfixed64 = Internal.immutableCopyOf("rep_sfixed64", builder.rep_sfixed64); this.rep_bool = Internal.immutableCopyOf("rep_bool", builder.rep_bool); this.rep_float = Internal.immutableCopyOf("rep_float", builder.rep_float); this.rep_double = Internal.immutableCopyOf("rep_double", builder.rep_double); this.rep_string = Internal.immutableCopyOf("rep_string", builder.rep_string); this.rep_bytes = Internal.immutableCopyOf("rep_bytes", builder.rep_bytes); this.rep_nested_enum = Internal.immutableCopyOf("rep_nested_enum", builder.rep_nested_enum); this.rep_nested_message = Internal.immutableCopyOf("rep_nested_message", builder.rep_nested_message); this.pack_int32 = Internal.immutableCopyOf("pack_int32", builder.pack_int32); this.pack_uint32 = Internal.immutableCopyOf("pack_uint32", builder.pack_uint32); this.pack_sint32 = Internal.immutableCopyOf("pack_sint32", builder.pack_sint32); this.pack_fixed32 = Internal.immutableCopyOf("pack_fixed32", builder.pack_fixed32); this.pack_sfixed32 = Internal.immutableCopyOf("pack_sfixed32", builder.pack_sfixed32); this.pack_int64 = Internal.immutableCopyOf("pack_int64", builder.pack_int64); this.pack_uint64 = Internal.immutableCopyOf("pack_uint64", builder.pack_uint64); this.pack_sint64 = Internal.immutableCopyOf("pack_sint64", builder.pack_sint64); this.pack_fixed64 = Internal.immutableCopyOf("pack_fixed64", builder.pack_fixed64); this.pack_sfixed64 = Internal.immutableCopyOf("pack_sfixed64", builder.pack_sfixed64); this.pack_bool = Internal.immutableCopyOf("pack_bool", builder.pack_bool); this.pack_float = Internal.immutableCopyOf("pack_float", builder.pack_float); this.pack_double = Internal.immutableCopyOf("pack_double", builder.pack_double); this.pack_nested_enum = Internal.immutableCopyOf("pack_nested_enum", builder.pack_nested_enum); this.default_int32 = builder.default_int32; this.default_uint32 = builder.default_uint32; this.default_sint32 = builder.default_sint32; this.default_fixed32 = builder.default_fixed32; this.default_sfixed32 = builder.default_sfixed32; this.default_int64 = builder.default_int64; this.default_uint64 = builder.default_uint64; this.default_sint64 = builder.default_sint64; this.default_fixed64 = builder.default_fixed64; this.default_sfixed64 = builder.default_sfixed64; this.default_bool = builder.default_bool; this.default_float = builder.default_float; this.default_double = builder.default_double; this.default_string = builder.default_string; this.default_bytes = builder.default_bytes; this.default_nested_enum = builder.default_nested_enum; this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", builder.map_int32_int32); this.map_string_string = Internal.immutableCopyOf("map_string_string", builder.map_string_string); this.map_string_message = Internal.immutableCopyOf("map_string_message", builder.map_string_message); this.map_string_enum = Internal.immutableCopyOf("map_string_enum", builder.map_string_enum); this.ext_opt_int32 = builder.ext_opt_int32; this.ext_opt_uint32 = builder.ext_opt_uint32; this.ext_opt_sint32 = builder.ext_opt_sint32; this.ext_opt_fixed32 = builder.ext_opt_fixed32; this.ext_opt_sfixed32 = builder.ext_opt_sfixed32; this.ext_opt_int64 = builder.ext_opt_int64; this.ext_opt_uint64 = builder.ext_opt_uint64; this.ext_opt_sint64 = builder.ext_opt_sint64; this.ext_opt_fixed64 = builder.ext_opt_fixed64; this.ext_opt_sfixed64 = builder.ext_opt_sfixed64; this.ext_opt_bool = builder.ext_opt_bool; this.ext_opt_float = builder.ext_opt_float; this.ext_opt_double = builder.ext_opt_double; this.ext_opt_string = builder.ext_opt_string; this.ext_opt_bytes = builder.ext_opt_bytes; this.ext_opt_nested_enum = builder.ext_opt_nested_enum; this.ext_opt_nested_message = builder.ext_opt_nested_message; this.ext_rep_int32 = Internal.immutableCopyOf("ext_rep_int32", builder.ext_rep_int32); this.ext_rep_uint32 = Internal.immutableCopyOf("ext_rep_uint32", builder.ext_rep_uint32); this.ext_rep_sint32 = Internal.immutableCopyOf("ext_rep_sint32", builder.ext_rep_sint32); this.ext_rep_fixed32 = Internal.immutableCopyOf("ext_rep_fixed32", builder.ext_rep_fixed32); this.ext_rep_sfixed32 = Internal.immutableCopyOf("ext_rep_sfixed32", builder.ext_rep_sfixed32); this.ext_rep_int64 = Internal.immutableCopyOf("ext_rep_int64", builder.ext_rep_int64); this.ext_rep_uint64 = Internal.immutableCopyOf("ext_rep_uint64", builder.ext_rep_uint64); this.ext_rep_sint64 = Internal.immutableCopyOf("ext_rep_sint64", builder.ext_rep_sint64); this.ext_rep_fixed64 = Internal.immutableCopyOf("ext_rep_fixed64", builder.ext_rep_fixed64); this.ext_rep_sfixed64 = Internal.immutableCopyOf("ext_rep_sfixed64", builder.ext_rep_sfixed64); this.ext_rep_bool = Internal.immutableCopyOf("ext_rep_bool", builder.ext_rep_bool); this.ext_rep_float = Internal.immutableCopyOf("ext_rep_float", builder.ext_rep_float); this.ext_rep_double = Internal.immutableCopyOf("ext_rep_double", builder.ext_rep_double); this.ext_rep_string = Internal.immutableCopyOf("ext_rep_string", builder.ext_rep_string); this.ext_rep_bytes = Internal.immutableCopyOf("ext_rep_bytes", builder.ext_rep_bytes); this.ext_rep_nested_enum = Internal.immutableCopyOf("ext_rep_nested_enum", builder.ext_rep_nested_enum); this.ext_rep_nested_message = Internal.immutableCopyOf("ext_rep_nested_message", builder.ext_rep_nested_message); this.ext_pack_int32 = Internal.immutableCopyOf("ext_pack_int32", builder.ext_pack_int32); this.ext_pack_uint32 = Internal.immutableCopyOf("ext_pack_uint32", builder.ext_pack_uint32); this.ext_pack_sint32 = Internal.immutableCopyOf("ext_pack_sint32", builder.ext_pack_sint32); this.ext_pack_fixed32 = Internal.immutableCopyOf("ext_pack_fixed32", builder.ext_pack_fixed32); this.ext_pack_sfixed32 = Internal.immutableCopyOf("ext_pack_sfixed32", builder.ext_pack_sfixed32); this.ext_pack_int64 = Internal.immutableCopyOf("ext_pack_int64", builder.ext_pack_int64); this.ext_pack_uint64 = Internal.immutableCopyOf("ext_pack_uint64", builder.ext_pack_uint64); this.ext_pack_sint64 = Internal.immutableCopyOf("ext_pack_sint64", builder.ext_pack_sint64); this.ext_pack_fixed64 = Internal.immutableCopyOf("ext_pack_fixed64", builder.ext_pack_fixed64); this.ext_pack_sfixed64 = Internal.immutableCopyOf("ext_pack_sfixed64", builder.ext_pack_sfixed64); this.ext_pack_bool = Internal.immutableCopyOf("ext_pack_bool", builder.ext_pack_bool); this.ext_pack_float = Internal.immutableCopyOf("ext_pack_float", builder.ext_pack_float); this.ext_pack_double = Internal.immutableCopyOf("ext_pack_double", builder.ext_pack_double); this.ext_pack_nested_enum = Internal.immutableCopyOf("ext_pack_nested_enum", builder.ext_pack_nested_enum); this.oneof_string = builder.oneof_string; this.oneof_int32 = builder.oneof_int32; this.oneof_nested_message = builder.oneof_nested_message; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.opt_int32 = opt_int32; builder.opt_uint32 = opt_uint32; builder.opt_sint32 = opt_sint32; builder.opt_fixed32 = opt_fixed32; builder.opt_sfixed32 = opt_sfixed32; builder.opt_int64 = opt_int64; builder.opt_uint64 = opt_uint64; builder.opt_sint64 = opt_sint64; builder.opt_fixed64 = opt_fixed64; builder.opt_sfixed64 = opt_sfixed64; builder.opt_bool = opt_bool; builder.opt_float = opt_float; builder.opt_double = opt_double; builder.opt_string = opt_string; builder.opt_bytes = opt_bytes; builder.opt_nested_enum = opt_nested_enum; builder.opt_nested_message = opt_nested_message; builder.req_int32 = req_int32; builder.req_uint32 = req_uint32; builder.req_sint32 = req_sint32; builder.req_fixed32 = req_fixed32; builder.req_sfixed32 = req_sfixed32; builder.req_int64 = req_int64; builder.req_uint64 = req_uint64; builder.req_sint64 = req_sint64; builder.req_fixed64 = req_fixed64; builder.req_sfixed64 = req_sfixed64; builder.req_bool = req_bool; builder.req_float = req_float; builder.req_double = req_double; builder.req_string = req_string; builder.req_bytes = req_bytes; builder.req_nested_enum = req_nested_enum; builder.req_nested_message = req_nested_message; builder.rep_int32 = Internal.copyOf(rep_int32); builder.rep_uint32 = Internal.copyOf(rep_uint32); builder.rep_sint32 = Internal.copyOf(rep_sint32); builder.rep_fixed32 = Internal.copyOf(rep_fixed32); builder.rep_sfixed32 = Internal.copyOf(rep_sfixed32); builder.rep_int64 = Internal.copyOf(rep_int64); builder.rep_uint64 = Internal.copyOf(rep_uint64); builder.rep_sint64 = Internal.copyOf(rep_sint64); builder.rep_fixed64 = Internal.copyOf(rep_fixed64); builder.rep_sfixed64 = Internal.copyOf(rep_sfixed64); builder.rep_bool = Internal.copyOf(rep_bool); builder.rep_float = Internal.copyOf(rep_float); builder.rep_double = Internal.copyOf(rep_double); builder.rep_string = Internal.copyOf(rep_string); builder.rep_bytes = Internal.copyOf(rep_bytes); builder.rep_nested_enum = Internal.copyOf(rep_nested_enum); builder.rep_nested_message = Internal.copyOf(rep_nested_message); builder.pack_int32 = Internal.copyOf(pack_int32); builder.pack_uint32 = Internal.copyOf(pack_uint32); builder.pack_sint32 = Internal.copyOf(pack_sint32); builder.pack_fixed32 = Internal.copyOf(pack_fixed32); builder.pack_sfixed32 = Internal.copyOf(pack_sfixed32); builder.pack_int64 = Internal.copyOf(pack_int64); builder.pack_uint64 = Internal.copyOf(pack_uint64); builder.pack_sint64 = Internal.copyOf(pack_sint64); builder.pack_fixed64 = Internal.copyOf(pack_fixed64); builder.pack_sfixed64 = Internal.copyOf(pack_sfixed64); builder.pack_bool = Internal.copyOf(pack_bool); builder.pack_float = Internal.copyOf(pack_float); builder.pack_double = Internal.copyOf(pack_double); builder.pack_nested_enum = Internal.copyOf(pack_nested_enum); builder.default_int32 = default_int32; builder.default_uint32 = default_uint32; builder.default_sint32 = default_sint32; builder.default_fixed32 = default_fixed32; builder.default_sfixed32 = default_sfixed32; builder.default_int64 = default_int64; builder.default_uint64 = default_uint64; builder.default_sint64 = default_sint64; builder.default_fixed64 = default_fixed64; builder.default_sfixed64 = default_sfixed64; builder.default_bool = default_bool; builder.default_float = default_float; builder.default_double = default_double; builder.default_string = default_string; builder.default_bytes = default_bytes; builder.default_nested_enum = default_nested_enum; builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.map_string_string = Internal.copyOf(map_string_string); builder.map_string_message = Internal.copyOf(map_string_message); builder.map_string_enum = Internal.copyOf(map_string_enum); builder.ext_opt_int32 = ext_opt_int32; builder.ext_opt_uint32 = ext_opt_uint32; builder.ext_opt_sint32 = ext_opt_sint32; builder.ext_opt_fixed32 = ext_opt_fixed32; builder.ext_opt_sfixed32 = ext_opt_sfixed32; builder.ext_opt_int64 = ext_opt_int64; builder.ext_opt_uint64 = ext_opt_uint64; builder.ext_opt_sint64 = ext_opt_sint64; builder.ext_opt_fixed64 = ext_opt_fixed64; builder.ext_opt_sfixed64 = ext_opt_sfixed64; builder.ext_opt_bool = ext_opt_bool; builder.ext_opt_float = ext_opt_float; builder.ext_opt_double = ext_opt_double; builder.ext_opt_string = ext_opt_string; builder.ext_opt_bytes = ext_opt_bytes; builder.ext_opt_nested_enum = ext_opt_nested_enum; builder.ext_opt_nested_message = ext_opt_nested_message; builder.ext_rep_int32 = Internal.copyOf(ext_rep_int32); builder.ext_rep_uint32 = Internal.copyOf(ext_rep_uint32); builder.ext_rep_sint32 = Internal.copyOf(ext_rep_sint32); builder.ext_rep_fixed32 = Internal.copyOf(ext_rep_fixed32); builder.ext_rep_sfixed32 = Internal.copyOf(ext_rep_sfixed32); builder.ext_rep_int64 = Internal.copyOf(ext_rep_int64); builder.ext_rep_uint64 = Internal.copyOf(ext_rep_uint64); builder.ext_rep_sint64 = Internal.copyOf(ext_rep_sint64); builder.ext_rep_fixed64 = Internal.copyOf(ext_rep_fixed64); builder.ext_rep_sfixed64 = Internal.copyOf(ext_rep_sfixed64); builder.ext_rep_bool = Internal.copyOf(ext_rep_bool); builder.ext_rep_float = Internal.copyOf(ext_rep_float); builder.ext_rep_double = Internal.copyOf(ext_rep_double); builder.ext_rep_string = Internal.copyOf(ext_rep_string); builder.ext_rep_bytes = Internal.copyOf(ext_rep_bytes); builder.ext_rep_nested_enum = Internal.copyOf(ext_rep_nested_enum); builder.ext_rep_nested_message = Internal.copyOf(ext_rep_nested_message); builder.ext_pack_int32 = Internal.copyOf(ext_pack_int32); builder.ext_pack_uint32 = Internal.copyOf(ext_pack_uint32); builder.ext_pack_sint32 = Internal.copyOf(ext_pack_sint32); builder.ext_pack_fixed32 = Internal.copyOf(ext_pack_fixed32); builder.ext_pack_sfixed32 = Internal.copyOf(ext_pack_sfixed32); builder.ext_pack_int64 = Internal.copyOf(ext_pack_int64); builder.ext_pack_uint64 = Internal.copyOf(ext_pack_uint64); builder.ext_pack_sint64 = Internal.copyOf(ext_pack_sint64); builder.ext_pack_fixed64 = Internal.copyOf(ext_pack_fixed64); builder.ext_pack_sfixed64 = Internal.copyOf(ext_pack_sfixed64); builder.ext_pack_bool = Internal.copyOf(ext_pack_bool); builder.ext_pack_float = Internal.copyOf(ext_pack_float); builder.ext_pack_double = Internal.copyOf(ext_pack_double); builder.ext_pack_nested_enum = Internal.copyOf(ext_pack_nested_enum); builder.oneof_string = oneof_string; builder.oneof_int32 = oneof_int32; builder.oneof_nested_message = oneof_nested_message; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof AllTypes)) return false; AllTypes o = (AllTypes) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(opt_int32, o.opt_int32) && Internal.equals(opt_uint32, o.opt_uint32) && Internal.equals(opt_sint32, o.opt_sint32) && Internal.equals(opt_fixed32, o.opt_fixed32) && Internal.equals(opt_sfixed32, o.opt_sfixed32) && Internal.equals(opt_int64, o.opt_int64) && Internal.equals(opt_uint64, o.opt_uint64) && Internal.equals(opt_sint64, o.opt_sint64) && Internal.equals(opt_fixed64, o.opt_fixed64) && Internal.equals(opt_sfixed64, o.opt_sfixed64) && Internal.equals(opt_bool, o.opt_bool) && Internal.equals(opt_float, o.opt_float) && Internal.equals(opt_double, o.opt_double) && Internal.equals(opt_string, o.opt_string) && Internal.equals(opt_bytes, o.opt_bytes) && Internal.equals(opt_nested_enum, o.opt_nested_enum) && Internal.equals(opt_nested_message, o.opt_nested_message) && req_int32.equals(o.req_int32) && req_uint32.equals(o.req_uint32) && req_sint32.equals(o.req_sint32) && req_fixed32.equals(o.req_fixed32) && req_sfixed32.equals(o.req_sfixed32) && req_int64.equals(o.req_int64) && req_uint64.equals(o.req_uint64) && req_sint64.equals(o.req_sint64) && req_fixed64.equals(o.req_fixed64) && req_sfixed64.equals(o.req_sfixed64) && req_bool.equals(o.req_bool) && req_float.equals(o.req_float) && req_double.equals(o.req_double) && req_string.equals(o.req_string) && req_bytes.equals(o.req_bytes) && req_nested_enum.equals(o.req_nested_enum) && req_nested_message.equals(o.req_nested_message) && rep_int32.equals(o.rep_int32) && rep_uint32.equals(o.rep_uint32) && rep_sint32.equals(o.rep_sint32) && rep_fixed32.equals(o.rep_fixed32) && rep_sfixed32.equals(o.rep_sfixed32) && rep_int64.equals(o.rep_int64) && rep_uint64.equals(o.rep_uint64) && rep_sint64.equals(o.rep_sint64) && rep_fixed64.equals(o.rep_fixed64) && rep_sfixed64.equals(o.rep_sfixed64) && rep_bool.equals(o.rep_bool) && rep_float.equals(o.rep_float) && rep_double.equals(o.rep_double) && rep_string.equals(o.rep_string) && rep_bytes.equals(o.rep_bytes) && rep_nested_enum.equals(o.rep_nested_enum) && rep_nested_message.equals(o.rep_nested_message) && pack_int32.equals(o.pack_int32) && pack_uint32.equals(o.pack_uint32) && pack_sint32.equals(o.pack_sint32) && pack_fixed32.equals(o.pack_fixed32) && pack_sfixed32.equals(o.pack_sfixed32) && pack_int64.equals(o.pack_int64) && pack_uint64.equals(o.pack_uint64) && pack_sint64.equals(o.pack_sint64) && pack_fixed64.equals(o.pack_fixed64) && pack_sfixed64.equals(o.pack_sfixed64) && pack_bool.equals(o.pack_bool) && pack_float.equals(o.pack_float) && pack_double.equals(o.pack_double) && pack_nested_enum.equals(o.pack_nested_enum) && Internal.equals(default_int32, o.default_int32) && Internal.equals(default_uint32, o.default_uint32) && Internal.equals(default_sint32, o.default_sint32) && Internal.equals(default_fixed32, o.default_fixed32) && Internal.equals(default_sfixed32, o.default_sfixed32) && Internal.equals(default_int64, o.default_int64) && Internal.equals(default_uint64, o.default_uint64) && Internal.equals(default_sint64, o.default_sint64) && Internal.equals(default_fixed64, o.default_fixed64) && Internal.equals(default_sfixed64, o.default_sfixed64) && Internal.equals(default_bool, o.default_bool) && Internal.equals(default_float, o.default_float) && Internal.equals(default_double, o.default_double) && Internal.equals(default_string, o.default_string) && Internal.equals(default_bytes, o.default_bytes) && Internal.equals(default_nested_enum, o.default_nested_enum) && map_int32_int32.equals(o.map_int32_int32) && map_string_string.equals(o.map_string_string) && map_string_message.equals(o.map_string_message) && map_string_enum.equals(o.map_string_enum) && Internal.equals(ext_opt_int32, o.ext_opt_int32) && Internal.equals(ext_opt_uint32, o.ext_opt_uint32) && Internal.equals(ext_opt_sint32, o.ext_opt_sint32) && Internal.equals(ext_opt_fixed32, o.ext_opt_fixed32) && Internal.equals(ext_opt_sfixed32, o.ext_opt_sfixed32) && Internal.equals(ext_opt_int64, o.ext_opt_int64) && Internal.equals(ext_opt_uint64, o.ext_opt_uint64) && Internal.equals(ext_opt_sint64, o.ext_opt_sint64) && Internal.equals(ext_opt_fixed64, o.ext_opt_fixed64) && Internal.equals(ext_opt_sfixed64, o.ext_opt_sfixed64) && Internal.equals(ext_opt_bool, o.ext_opt_bool) && Internal.equals(ext_opt_float, o.ext_opt_float) && Internal.equals(ext_opt_double, o.ext_opt_double) && Internal.equals(ext_opt_string, o.ext_opt_string) && Internal.equals(ext_opt_bytes, o.ext_opt_bytes) && Internal.equals(ext_opt_nested_enum, o.ext_opt_nested_enum) && Internal.equals(ext_opt_nested_message, o.ext_opt_nested_message) && ext_rep_int32.equals(o.ext_rep_int32) && ext_rep_uint32.equals(o.ext_rep_uint32) && ext_rep_sint32.equals(o.ext_rep_sint32) && ext_rep_fixed32.equals(o.ext_rep_fixed32) && ext_rep_sfixed32.equals(o.ext_rep_sfixed32) && ext_rep_int64.equals(o.ext_rep_int64) && ext_rep_uint64.equals(o.ext_rep_uint64) && ext_rep_sint64.equals(o.ext_rep_sint64) && ext_rep_fixed64.equals(o.ext_rep_fixed64) && ext_rep_sfixed64.equals(o.ext_rep_sfixed64) && ext_rep_bool.equals(o.ext_rep_bool) && ext_rep_float.equals(o.ext_rep_float) && ext_rep_double.equals(o.ext_rep_double) && ext_rep_string.equals(o.ext_rep_string) && ext_rep_bytes.equals(o.ext_rep_bytes) && ext_rep_nested_enum.equals(o.ext_rep_nested_enum) && ext_rep_nested_message.equals(o.ext_rep_nested_message) && ext_pack_int32.equals(o.ext_pack_int32) && ext_pack_uint32.equals(o.ext_pack_uint32) && ext_pack_sint32.equals(o.ext_pack_sint32) && ext_pack_fixed32.equals(o.ext_pack_fixed32) && ext_pack_sfixed32.equals(o.ext_pack_sfixed32) && ext_pack_int64.equals(o.ext_pack_int64) && ext_pack_uint64.equals(o.ext_pack_uint64) && ext_pack_sint64.equals(o.ext_pack_sint64) && ext_pack_fixed64.equals(o.ext_pack_fixed64) && ext_pack_sfixed64.equals(o.ext_pack_sfixed64) && ext_pack_bool.equals(o.ext_pack_bool) && ext_pack_float.equals(o.ext_pack_float) && ext_pack_double.equals(o.ext_pack_double) && ext_pack_nested_enum.equals(o.ext_pack_nested_enum) && Internal.equals(oneof_string, o.oneof_string) && Internal.equals(oneof_int32, o.oneof_int32) && Internal.equals(oneof_nested_message, o.oneof_nested_message); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (opt_int32 != null ? opt_int32.hashCode() : 0); result = result * 37 + (opt_uint32 != null ? opt_uint32.hashCode() : 0); result = result * 37 + (opt_sint32 != null ? opt_sint32.hashCode() : 0); result = result * 37 + (opt_fixed32 != null ? opt_fixed32.hashCode() : 0); result = result * 37 + (opt_sfixed32 != null ? opt_sfixed32.hashCode() : 0); result = result * 37 + (opt_int64 != null ? opt_int64.hashCode() : 0); result = result * 37 + (opt_uint64 != null ? opt_uint64.hashCode() : 0); result = result * 37 + (opt_sint64 != null ? opt_sint64.hashCode() : 0); result = result * 37 + (opt_fixed64 != null ? opt_fixed64.hashCode() : 0); result = result * 37 + (opt_sfixed64 != null ? opt_sfixed64.hashCode() : 0); result = result * 37 + (opt_bool != null ? opt_bool.hashCode() : 0); result = result * 37 + (opt_float != null ? opt_float.hashCode() : 0); result = result * 37 + (opt_double != null ? opt_double.hashCode() : 0); result = result * 37 + (opt_string != null ? opt_string.hashCode() : 0); result = result * 37 + (opt_bytes != null ? opt_bytes.hashCode() : 0); result = result * 37 + (opt_nested_enum != null ? opt_nested_enum.hashCode() : 0); result = result * 37 + (opt_nested_message != null ? opt_nested_message.hashCode() : 0); result = result * 37 + req_int32.hashCode(); result = result * 37 + req_uint32.hashCode(); result = result * 37 + req_sint32.hashCode(); result = result * 37 + req_fixed32.hashCode(); result = result * 37 + req_sfixed32.hashCode(); result = result * 37 + req_int64.hashCode(); result = result * 37 + req_uint64.hashCode(); result = result * 37 + req_sint64.hashCode(); result = result * 37 + req_fixed64.hashCode(); result = result * 37 + req_sfixed64.hashCode(); result = result * 37 + req_bool.hashCode(); result = result * 37 + req_float.hashCode(); result = result * 37 + req_double.hashCode(); result = result * 37 + req_string.hashCode(); result = result * 37 + req_bytes.hashCode(); result = result * 37 + req_nested_enum.hashCode(); result = result * 37 + req_nested_message.hashCode(); result = result * 37 + rep_int32.hashCode(); result = result * 37 + rep_uint32.hashCode(); result = result * 37 + rep_sint32.hashCode(); result = result * 37 + rep_fixed32.hashCode(); result = result * 37 + rep_sfixed32.hashCode(); result = result * 37 + rep_int64.hashCode(); result = result * 37 + rep_uint64.hashCode(); result = result * 37 + rep_sint64.hashCode(); result = result * 37 + rep_fixed64.hashCode(); result = result * 37 + rep_sfixed64.hashCode(); result = result * 37 + rep_bool.hashCode(); result = result * 37 + rep_float.hashCode(); result = result * 37 + rep_double.hashCode(); result = result * 37 + rep_string.hashCode(); result = result * 37 + rep_bytes.hashCode(); result = result * 37 + rep_nested_enum.hashCode(); result = result * 37 + rep_nested_message.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + pack_uint32.hashCode(); result = result * 37 + pack_sint32.hashCode(); result = result * 37 + pack_fixed32.hashCode(); result = result * 37 + pack_sfixed32.hashCode(); result = result * 37 + pack_int64.hashCode(); result = result * 37 + pack_uint64.hashCode(); result = result * 37 + pack_sint64.hashCode(); result = result * 37 + pack_fixed64.hashCode(); result = result * 37 + pack_sfixed64.hashCode(); result = result * 37 + pack_bool.hashCode(); result = result * 37 + pack_float.hashCode(); result = result * 37 + pack_double.hashCode(); result = result * 37 + pack_nested_enum.hashCode(); result = result * 37 + (default_int32 != null ? default_int32.hashCode() : 0); result = result * 37 + (default_uint32 != null ? default_uint32.hashCode() : 0); result = result * 37 + (default_sint32 != null ? default_sint32.hashCode() : 0); result = result * 37 + (default_fixed32 != null ? default_fixed32.hashCode() : 0); result = result * 37 + (default_sfixed32 != null ? default_sfixed32.hashCode() : 0); result = result * 37 + (default_int64 != null ? default_int64.hashCode() : 0); result = result * 37 + (default_uint64 != null ? default_uint64.hashCode() : 0); result = result * 37 + (default_sint64 != null ? default_sint64.hashCode() : 0); result = result * 37 + (default_fixed64 != null ? default_fixed64.hashCode() : 0); result = result * 37 + (default_sfixed64 != null ? default_sfixed64.hashCode() : 0); result = result * 37 + (default_bool != null ? default_bool.hashCode() : 0); result = result * 37 + (default_float != null ? default_float.hashCode() : 0); result = result * 37 + (default_double != null ? default_double.hashCode() : 0); result = result * 37 + (default_string != null ? default_string.hashCode() : 0); result = result * 37 + (default_bytes != null ? default_bytes.hashCode() : 0); result = result * 37 + (default_nested_enum != null ? default_nested_enum.hashCode() : 0); result = result * 37 + map_int32_int32.hashCode(); result = result * 37 + map_string_string.hashCode(); result = result * 37 + map_string_message.hashCode(); result = result * 37 + map_string_enum.hashCode(); result = result * 37 + (ext_opt_int32 != null ? ext_opt_int32.hashCode() : 0); result = result * 37 + (ext_opt_uint32 != null ? ext_opt_uint32.hashCode() : 0); result = result * 37 + (ext_opt_sint32 != null ? ext_opt_sint32.hashCode() : 0); result = result * 37 + (ext_opt_fixed32 != null ? ext_opt_fixed32.hashCode() : 0); result = result * 37 + (ext_opt_sfixed32 != null ? ext_opt_sfixed32.hashCode() : 0); result = result * 37 + (ext_opt_int64 != null ? ext_opt_int64.hashCode() : 0); result = result * 37 + (ext_opt_uint64 != null ? ext_opt_uint64.hashCode() : 0); result = result * 37 + (ext_opt_sint64 != null ? ext_opt_sint64.hashCode() : 0); result = result * 37 + (ext_opt_fixed64 != null ? ext_opt_fixed64.hashCode() : 0); result = result * 37 + (ext_opt_sfixed64 != null ? ext_opt_sfixed64.hashCode() : 0); result = result * 37 + (ext_opt_bool != null ? ext_opt_bool.hashCode() : 0); result = result * 37 + (ext_opt_float != null ? ext_opt_float.hashCode() : 0); result = result * 37 + (ext_opt_double != null ? ext_opt_double.hashCode() : 0); result = result * 37 + (ext_opt_string != null ? ext_opt_string.hashCode() : 0); result = result * 37 + (ext_opt_bytes != null ? ext_opt_bytes.hashCode() : 0); result = result * 37 + (ext_opt_nested_enum != null ? ext_opt_nested_enum.hashCode() : 0); result = result * 37 + (ext_opt_nested_message != null ? ext_opt_nested_message.hashCode() : 0); result = result * 37 + ext_rep_int32.hashCode(); result = result * 37 + ext_rep_uint32.hashCode(); result = result * 37 + ext_rep_sint32.hashCode(); result = result * 37 + ext_rep_fixed32.hashCode(); result = result * 37 + ext_rep_sfixed32.hashCode(); result = result * 37 + ext_rep_int64.hashCode(); result = result * 37 + ext_rep_uint64.hashCode(); result = result * 37 + ext_rep_sint64.hashCode(); result = result * 37 + ext_rep_fixed64.hashCode(); result = result * 37 + ext_rep_sfixed64.hashCode(); result = result * 37 + ext_rep_bool.hashCode(); result = result * 37 + ext_rep_float.hashCode(); result = result * 37 + ext_rep_double.hashCode(); result = result * 37 + ext_rep_string.hashCode(); result = result * 37 + ext_rep_bytes.hashCode(); result = result * 37 + ext_rep_nested_enum.hashCode(); result = result * 37 + ext_rep_nested_message.hashCode(); result = result * 37 + ext_pack_int32.hashCode(); result = result * 37 + ext_pack_uint32.hashCode(); result = result * 37 + ext_pack_sint32.hashCode(); result = result * 37 + ext_pack_fixed32.hashCode(); result = result * 37 + ext_pack_sfixed32.hashCode(); result = result * 37 + ext_pack_int64.hashCode(); result = result * 37 + ext_pack_uint64.hashCode(); result = result * 37 + ext_pack_sint64.hashCode(); result = result * 37 + ext_pack_fixed64.hashCode(); result = result * 37 + ext_pack_sfixed64.hashCode(); result = result * 37 + ext_pack_bool.hashCode(); result = result * 37 + ext_pack_float.hashCode(); result = result * 37 + ext_pack_double.hashCode(); result = result * 37 + ext_pack_nested_enum.hashCode(); result = result * 37 + (oneof_string != null ? oneof_string.hashCode() : 0); result = result * 37 + (oneof_int32 != null ? oneof_int32.hashCode() : 0); result = result * 37 + (oneof_nested_message != null ? oneof_nested_message.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<AllTypes, Builder> { public Integer opt_int32; public Integer opt_uint32; public Integer opt_sint32; public Integer opt_fixed32; public Integer opt_sfixed32; public Long opt_int64; public Long opt_uint64; public Long opt_sint64; public Long opt_fixed64; public Long opt_sfixed64; public Boolean opt_bool; public Float opt_float; public Double opt_double; public String opt_string; public ByteString opt_bytes; public NestedEnum opt_nested_enum; public NestedMessage opt_nested_message; public Integer req_int32; public Integer req_uint32; public Integer req_sint32; public Integer req_fixed32; public Integer req_sfixed32; public Long req_int64; public Long req_uint64; public Long req_sint64; public Long req_fixed64; public Long req_sfixed64; public Boolean req_bool; public Float req_float; public Double req_double; public String req_string; public ByteString req_bytes; public NestedEnum req_nested_enum; public NestedMessage req_nested_message; public List<Integer> rep_int32; public List<Integer> rep_uint32; public List<Integer> rep_sint32; public List<Integer> rep_fixed32; public List<Integer> rep_sfixed32; public List<Long> rep_int64; public List<Long> rep_uint64; public List<Long> rep_sint64; public List<Long> rep_fixed64; public List<Long> rep_sfixed64; public List<Boolean> rep_bool; public List<Float> rep_float; public List<Double> rep_double; public List<String> rep_string; public List<ByteString> rep_bytes; public List<NestedEnum> rep_nested_enum; public List<NestedMessage> rep_nested_message; public List<Integer> pack_int32; public List<Integer> pack_uint32; public List<Integer> pack_sint32; public List<Integer> pack_fixed32; public List<Integer> pack_sfixed32; public List<Long> pack_int64; public List<Long> pack_uint64; public List<Long> pack_sint64; public List<Long> pack_fixed64; public List<Long> pack_sfixed64; public List<Boolean> pack_bool; public List<Float> pack_float; public List<Double> pack_double; public List<NestedEnum> pack_nested_enum; public Integer default_int32; public Integer default_uint32; public Integer default_sint32; public Integer default_fixed32; public Integer default_sfixed32; public Long default_int64; public Long default_uint64; public Long default_sint64; public Long default_fixed64; public Long default_sfixed64; public Boolean default_bool; public Float default_float; public Double default_double; public String default_string; public ByteString default_bytes; public NestedEnum default_nested_enum; public Map<Integer, Integer> map_int32_int32; public Map<String, String> map_string_string; public Map<String, NestedMessage> map_string_message; public Map<String, NestedEnum> map_string_enum; public Integer ext_opt_int32; public Integer ext_opt_uint32; public Integer ext_opt_sint32; public Integer ext_opt_fixed32; public Integer ext_opt_sfixed32; public Long ext_opt_int64; public Long ext_opt_uint64; public Long ext_opt_sint64; public Long ext_opt_fixed64; public Long ext_opt_sfixed64; public Boolean ext_opt_bool; public Float ext_opt_float; public Double ext_opt_double; public String ext_opt_string; public ByteString ext_opt_bytes; public NestedEnum ext_opt_nested_enum; public NestedMessage ext_opt_nested_message; public List<Integer> ext_rep_int32; public List<Integer> ext_rep_uint32; public List<Integer> ext_rep_sint32; public List<Integer> ext_rep_fixed32; public List<Integer> ext_rep_sfixed32; public List<Long> ext_rep_int64; public List<Long> ext_rep_uint64; public List<Long> ext_rep_sint64; public List<Long> ext_rep_fixed64; public List<Long> ext_rep_sfixed64; public List<Boolean> ext_rep_bool; public List<Float> ext_rep_float; public List<Double> ext_rep_double; public List<String> ext_rep_string; public List<ByteString> ext_rep_bytes; public List<NestedEnum> ext_rep_nested_enum; public List<NestedMessage> ext_rep_nested_message; public List<Integer> ext_pack_int32; public List<Integer> ext_pack_uint32; public List<Integer> ext_pack_sint32; public List<Integer> ext_pack_fixed32; public List<Integer> ext_pack_sfixed32; public List<Long> ext_pack_int64; public List<Long> ext_pack_uint64; public List<Long> ext_pack_sint64; public List<Long> ext_pack_fixed64; public List<Long> ext_pack_sfixed64; public List<Boolean> ext_pack_bool; public List<Float> ext_pack_float; public List<Double> ext_pack_double; public List<NestedEnum> ext_pack_nested_enum; public String oneof_string; public Integer oneof_int32; public NestedMessage oneof_nested_message; public Builder() { rep_int32 = Internal.newMutableList(); rep_uint32 = Internal.newMutableList(); rep_sint32 = Internal.newMutableList(); rep_fixed32 = Internal.newMutableList(); rep_sfixed32 = Internal.newMutableList(); rep_int64 = Internal.newMutableList(); rep_uint64 = Internal.newMutableList(); rep_sint64 = Internal.newMutableList(); rep_fixed64 = Internal.newMutableList(); rep_sfixed64 = Internal.newMutableList(); rep_bool = Internal.newMutableList(); rep_float = Internal.newMutableList(); rep_double = Internal.newMutableList(); rep_string = Internal.newMutableList(); rep_bytes = Internal.newMutableList(); rep_nested_enum = Internal.newMutableList(); rep_nested_message = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); pack_uint32 = Internal.newMutableList(); pack_sint32 = Internal.newMutableList(); pack_fixed32 = Internal.newMutableList(); pack_sfixed32 = Internal.newMutableList(); pack_int64 = Internal.newMutableList(); pack_uint64 = Internal.newMutableList(); pack_sint64 = Internal.newMutableList(); pack_fixed64 = Internal.newMutableList(); pack_sfixed64 = Internal.newMutableList(); pack_bool = Internal.newMutableList(); pack_float = Internal.newMutableList(); pack_double = Internal.newMutableList(); pack_nested_enum = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); map_string_string = Internal.newMutableMap(); map_string_message = Internal.newMutableMap(); map_string_enum = Internal.newMutableMap(); ext_rep_int32 = Internal.newMutableList(); ext_rep_uint32 = Internal.newMutableList(); ext_rep_sint32 = Internal.newMutableList(); ext_rep_fixed32 = Internal.newMutableList(); ext_rep_sfixed32 = Internal.newMutableList(); ext_rep_int64 = Internal.newMutableList(); ext_rep_uint64 = Internal.newMutableList(); ext_rep_sint64 = Internal.newMutableList(); ext_rep_fixed64 = Internal.newMutableList(); ext_rep_sfixed64 = Internal.newMutableList(); ext_rep_bool = Internal.newMutableList(); ext_rep_float = Internal.newMutableList(); ext_rep_double = Internal.newMutableList(); ext_rep_string = Internal.newMutableList(); ext_rep_bytes = Internal.newMutableList(); ext_rep_nested_enum = Internal.newMutableList(); ext_rep_nested_message = Internal.newMutableList(); ext_pack_int32 = Internal.newMutableList(); ext_pack_uint32 = Internal.newMutableList(); ext_pack_sint32 = Internal.newMutableList(); ext_pack_fixed32 = Internal.newMutableList(); ext_pack_sfixed32 = Internal.newMutableList(); ext_pack_int64 = Internal.newMutableList(); ext_pack_uint64 = Internal.newMutableList(); ext_pack_sint64 = Internal.newMutableList(); ext_pack_fixed64 = Internal.newMutableList(); ext_pack_sfixed64 = Internal.newMutableList(); ext_pack_bool = Internal.newMutableList(); ext_pack_float = Internal.newMutableList(); ext_pack_double = Internal.newMutableList(); ext_pack_nested_enum = Internal.newMutableList(); } public Builder opt_int32(Integer opt_int32) { this.opt_int32 = opt_int32; return this; } public Builder opt_uint32(Integer opt_uint32) { this.opt_uint32 = opt_uint32; return this; } public Builder opt_sint32(Integer opt_sint32) { this.opt_sint32 = opt_sint32; return this; } public Builder opt_fixed32(Integer opt_fixed32) { this.opt_fixed32 = opt_fixed32; return this; } public Builder opt_sfixed32(Integer opt_sfixed32) { this.opt_sfixed32 = opt_sfixed32; return this; } public Builder opt_int64(Long opt_int64) { this.opt_int64 = opt_int64; return this; } public Builder opt_uint64(Long opt_uint64) { this.opt_uint64 = opt_uint64; return this; } public Builder opt_sint64(Long opt_sint64) { this.opt_sint64 = opt_sint64; return this; } public Builder opt_fixed64(Long opt_fixed64) { this.opt_fixed64 = opt_fixed64; return this; } public Builder opt_sfixed64(Long opt_sfixed64) { this.opt_sfixed64 = opt_sfixed64; return this; } public Builder opt_bool(Boolean opt_bool) { this.opt_bool = opt_bool; return this; } public Builder opt_float(Float opt_float) { this.opt_float = opt_float; return this; } public Builder opt_double(Double opt_double) { this.opt_double = opt_double; return this; } public Builder opt_string(String opt_string) { this.opt_string = opt_string; return this; } public Builder opt_bytes(ByteString opt_bytes) { this.opt_bytes = opt_bytes; return this; } public Builder opt_nested_enum(NestedEnum opt_nested_enum) { this.opt_nested_enum = opt_nested_enum; return this; } public Builder opt_nested_message(NestedMessage opt_nested_message) { this.opt_nested_message = opt_nested_message; return this; } public Builder req_int32(Integer req_int32) { this.req_int32 = req_int32; return this; } public Builder req_uint32(Integer req_uint32) { this.req_uint32 = req_uint32; return this; } public Builder req_sint32(Integer req_sint32) { this.req_sint32 = req_sint32; return this; } public Builder req_fixed32(Integer req_fixed32) { this.req_fixed32 = req_fixed32; return this; } public Builder req_sfixed32(Integer req_sfixed32) { this.req_sfixed32 = req_sfixed32; return this; } public Builder req_int64(Long req_int64) { this.req_int64 = req_int64; return this; } public Builder req_uint64(Long req_uint64) { this.req_uint64 = req_uint64; return this; } public Builder req_sint64(Long req_sint64) { this.req_sint64 = req_sint64; return this; } public Builder req_fixed64(Long req_fixed64) { this.req_fixed64 = req_fixed64; return this; } public Builder req_sfixed64(Long req_sfixed64) { this.req_sfixed64 = req_sfixed64; return this; } public Builder req_bool(Boolean req_bool) { this.req_bool = req_bool; return this; } public Builder req_float(Float req_float) { this.req_float = req_float; return this; } public Builder req_double(Double req_double) { this.req_double = req_double; return this; } public Builder req_string(String req_string) { this.req_string = req_string; return this; } public Builder req_bytes(ByteString req_bytes) { this.req_bytes = req_bytes; return this; } public Builder req_nested_enum(NestedEnum req_nested_enum) { this.req_nested_enum = req_nested_enum; return this; } public Builder req_nested_message(NestedMessage req_nested_message) { this.req_nested_message = req_nested_message; return this; } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder rep_uint32(List<Integer> rep_uint32) { Internal.checkElementsNotNull(rep_uint32); this.rep_uint32 = rep_uint32; return this; } public Builder rep_sint32(List<Integer> rep_sint32) { Internal.checkElementsNotNull(rep_sint32); this.rep_sint32 = rep_sint32; return this; } public Builder rep_fixed32(List<Integer> rep_fixed32) { Internal.checkElementsNotNull(rep_fixed32); this.rep_fixed32 = rep_fixed32; return this; } public Builder rep_sfixed32(List<Integer> rep_sfixed32) { Internal.checkElementsNotNull(rep_sfixed32); this.rep_sfixed32 = rep_sfixed32; return this; } public Builder rep_int64(List<Long> rep_int64) { Internal.checkElementsNotNull(rep_int64); this.rep_int64 = rep_int64; return this; } public Builder rep_uint64(List<Long> rep_uint64) { Internal.checkElementsNotNull(rep_uint64); this.rep_uint64 = rep_uint64; return this; } public Builder rep_sint64(List<Long> rep_sint64) { Internal.checkElementsNotNull(rep_sint64); this.rep_sint64 = rep_sint64; return this; } public Builder rep_fixed64(List<Long> rep_fixed64) { Internal.checkElementsNotNull(rep_fixed64); this.rep_fixed64 = rep_fixed64; return this; } public Builder rep_sfixed64(List<Long> rep_sfixed64) { Internal.checkElementsNotNull(rep_sfixed64); this.rep_sfixed64 = rep_sfixed64; return this; } public Builder rep_bool(List<Boolean> rep_bool) { Internal.checkElementsNotNull(rep_bool); this.rep_bool = rep_bool; return this; } public Builder rep_float(List<Float> rep_float) { Internal.checkElementsNotNull(rep_float); this.rep_float = rep_float; return this; } public Builder rep_double(List<Double> rep_double) { Internal.checkElementsNotNull(rep_double); this.rep_double = rep_double; return this; } public Builder rep_string(List<String> rep_string) { Internal.checkElementsNotNull(rep_string); this.rep_string = rep_string; return this; } public Builder rep_bytes(List<ByteString> rep_bytes) { Internal.checkElementsNotNull(rep_bytes); this.rep_bytes = rep_bytes; return this; } public Builder rep_nested_enum(List<NestedEnum> rep_nested_enum) { Internal.checkElementsNotNull(rep_nested_enum); this.rep_nested_enum = rep_nested_enum; return this; } public Builder rep_nested_message(List<NestedMessage> rep_nested_message) { Internal.checkElementsNotNull(rep_nested_message); this.rep_nested_message = rep_nested_message; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder pack_uint32(List<Integer> pack_uint32) { Internal.checkElementsNotNull(pack_uint32); this.pack_uint32 = pack_uint32; return this; } public Builder pack_sint32(List<Integer> pack_sint32) { Internal.checkElementsNotNull(pack_sint32); this.pack_sint32 = pack_sint32; return this; } public Builder pack_fixed32(List<Integer> pack_fixed32) { Internal.checkElementsNotNull(pack_fixed32); this.pack_fixed32 = pack_fixed32; return this; } public Builder pack_sfixed32(List<Integer> pack_sfixed32) { Internal.checkElementsNotNull(pack_sfixed32); this.pack_sfixed32 = pack_sfixed32; return this; } public Builder pack_int64(List<Long> pack_int64) { Internal.checkElementsNotNull(pack_int64); this.pack_int64 = pack_int64; return this; } public Builder pack_uint64(List<Long> pack_uint64) { Internal.checkElementsNotNull(pack_uint64); this.pack_uint64 = pack_uint64; return this; } public Builder pack_sint64(List<Long> pack_sint64) { Internal.checkElementsNotNull(pack_sint64); this.pack_sint64 = pack_sint64; return this; } public Builder pack_fixed64(List<Long> pack_fixed64) { Internal.checkElementsNotNull(pack_fixed64); this.pack_fixed64 = pack_fixed64; return this; } public Builder pack_sfixed64(List<Long> pack_sfixed64) { Internal.checkElementsNotNull(pack_sfixed64); this.pack_sfixed64 = pack_sfixed64; return this; } public Builder pack_bool(List<Boolean> pack_bool) { Internal.checkElementsNotNull(pack_bool); this.pack_bool = pack_bool; return this; } public Builder pack_float(List<Float> pack_float) { Internal.checkElementsNotNull(pack_float); this.pack_float = pack_float; return this; } public Builder pack_double(List<Double> pack_double) { Internal.checkElementsNotNull(pack_double); this.pack_double = pack_double; return this; } public Builder pack_nested_enum(List<NestedEnum> pack_nested_enum) { Internal.checkElementsNotNull(pack_nested_enum); this.pack_nested_enum = pack_nested_enum; return this; } public Builder default_int32(Integer default_int32) { this.default_int32 = default_int32; return this; } public Builder default_uint32(Integer default_uint32) { this.default_uint32 = default_uint32; return this; } public Builder default_sint32(Integer default_sint32) { this.default_sint32 = default_sint32; return this; } public Builder default_fixed32(Integer default_fixed32) { this.default_fixed32 = default_fixed32; return this; } public Builder default_sfixed32(Integer default_sfixed32) { this.default_sfixed32 = default_sfixed32; return this; } public Builder default_int64(Long default_int64) { this.default_int64 = default_int64; return this; } public Builder default_uint64(Long default_uint64) { this.default_uint64 = default_uint64; return this; } public Builder default_sint64(Long default_sint64) { this.default_sint64 = default_sint64; return this; } public Builder default_fixed64(Long default_fixed64) { this.default_fixed64 = default_fixed64; return this; } public Builder default_sfixed64(Long default_sfixed64) { this.default_sfixed64 = default_sfixed64; return this; } public Builder default_bool(Boolean default_bool) { this.default_bool = default_bool; return this; } public Builder default_float(Float default_float) { this.default_float = default_float; return this; } public Builder default_double(Double default_double) { this.default_double = default_double; return this; } public Builder default_string(String default_string) { this.default_string = default_string; return this; } public Builder default_bytes(ByteString default_bytes) { this.default_bytes = default_bytes; return this; } public Builder default_nested_enum(NestedEnum default_nested_enum) { this.default_nested_enum = default_nested_enum; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } public Builder map_string_string(Map<String, String> map_string_string) { Internal.checkElementsNotNull(map_string_string); this.map_string_string = map_string_string; return this; } public Builder map_string_message(Map<String, NestedMessage> map_string_message) { Internal.checkElementsNotNull(map_string_message); this.map_string_message = map_string_message; return this; } public Builder map_string_enum(Map<String, NestedEnum> map_string_enum) { Internal.checkElementsNotNull(map_string_enum); this.map_string_enum = map_string_enum; return this; } public Builder ext_opt_int32(Integer ext_opt_int32) { this.ext_opt_int32 = ext_opt_int32; return this; } public Builder ext_opt_uint32(Integer ext_opt_uint32) { this.ext_opt_uint32 = ext_opt_uint32; return this; } public Builder ext_opt_sint32(Integer ext_opt_sint32) { this.ext_opt_sint32 = ext_opt_sint32; return this; } public Builder ext_opt_fixed32(Integer ext_opt_fixed32) { this.ext_opt_fixed32 = ext_opt_fixed32; return this; } public Builder ext_opt_sfixed32(Integer ext_opt_sfixed32) { this.ext_opt_sfixed32 = ext_opt_sfixed32; return this; } public Builder ext_opt_int64(Long ext_opt_int64) { this.ext_opt_int64 = ext_opt_int64; return this; } public Builder ext_opt_uint64(Long ext_opt_uint64) { this.ext_opt_uint64 = ext_opt_uint64; return this; } public Builder ext_opt_sint64(Long ext_opt_sint64) { this.ext_opt_sint64 = ext_opt_sint64; return this; } public Builder ext_opt_fixed64(Long ext_opt_fixed64) { this.ext_opt_fixed64 = ext_opt_fixed64; return this; } public Builder ext_opt_sfixed64(Long ext_opt_sfixed64) { this.ext_opt_sfixed64 = ext_opt_sfixed64; return this; } public Builder ext_opt_bool(Boolean ext_opt_bool) { this.ext_opt_bool = ext_opt_bool; return this; } public Builder ext_opt_float(Float ext_opt_float) { this.ext_opt_float = ext_opt_float; return this; } public Builder ext_opt_double(Double ext_opt_double) { this.ext_opt_double = ext_opt_double; return this; } public Builder ext_opt_string(String ext_opt_string) { this.ext_opt_string = ext_opt_string; return this; } public Builder ext_opt_bytes(ByteString ext_opt_bytes) { this.ext_opt_bytes = ext_opt_bytes; return this; } public Builder ext_opt_nested_enum(NestedEnum ext_opt_nested_enum) { this.ext_opt_nested_enum = ext_opt_nested_enum; return this; } public Builder ext_opt_nested_message(NestedMessage ext_opt_nested_message) { this.ext_opt_nested_message = ext_opt_nested_message; return this; } public Builder ext_rep_int32(List<Integer> ext_rep_int32) { Internal.checkElementsNotNull(ext_rep_int32); this.ext_rep_int32 = ext_rep_int32; return this; } public Builder ext_rep_uint32(List<Integer> ext_rep_uint32) { Internal.checkElementsNotNull(ext_rep_uint32); this.ext_rep_uint32 = ext_rep_uint32; return this; } public Builder ext_rep_sint32(List<Integer> ext_rep_sint32) { Internal.checkElementsNotNull(ext_rep_sint32); this.ext_rep_sint32 = ext_rep_sint32; return this; } public Builder ext_rep_fixed32(List<Integer> ext_rep_fixed32) { Internal.checkElementsNotNull(ext_rep_fixed32); this.ext_rep_fixed32 = ext_rep_fixed32; return this; } public Builder ext_rep_sfixed32(List<Integer> ext_rep_sfixed32) { Internal.checkElementsNotNull(ext_rep_sfixed32); this.ext_rep_sfixed32 = ext_rep_sfixed32; return this; } public Builder ext_rep_int64(List<Long> ext_rep_int64) { Internal.checkElementsNotNull(ext_rep_int64); this.ext_rep_int64 = ext_rep_int64; return this; } public Builder ext_rep_uint64(List<Long> ext_rep_uint64) { Internal.checkElementsNotNull(ext_rep_uint64); this.ext_rep_uint64 = ext_rep_uint64; return this; } public Builder ext_rep_sint64(List<Long> ext_rep_sint64) { Internal.checkElementsNotNull(ext_rep_sint64); this.ext_rep_sint64 = ext_rep_sint64; return this; } public Builder ext_rep_fixed64(List<Long> ext_rep_fixed64) { Internal.checkElementsNotNull(ext_rep_fixed64); this.ext_rep_fixed64 = ext_rep_fixed64; return this; } public Builder ext_rep_sfixed64(List<Long> ext_rep_sfixed64) { Internal.checkElementsNotNull(ext_rep_sfixed64); this.ext_rep_sfixed64 = ext_rep_sfixed64; return this; } public Builder ext_rep_bool(List<Boolean> ext_rep_bool) { Internal.checkElementsNotNull(ext_rep_bool); this.ext_rep_bool = ext_rep_bool; return this; } public Builder ext_rep_float(List<Float> ext_rep_float) { Internal.checkElementsNotNull(ext_rep_float); this.ext_rep_float = ext_rep_float; return this; } public Builder ext_rep_double(List<Double> ext_rep_double) { Internal.checkElementsNotNull(ext_rep_double); this.ext_rep_double = ext_rep_double; return this; } public Builder ext_rep_string(List<String> ext_rep_string) { Internal.checkElementsNotNull(ext_rep_string); this.ext_rep_string = ext_rep_string; return this; } public Builder ext_rep_bytes(List<ByteString> ext_rep_bytes) { Internal.checkElementsNotNull(ext_rep_bytes); this.ext_rep_bytes = ext_rep_bytes; return this; } public Builder ext_rep_nested_enum(List<NestedEnum> ext_rep_nested_enum) { Internal.checkElementsNotNull(ext_rep_nested_enum); this.ext_rep_nested_enum = ext_rep_nested_enum; return this; } public Builder ext_rep_nested_message(List<NestedMessage> ext_rep_nested_message) { Internal.checkElementsNotNull(ext_rep_nested_message); this.ext_rep_nested_message = ext_rep_nested_message; return this; } public Builder ext_pack_int32(List<Integer> ext_pack_int32) { Internal.checkElementsNotNull(ext_pack_int32); this.ext_pack_int32 = ext_pack_int32; return this; } public Builder ext_pack_uint32(List<Integer> ext_pack_uint32) { Internal.checkElementsNotNull(ext_pack_uint32); this.ext_pack_uint32 = ext_pack_uint32; return this; } public Builder ext_pack_sint32(List<Integer> ext_pack_sint32) { Internal.checkElementsNotNull(ext_pack_sint32); this.ext_pack_sint32 = ext_pack_sint32; return this; } public Builder ext_pack_fixed32(List<Integer> ext_pack_fixed32) { Internal.checkElementsNotNull(ext_pack_fixed32); this.ext_pack_fixed32 = ext_pack_fixed32; return this; } public Builder ext_pack_sfixed32(List<Integer> ext_pack_sfixed32) { Internal.checkElementsNotNull(ext_pack_sfixed32); this.ext_pack_sfixed32 = ext_pack_sfixed32; return this; } public Builder ext_pack_int64(List<Long> ext_pack_int64) { Internal.checkElementsNotNull(ext_pack_int64); this.ext_pack_int64 = ext_pack_int64; return this; } public Builder ext_pack_uint64(List<Long> ext_pack_uint64) { Internal.checkElementsNotNull(ext_pack_uint64); this.ext_pack_uint64 = ext_pack_uint64; return this; } public Builder ext_pack_sint64(List<Long> ext_pack_sint64) { Internal.checkElementsNotNull(ext_pack_sint64); this.ext_pack_sint64 = ext_pack_sint64; return this; } public Builder ext_pack_fixed64(List<Long> ext_pack_fixed64) { Internal.checkElementsNotNull(ext_pack_fixed64); this.ext_pack_fixed64 = ext_pack_fixed64; return this; } public Builder ext_pack_sfixed64(List<Long> ext_pack_sfixed64) { Internal.checkElementsNotNull(ext_pack_sfixed64); this.ext_pack_sfixed64 = ext_pack_sfixed64; return this; } public Builder ext_pack_bool(List<Boolean> ext_pack_bool) { Internal.checkElementsNotNull(ext_pack_bool); this.ext_pack_bool = ext_pack_bool; return this; } public Builder ext_pack_float(List<Float> ext_pack_float) { Internal.checkElementsNotNull(ext_pack_float); this.ext_pack_float = ext_pack_float; return this; } public Builder ext_pack_double(List<Double> ext_pack_double) { Internal.checkElementsNotNull(ext_pack_double); this.ext_pack_double = ext_pack_double; return this; } public Builder ext_pack_nested_enum(List<NestedEnum> ext_pack_nested_enum) { Internal.checkElementsNotNull(ext_pack_nested_enum); this.ext_pack_nested_enum = ext_pack_nested_enum; return this; } public Builder oneof_string(String oneof_string) { this.oneof_string = oneof_string; this.oneof_int32 = null; this.oneof_nested_message = null; return this; } public Builder oneof_int32(Integer oneof_int32) { this.oneof_int32 = oneof_int32; this.oneof_string = null; this.oneof_nested_message = null; return this; } public Builder oneof_nested_message(NestedMessage oneof_nested_message) { this.oneof_nested_message = oneof_nested_message; this.oneof_string = null; this.oneof_int32 = null; return this; } @Override public AllTypes build() { if (req_int32 == null || req_uint32 == null || req_sint32 == null || req_fixed32 == null || req_sfixed32 == null || req_int64 == null || req_uint64 == null || req_sint64 == null || req_fixed64 == null || req_sfixed64 == null || req_bool == null || req_float == null || req_double == null || req_string == null || req_bytes == null || req_nested_enum == null || req_nested_message == null) { throw Internal.missingRequiredFields(req_int32, "req_int32", req_uint32, "req_uint32", req_sint32, "req_sint32", req_fixed32, "req_fixed32", req_sfixed32, "req_sfixed32", req_int64, "req_int64", req_uint64, "req_uint64", req_sint64, "req_sint64", req_fixed64, "req_fixed64", req_sfixed64, "req_sfixed64", req_bool, "req_bool", req_float, "req_float", req_double, "req_double", req_string, "req_string", req_bytes, "req_bytes", req_nested_enum, "req_nested_enum", req_nested_message, "req_nested_message"); } return new AllTypes(this, super.buildUnknownFields()); } } public enum NestedEnum implements WireEnum { UNKNOWN(0), A(1); public static final ProtoAdapter<NestedEnum> ADAPTER = ProtoAdapter.newEnumAdapter(NestedEnum.class); private final int value; NestedEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static NestedEnum fromValue(int value) { switch (value) { case 0: return UNKNOWN; case 1: return A; default: return null; } } @Override public int getValue() { return value; } } public static final class NestedMessage extends Message<NestedMessage, NestedMessage.Builder> { public static final ProtoAdapter<NestedMessage> ADAPTER = ProtoAdapter.newMessageAdapter(NestedMessage.class, "type.googleapis.com/squareup.proto2.AllTypes.NestedMessage", Syntax.PROTO_2); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_A = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer a; public NestedMessage(Integer a) { this(a, ByteString.EMPTY); } public NestedMessage(Integer a, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedMessage)) return false; NestedMessage o = (NestedMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (a != null ? a.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<NestedMessage, Builder> { public Integer a; public Builder() { } public Builder a(Integer a) { this.a = a; return this; } @Override public NestedMessage build() { return new NestedMessage(a, super.buildUnknownFields()); } } } }
7,109
0
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/com/squareup/wire/proto3
Create_ds/wire/wire-tests/src/jvmJsonJavaTest/proto-java/com/squareup/wire/proto3/alltypes/AllTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto3.AllTypes in all_types_proto3_test_proto3_optional.proto package com.squareup.wire.proto3.alltypes; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Boolean; import java.lang.Double; import java.lang.Float; import java.lang.Integer; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.List; import java.util.Map; import okio.ByteString; public final class AllTypes extends Message<AllTypes, AllTypes.Builder> { public static final ProtoAdapter<AllTypes> ADAPTER = ProtoAdapter.newMessageAdapter(AllTypes.class, "type.googleapis.com/squareup.proto3.AllTypes", Syntax.PROTO_3); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OPT_INT32 = 0; public static final Integer DEFAULT_OPT_UINT32 = 0; public static final Integer DEFAULT_OPT_SINT32 = 0; public static final Integer DEFAULT_OPT_FIXED32 = 0; public static final Integer DEFAULT_OPT_SFIXED32 = 0; public static final Long DEFAULT_OPT_INT64 = 0L; public static final Long DEFAULT_OPT_UINT64 = 0L; public static final Long DEFAULT_OPT_SINT64 = 0L; public static final Long DEFAULT_OPT_FIXED64 = 0L; public static final Long DEFAULT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_OPT_BOOL = false; public static final Float DEFAULT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_OPT_STRING = ""; public static final ByteString DEFAULT_OPT_BYTES = ByteString.EMPTY; public static final String DEFAULT_ONEOF_STRING = ""; public static final Integer DEFAULT_ONEOF_INT32 = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.OMIT_IDENTITY, jsonName = "myInt32" ) public final int my_int32; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.OMIT_IDENTITY, jsonName = "myUint32" ) public final int my_uint32; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySint32" ) public final int my_sint32; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.OMIT_IDENTITY, jsonName = "myFixed32" ) public final int my_fixed32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySfixed32" ) public final int my_sfixed32; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.OMIT_IDENTITY, jsonName = "myInt64" ) public final long my_int64; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.OMIT_IDENTITY, jsonName = "myUint64" ) public final long my_uint64; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySint64" ) public final long my_sint64; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.OMIT_IDENTITY, jsonName = "myFixed64" ) public final long my_fixed64; @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.OMIT_IDENTITY, jsonName = "mySfixed64" ) public final long my_sfixed64; @WireField( tag = 11, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.OMIT_IDENTITY, jsonName = "myBool" ) public final boolean my_bool; @WireField( tag = 12, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.OMIT_IDENTITY, jsonName = "myFloat" ) public final float my_float; @WireField( tag = 13, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.OMIT_IDENTITY, jsonName = "myDouble" ) public final double my_double; @WireField( tag = 14, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.OMIT_IDENTITY, jsonName = "myString" ) public final String my_string; @WireField( tag = 15, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.OMIT_IDENTITY, jsonName = "myBytes" ) public final ByteString my_bytes; @WireField( tag = 16, adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.OMIT_IDENTITY, jsonName = "nestedEnum" ) public final NestedEnum nested_enum; @WireField( tag = 17, adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.OMIT_IDENTITY, jsonName = "nestedMessage" ) public final NestedMessage nested_message; @WireField( tag = 101, adapter = "com.squareup.wire.ProtoAdapter#INT32", jsonName = "optInt32" ) public final Integer opt_int32; @WireField( tag = 102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", jsonName = "optUint32" ) public final Integer opt_uint32; @WireField( tag = 103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", jsonName = "optSint32" ) public final Integer opt_sint32; @WireField( tag = 104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", jsonName = "optFixed32" ) public final Integer opt_fixed32; @WireField( tag = 105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", jsonName = "optSfixed32" ) public final Integer opt_sfixed32; @WireField( tag = 106, adapter = "com.squareup.wire.ProtoAdapter#INT64", jsonName = "optInt64" ) public final Long opt_int64; @WireField( tag = 107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", jsonName = "optUint64" ) public final Long opt_uint64; @WireField( tag = 108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", jsonName = "optSint64" ) public final Long opt_sint64; @WireField( tag = 109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", jsonName = "optFixed64" ) public final Long opt_fixed64; @WireField( tag = 110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", jsonName = "optSfixed64" ) public final Long opt_sfixed64; @WireField( tag = 111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", jsonName = "optBool" ) public final Boolean opt_bool; @WireField( tag = 112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", jsonName = "optFloat" ) public final Float opt_float; @WireField( tag = 113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", jsonName = "optDouble" ) public final Double opt_double; @WireField( tag = 114, adapter = "com.squareup.wire.ProtoAdapter#STRING", jsonName = "optString" ) public final String opt_string; @WireField( tag = 115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", jsonName = "optBytes" ) public final ByteString opt_bytes; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED, jsonName = "repInt32" ) public final List<Integer> rep_int32; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED, jsonName = "repUint32" ) public final List<Integer> rep_uint32; @WireField( tag = 203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED, jsonName = "repSint32" ) public final List<Integer> rep_sint32; @WireField( tag = 204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED, jsonName = "repFixed32" ) public final List<Integer> rep_fixed32; @WireField( tag = 205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED, jsonName = "repSfixed32" ) public final List<Integer> rep_sfixed32; @WireField( tag = 206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED, jsonName = "repInt64" ) public final List<Long> rep_int64; @WireField( tag = 207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED, jsonName = "repUint64" ) public final List<Long> rep_uint64; @WireField( tag = 208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED, jsonName = "repSint64" ) public final List<Long> rep_sint64; @WireField( tag = 209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED, jsonName = "repFixed64" ) public final List<Long> rep_fixed64; @WireField( tag = 210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED, jsonName = "repSfixed64" ) public final List<Long> rep_sfixed64; @WireField( tag = 211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED, jsonName = "repBool" ) public final List<Boolean> rep_bool; @WireField( tag = 212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED, jsonName = "repFloat" ) public final List<Float> rep_float; @WireField( tag = 213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED, jsonName = "repDouble" ) public final List<Double> rep_double; @WireField( tag = 214, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED, jsonName = "repString" ) public final List<String> rep_string; @WireField( tag = 215, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED, jsonName = "repBytes" ) public final List<ByteString> rep_bytes; @WireField( tag = 216, adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED, jsonName = "repNestedEnum" ) public final List<NestedEnum> rep_nested_enum; @WireField( tag = 217, adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED, jsonName = "repNestedMessage" ) public final List<NestedMessage> rep_nested_message; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED, jsonName = "packInt32" ) public final List<Integer> pack_int32; @WireField( tag = 302, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED, jsonName = "packUint32" ) public final List<Integer> pack_uint32; @WireField( tag = 303, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED, jsonName = "packSint32" ) public final List<Integer> pack_sint32; @WireField( tag = 304, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED, jsonName = "packFixed32" ) public final List<Integer> pack_fixed32; @WireField( tag = 305, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED, jsonName = "packSfixed32" ) public final List<Integer> pack_sfixed32; @WireField( tag = 306, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED, jsonName = "packInt64" ) public final List<Long> pack_int64; @WireField( tag = 307, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED, jsonName = "packUint64" ) public final List<Long> pack_uint64; @WireField( tag = 308, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED, jsonName = "packSint64" ) public final List<Long> pack_sint64; @WireField( tag = 309, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED, jsonName = "packFixed64" ) public final List<Long> pack_fixed64; @WireField( tag = 310, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED, jsonName = "packSfixed64" ) public final List<Long> pack_sfixed64; @WireField( tag = 311, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED, jsonName = "packBool" ) public final List<Boolean> pack_bool; @WireField( tag = 312, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED, jsonName = "packFloat" ) public final List<Float> pack_float; @WireField( tag = 313, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED, jsonName = "packDouble" ) public final List<Double> pack_double; @WireField( tag = 316, adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED, jsonName = "packNestedEnum" ) public final List<NestedEnum> pack_nested_enum; @WireField( tag = 501, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32", jsonName = "mapInt32Int32" ) public final Map<Integer, Integer> map_int32_int32; @WireField( tag = 502, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING", jsonName = "mapStringString" ) public final Map<String, String> map_string_string; @WireField( tag = 503, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedMessage#ADAPTER", jsonName = "mapStringMessage" ) public final Map<String, NestedMessage> map_string_message; @WireField( tag = 504, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedEnum#ADAPTER", jsonName = "mapStringEnum" ) public final Map<String, NestedEnum> map_string_enum; @WireField( tag = 601, adapter = "com.squareup.wire.ProtoAdapter#STRING", jsonName = "oneofString", oneofName = "choice" ) public final String oneof_string; @WireField( tag = 602, adapter = "com.squareup.wire.ProtoAdapter#INT32", jsonName = "oneofInt32", oneofName = "choice" ) public final Integer oneof_int32; @WireField( tag = 603, adapter = "com.squareup.wire.proto3.alltypes.AllTypes$NestedMessage#ADAPTER", jsonName = "oneofNestedMessage", oneofName = "choice" ) public final NestedMessage oneof_nested_message; public AllTypes(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message may be non-null"); } this.my_int32 = builder.my_int32; this.my_uint32 = builder.my_uint32; this.my_sint32 = builder.my_sint32; this.my_fixed32 = builder.my_fixed32; this.my_sfixed32 = builder.my_sfixed32; this.my_int64 = builder.my_int64; this.my_uint64 = builder.my_uint64; this.my_sint64 = builder.my_sint64; this.my_fixed64 = builder.my_fixed64; this.my_sfixed64 = builder.my_sfixed64; this.my_bool = builder.my_bool; this.my_float = builder.my_float; this.my_double = builder.my_double; if (builder.my_string == null) { throw new IllegalArgumentException("builder.my_string == null"); } this.my_string = builder.my_string; if (builder.my_bytes == null) { throw new IllegalArgumentException("builder.my_bytes == null"); } this.my_bytes = builder.my_bytes; if (builder.nested_enum == null) { throw new IllegalArgumentException("builder.nested_enum == null"); } this.nested_enum = builder.nested_enum; this.nested_message = builder.nested_message; this.opt_int32 = builder.opt_int32; this.opt_uint32 = builder.opt_uint32; this.opt_sint32 = builder.opt_sint32; this.opt_fixed32 = builder.opt_fixed32; this.opt_sfixed32 = builder.opt_sfixed32; this.opt_int64 = builder.opt_int64; this.opt_uint64 = builder.opt_uint64; this.opt_sint64 = builder.opt_sint64; this.opt_fixed64 = builder.opt_fixed64; this.opt_sfixed64 = builder.opt_sfixed64; this.opt_bool = builder.opt_bool; this.opt_float = builder.opt_float; this.opt_double = builder.opt_double; this.opt_string = builder.opt_string; this.opt_bytes = builder.opt_bytes; this.rep_int32 = Internal.immutableCopyOf("rep_int32", builder.rep_int32); this.rep_uint32 = Internal.immutableCopyOf("rep_uint32", builder.rep_uint32); this.rep_sint32 = Internal.immutableCopyOf("rep_sint32", builder.rep_sint32); this.rep_fixed32 = Internal.immutableCopyOf("rep_fixed32", builder.rep_fixed32); this.rep_sfixed32 = Internal.immutableCopyOf("rep_sfixed32", builder.rep_sfixed32); this.rep_int64 = Internal.immutableCopyOf("rep_int64", builder.rep_int64); this.rep_uint64 = Internal.immutableCopyOf("rep_uint64", builder.rep_uint64); this.rep_sint64 = Internal.immutableCopyOf("rep_sint64", builder.rep_sint64); this.rep_fixed64 = Internal.immutableCopyOf("rep_fixed64", builder.rep_fixed64); this.rep_sfixed64 = Internal.immutableCopyOf("rep_sfixed64", builder.rep_sfixed64); this.rep_bool = Internal.immutableCopyOf("rep_bool", builder.rep_bool); this.rep_float = Internal.immutableCopyOf("rep_float", builder.rep_float); this.rep_double = Internal.immutableCopyOf("rep_double", builder.rep_double); this.rep_string = Internal.immutableCopyOf("rep_string", builder.rep_string); this.rep_bytes = Internal.immutableCopyOf("rep_bytes", builder.rep_bytes); this.rep_nested_enum = Internal.immutableCopyOf("rep_nested_enum", builder.rep_nested_enum); this.rep_nested_message = Internal.immutableCopyOf("rep_nested_message", builder.rep_nested_message); this.pack_int32 = Internal.immutableCopyOf("pack_int32", builder.pack_int32); this.pack_uint32 = Internal.immutableCopyOf("pack_uint32", builder.pack_uint32); this.pack_sint32 = Internal.immutableCopyOf("pack_sint32", builder.pack_sint32); this.pack_fixed32 = Internal.immutableCopyOf("pack_fixed32", builder.pack_fixed32); this.pack_sfixed32 = Internal.immutableCopyOf("pack_sfixed32", builder.pack_sfixed32); this.pack_int64 = Internal.immutableCopyOf("pack_int64", builder.pack_int64); this.pack_uint64 = Internal.immutableCopyOf("pack_uint64", builder.pack_uint64); this.pack_sint64 = Internal.immutableCopyOf("pack_sint64", builder.pack_sint64); this.pack_fixed64 = Internal.immutableCopyOf("pack_fixed64", builder.pack_fixed64); this.pack_sfixed64 = Internal.immutableCopyOf("pack_sfixed64", builder.pack_sfixed64); this.pack_bool = Internal.immutableCopyOf("pack_bool", builder.pack_bool); this.pack_float = Internal.immutableCopyOf("pack_float", builder.pack_float); this.pack_double = Internal.immutableCopyOf("pack_double", builder.pack_double); this.pack_nested_enum = Internal.immutableCopyOf("pack_nested_enum", builder.pack_nested_enum); this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", builder.map_int32_int32); this.map_string_string = Internal.immutableCopyOf("map_string_string", builder.map_string_string); this.map_string_message = Internal.immutableCopyOf("map_string_message", builder.map_string_message); this.map_string_enum = Internal.immutableCopyOf("map_string_enum", builder.map_string_enum); this.oneof_string = builder.oneof_string; this.oneof_int32 = builder.oneof_int32; this.oneof_nested_message = builder.oneof_nested_message; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.my_int32 = my_int32; builder.my_uint32 = my_uint32; builder.my_sint32 = my_sint32; builder.my_fixed32 = my_fixed32; builder.my_sfixed32 = my_sfixed32; builder.my_int64 = my_int64; builder.my_uint64 = my_uint64; builder.my_sint64 = my_sint64; builder.my_fixed64 = my_fixed64; builder.my_sfixed64 = my_sfixed64; builder.my_bool = my_bool; builder.my_float = my_float; builder.my_double = my_double; builder.my_string = my_string; builder.my_bytes = my_bytes; builder.nested_enum = nested_enum; builder.nested_message = nested_message; builder.opt_int32 = opt_int32; builder.opt_uint32 = opt_uint32; builder.opt_sint32 = opt_sint32; builder.opt_fixed32 = opt_fixed32; builder.opt_sfixed32 = opt_sfixed32; builder.opt_int64 = opt_int64; builder.opt_uint64 = opt_uint64; builder.opt_sint64 = opt_sint64; builder.opt_fixed64 = opt_fixed64; builder.opt_sfixed64 = opt_sfixed64; builder.opt_bool = opt_bool; builder.opt_float = opt_float; builder.opt_double = opt_double; builder.opt_string = opt_string; builder.opt_bytes = opt_bytes; builder.rep_int32 = Internal.copyOf(rep_int32); builder.rep_uint32 = Internal.copyOf(rep_uint32); builder.rep_sint32 = Internal.copyOf(rep_sint32); builder.rep_fixed32 = Internal.copyOf(rep_fixed32); builder.rep_sfixed32 = Internal.copyOf(rep_sfixed32); builder.rep_int64 = Internal.copyOf(rep_int64); builder.rep_uint64 = Internal.copyOf(rep_uint64); builder.rep_sint64 = Internal.copyOf(rep_sint64); builder.rep_fixed64 = Internal.copyOf(rep_fixed64); builder.rep_sfixed64 = Internal.copyOf(rep_sfixed64); builder.rep_bool = Internal.copyOf(rep_bool); builder.rep_float = Internal.copyOf(rep_float); builder.rep_double = Internal.copyOf(rep_double); builder.rep_string = Internal.copyOf(rep_string); builder.rep_bytes = Internal.copyOf(rep_bytes); builder.rep_nested_enum = Internal.copyOf(rep_nested_enum); builder.rep_nested_message = Internal.copyOf(rep_nested_message); builder.pack_int32 = Internal.copyOf(pack_int32); builder.pack_uint32 = Internal.copyOf(pack_uint32); builder.pack_sint32 = Internal.copyOf(pack_sint32); builder.pack_fixed32 = Internal.copyOf(pack_fixed32); builder.pack_sfixed32 = Internal.copyOf(pack_sfixed32); builder.pack_int64 = Internal.copyOf(pack_int64); builder.pack_uint64 = Internal.copyOf(pack_uint64); builder.pack_sint64 = Internal.copyOf(pack_sint64); builder.pack_fixed64 = Internal.copyOf(pack_fixed64); builder.pack_sfixed64 = Internal.copyOf(pack_sfixed64); builder.pack_bool = Internal.copyOf(pack_bool); builder.pack_float = Internal.copyOf(pack_float); builder.pack_double = Internal.copyOf(pack_double); builder.pack_nested_enum = Internal.copyOf(pack_nested_enum); builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.map_string_string = Internal.copyOf(map_string_string); builder.map_string_message = Internal.copyOf(map_string_message); builder.map_string_enum = Internal.copyOf(map_string_enum); builder.oneof_string = oneof_string; builder.oneof_int32 = oneof_int32; builder.oneof_nested_message = oneof_nested_message; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof AllTypes)) return false; AllTypes o = (AllTypes) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(my_int32, o.my_int32) && Internal.equals(my_uint32, o.my_uint32) && Internal.equals(my_sint32, o.my_sint32) && Internal.equals(my_fixed32, o.my_fixed32) && Internal.equals(my_sfixed32, o.my_sfixed32) && Internal.equals(my_int64, o.my_int64) && Internal.equals(my_uint64, o.my_uint64) && Internal.equals(my_sint64, o.my_sint64) && Internal.equals(my_fixed64, o.my_fixed64) && Internal.equals(my_sfixed64, o.my_sfixed64) && Internal.equals(my_bool, o.my_bool) && Internal.equals(my_float, o.my_float) && Internal.equals(my_double, o.my_double) && Internal.equals(my_string, o.my_string) && Internal.equals(my_bytes, o.my_bytes) && Internal.equals(nested_enum, o.nested_enum) && Internal.equals(nested_message, o.nested_message) && Internal.equals(opt_int32, o.opt_int32) && Internal.equals(opt_uint32, o.opt_uint32) && Internal.equals(opt_sint32, o.opt_sint32) && Internal.equals(opt_fixed32, o.opt_fixed32) && Internal.equals(opt_sfixed32, o.opt_sfixed32) && Internal.equals(opt_int64, o.opt_int64) && Internal.equals(opt_uint64, o.opt_uint64) && Internal.equals(opt_sint64, o.opt_sint64) && Internal.equals(opt_fixed64, o.opt_fixed64) && Internal.equals(opt_sfixed64, o.opt_sfixed64) && Internal.equals(opt_bool, o.opt_bool) && Internal.equals(opt_float, o.opt_float) && Internal.equals(opt_double, o.opt_double) && Internal.equals(opt_string, o.opt_string) && Internal.equals(opt_bytes, o.opt_bytes) && rep_int32.equals(o.rep_int32) && rep_uint32.equals(o.rep_uint32) && rep_sint32.equals(o.rep_sint32) && rep_fixed32.equals(o.rep_fixed32) && rep_sfixed32.equals(o.rep_sfixed32) && rep_int64.equals(o.rep_int64) && rep_uint64.equals(o.rep_uint64) && rep_sint64.equals(o.rep_sint64) && rep_fixed64.equals(o.rep_fixed64) && rep_sfixed64.equals(o.rep_sfixed64) && rep_bool.equals(o.rep_bool) && rep_float.equals(o.rep_float) && rep_double.equals(o.rep_double) && rep_string.equals(o.rep_string) && rep_bytes.equals(o.rep_bytes) && rep_nested_enum.equals(o.rep_nested_enum) && rep_nested_message.equals(o.rep_nested_message) && pack_int32.equals(o.pack_int32) && pack_uint32.equals(o.pack_uint32) && pack_sint32.equals(o.pack_sint32) && pack_fixed32.equals(o.pack_fixed32) && pack_sfixed32.equals(o.pack_sfixed32) && pack_int64.equals(o.pack_int64) && pack_uint64.equals(o.pack_uint64) && pack_sint64.equals(o.pack_sint64) && pack_fixed64.equals(o.pack_fixed64) && pack_sfixed64.equals(o.pack_sfixed64) && pack_bool.equals(o.pack_bool) && pack_float.equals(o.pack_float) && pack_double.equals(o.pack_double) && pack_nested_enum.equals(o.pack_nested_enum) && map_int32_int32.equals(o.map_int32_int32) && map_string_string.equals(o.map_string_string) && map_string_message.equals(o.map_string_message) && map_string_enum.equals(o.map_string_enum) && Internal.equals(oneof_string, o.oneof_string) && Internal.equals(oneof_int32, o.oneof_int32) && Internal.equals(oneof_nested_message, o.oneof_nested_message); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + Integer.hashCode(my_int32); result = result * 37 + Integer.hashCode(my_uint32); result = result * 37 + Integer.hashCode(my_sint32); result = result * 37 + Integer.hashCode(my_fixed32); result = result * 37 + Integer.hashCode(my_sfixed32); result = result * 37 + Long.hashCode(my_int64); result = result * 37 + Long.hashCode(my_uint64); result = result * 37 + Long.hashCode(my_sint64); result = result * 37 + Long.hashCode(my_fixed64); result = result * 37 + Long.hashCode(my_sfixed64); result = result * 37 + Boolean.hashCode(my_bool); result = result * 37 + Float.hashCode(my_float); result = result * 37 + Double.hashCode(my_double); result = result * 37 + (my_string != null ? my_string.hashCode() : 0); result = result * 37 + (my_bytes != null ? my_bytes.hashCode() : 0); result = result * 37 + (nested_enum != null ? nested_enum.hashCode() : 0); result = result * 37 + (nested_message != null ? nested_message.hashCode() : 0); result = result * 37 + (opt_int32 != null ? opt_int32.hashCode() : 0); result = result * 37 + (opt_uint32 != null ? opt_uint32.hashCode() : 0); result = result * 37 + (opt_sint32 != null ? opt_sint32.hashCode() : 0); result = result * 37 + (opt_fixed32 != null ? opt_fixed32.hashCode() : 0); result = result * 37 + (opt_sfixed32 != null ? opt_sfixed32.hashCode() : 0); result = result * 37 + (opt_int64 != null ? opt_int64.hashCode() : 0); result = result * 37 + (opt_uint64 != null ? opt_uint64.hashCode() : 0); result = result * 37 + (opt_sint64 != null ? opt_sint64.hashCode() : 0); result = result * 37 + (opt_fixed64 != null ? opt_fixed64.hashCode() : 0); result = result * 37 + (opt_sfixed64 != null ? opt_sfixed64.hashCode() : 0); result = result * 37 + (opt_bool != null ? opt_bool.hashCode() : 0); result = result * 37 + (opt_float != null ? opt_float.hashCode() : 0); result = result * 37 + (opt_double != null ? opt_double.hashCode() : 0); result = result * 37 + (opt_string != null ? opt_string.hashCode() : 0); result = result * 37 + (opt_bytes != null ? opt_bytes.hashCode() : 0); result = result * 37 + rep_int32.hashCode(); result = result * 37 + rep_uint32.hashCode(); result = result * 37 + rep_sint32.hashCode(); result = result * 37 + rep_fixed32.hashCode(); result = result * 37 + rep_sfixed32.hashCode(); result = result * 37 + rep_int64.hashCode(); result = result * 37 + rep_uint64.hashCode(); result = result * 37 + rep_sint64.hashCode(); result = result * 37 + rep_fixed64.hashCode(); result = result * 37 + rep_sfixed64.hashCode(); result = result * 37 + rep_bool.hashCode(); result = result * 37 + rep_float.hashCode(); result = result * 37 + rep_double.hashCode(); result = result * 37 + rep_string.hashCode(); result = result * 37 + rep_bytes.hashCode(); result = result * 37 + rep_nested_enum.hashCode(); result = result * 37 + rep_nested_message.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + pack_uint32.hashCode(); result = result * 37 + pack_sint32.hashCode(); result = result * 37 + pack_fixed32.hashCode(); result = result * 37 + pack_sfixed32.hashCode(); result = result * 37 + pack_int64.hashCode(); result = result * 37 + pack_uint64.hashCode(); result = result * 37 + pack_sint64.hashCode(); result = result * 37 + pack_fixed64.hashCode(); result = result * 37 + pack_sfixed64.hashCode(); result = result * 37 + pack_bool.hashCode(); result = result * 37 + pack_float.hashCode(); result = result * 37 + pack_double.hashCode(); result = result * 37 + pack_nested_enum.hashCode(); result = result * 37 + map_int32_int32.hashCode(); result = result * 37 + map_string_string.hashCode(); result = result * 37 + map_string_message.hashCode(); result = result * 37 + map_string_enum.hashCode(); result = result * 37 + (oneof_string != null ? oneof_string.hashCode() : 0); result = result * 37 + (oneof_int32 != null ? oneof_int32.hashCode() : 0); result = result * 37 + (oneof_nested_message != null ? oneof_nested_message.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<AllTypes, Builder> { public int my_int32; public int my_uint32; public int my_sint32; public int my_fixed32; public int my_sfixed32; public long my_int64; public long my_uint64; public long my_sint64; public long my_fixed64; public long my_sfixed64; public boolean my_bool; public float my_float; public double my_double; public String my_string; public ByteString my_bytes; public NestedEnum nested_enum; public NestedMessage nested_message; public Integer opt_int32; public Integer opt_uint32; public Integer opt_sint32; public Integer opt_fixed32; public Integer opt_sfixed32; public Long opt_int64; public Long opt_uint64; public Long opt_sint64; public Long opt_fixed64; public Long opt_sfixed64; public Boolean opt_bool; public Float opt_float; public Double opt_double; public String opt_string; public ByteString opt_bytes; public List<Integer> rep_int32; public List<Integer> rep_uint32; public List<Integer> rep_sint32; public List<Integer> rep_fixed32; public List<Integer> rep_sfixed32; public List<Long> rep_int64; public List<Long> rep_uint64; public List<Long> rep_sint64; public List<Long> rep_fixed64; public List<Long> rep_sfixed64; public List<Boolean> rep_bool; public List<Float> rep_float; public List<Double> rep_double; public List<String> rep_string; public List<ByteString> rep_bytes; public List<NestedEnum> rep_nested_enum; public List<NestedMessage> rep_nested_message; public List<Integer> pack_int32; public List<Integer> pack_uint32; public List<Integer> pack_sint32; public List<Integer> pack_fixed32; public List<Integer> pack_sfixed32; public List<Long> pack_int64; public List<Long> pack_uint64; public List<Long> pack_sint64; public List<Long> pack_fixed64; public List<Long> pack_sfixed64; public List<Boolean> pack_bool; public List<Float> pack_float; public List<Double> pack_double; public List<NestedEnum> pack_nested_enum; public Map<Integer, Integer> map_int32_int32; public Map<String, String> map_string_string; public Map<String, NestedMessage> map_string_message; public Map<String, NestedEnum> map_string_enum; public String oneof_string; public Integer oneof_int32; public NestedMessage oneof_nested_message; public Builder() { my_int32 = 0; my_uint32 = 0; my_sint32 = 0; my_fixed32 = 0; my_sfixed32 = 0; my_int64 = 0L; my_uint64 = 0L; my_sint64 = 0L; my_fixed64 = 0L; my_sfixed64 = 0L; my_bool = false; my_float = 0f; my_double = 0.0; my_string = ""; my_bytes = ByteString.EMPTY; nested_enum = NestedEnum.UNKNOWN; rep_int32 = Internal.newMutableList(); rep_uint32 = Internal.newMutableList(); rep_sint32 = Internal.newMutableList(); rep_fixed32 = Internal.newMutableList(); rep_sfixed32 = Internal.newMutableList(); rep_int64 = Internal.newMutableList(); rep_uint64 = Internal.newMutableList(); rep_sint64 = Internal.newMutableList(); rep_fixed64 = Internal.newMutableList(); rep_sfixed64 = Internal.newMutableList(); rep_bool = Internal.newMutableList(); rep_float = Internal.newMutableList(); rep_double = Internal.newMutableList(); rep_string = Internal.newMutableList(); rep_bytes = Internal.newMutableList(); rep_nested_enum = Internal.newMutableList(); rep_nested_message = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); pack_uint32 = Internal.newMutableList(); pack_sint32 = Internal.newMutableList(); pack_fixed32 = Internal.newMutableList(); pack_sfixed32 = Internal.newMutableList(); pack_int64 = Internal.newMutableList(); pack_uint64 = Internal.newMutableList(); pack_sint64 = Internal.newMutableList(); pack_fixed64 = Internal.newMutableList(); pack_sfixed64 = Internal.newMutableList(); pack_bool = Internal.newMutableList(); pack_float = Internal.newMutableList(); pack_double = Internal.newMutableList(); pack_nested_enum = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); map_string_string = Internal.newMutableMap(); map_string_message = Internal.newMutableMap(); map_string_enum = Internal.newMutableMap(); } public Builder my_int32(int my_int32) { this.my_int32 = my_int32; return this; } public Builder my_uint32(int my_uint32) { this.my_uint32 = my_uint32; return this; } public Builder my_sint32(int my_sint32) { this.my_sint32 = my_sint32; return this; } public Builder my_fixed32(int my_fixed32) { this.my_fixed32 = my_fixed32; return this; } public Builder my_sfixed32(int my_sfixed32) { this.my_sfixed32 = my_sfixed32; return this; } public Builder my_int64(long my_int64) { this.my_int64 = my_int64; return this; } public Builder my_uint64(long my_uint64) { this.my_uint64 = my_uint64; return this; } public Builder my_sint64(long my_sint64) { this.my_sint64 = my_sint64; return this; } public Builder my_fixed64(long my_fixed64) { this.my_fixed64 = my_fixed64; return this; } public Builder my_sfixed64(long my_sfixed64) { this.my_sfixed64 = my_sfixed64; return this; } public Builder my_bool(boolean my_bool) { this.my_bool = my_bool; return this; } public Builder my_float(float my_float) { this.my_float = my_float; return this; } public Builder my_double(double my_double) { this.my_double = my_double; return this; } public Builder my_string(String my_string) { this.my_string = my_string; return this; } public Builder my_bytes(ByteString my_bytes) { this.my_bytes = my_bytes; return this; } public Builder nested_enum(NestedEnum nested_enum) { this.nested_enum = nested_enum; return this; } public Builder nested_message(NestedMessage nested_message) { this.nested_message = nested_message; return this; } public Builder opt_int32(Integer opt_int32) { this.opt_int32 = opt_int32; return this; } public Builder opt_uint32(Integer opt_uint32) { this.opt_uint32 = opt_uint32; return this; } public Builder opt_sint32(Integer opt_sint32) { this.opt_sint32 = opt_sint32; return this; } public Builder opt_fixed32(Integer opt_fixed32) { this.opt_fixed32 = opt_fixed32; return this; } public Builder opt_sfixed32(Integer opt_sfixed32) { this.opt_sfixed32 = opt_sfixed32; return this; } public Builder opt_int64(Long opt_int64) { this.opt_int64 = opt_int64; return this; } public Builder opt_uint64(Long opt_uint64) { this.opt_uint64 = opt_uint64; return this; } public Builder opt_sint64(Long opt_sint64) { this.opt_sint64 = opt_sint64; return this; } public Builder opt_fixed64(Long opt_fixed64) { this.opt_fixed64 = opt_fixed64; return this; } public Builder opt_sfixed64(Long opt_sfixed64) { this.opt_sfixed64 = opt_sfixed64; return this; } public Builder opt_bool(Boolean opt_bool) { this.opt_bool = opt_bool; return this; } public Builder opt_float(Float opt_float) { this.opt_float = opt_float; return this; } public Builder opt_double(Double opt_double) { this.opt_double = opt_double; return this; } public Builder opt_string(String opt_string) { this.opt_string = opt_string; return this; } public Builder opt_bytes(ByteString opt_bytes) { this.opt_bytes = opt_bytes; return this; } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder rep_uint32(List<Integer> rep_uint32) { Internal.checkElementsNotNull(rep_uint32); this.rep_uint32 = rep_uint32; return this; } public Builder rep_sint32(List<Integer> rep_sint32) { Internal.checkElementsNotNull(rep_sint32); this.rep_sint32 = rep_sint32; return this; } public Builder rep_fixed32(List<Integer> rep_fixed32) { Internal.checkElementsNotNull(rep_fixed32); this.rep_fixed32 = rep_fixed32; return this; } public Builder rep_sfixed32(List<Integer> rep_sfixed32) { Internal.checkElementsNotNull(rep_sfixed32); this.rep_sfixed32 = rep_sfixed32; return this; } public Builder rep_int64(List<Long> rep_int64) { Internal.checkElementsNotNull(rep_int64); this.rep_int64 = rep_int64; return this; } public Builder rep_uint64(List<Long> rep_uint64) { Internal.checkElementsNotNull(rep_uint64); this.rep_uint64 = rep_uint64; return this; } public Builder rep_sint64(List<Long> rep_sint64) { Internal.checkElementsNotNull(rep_sint64); this.rep_sint64 = rep_sint64; return this; } public Builder rep_fixed64(List<Long> rep_fixed64) { Internal.checkElementsNotNull(rep_fixed64); this.rep_fixed64 = rep_fixed64; return this; } public Builder rep_sfixed64(List<Long> rep_sfixed64) { Internal.checkElementsNotNull(rep_sfixed64); this.rep_sfixed64 = rep_sfixed64; return this; } public Builder rep_bool(List<Boolean> rep_bool) { Internal.checkElementsNotNull(rep_bool); this.rep_bool = rep_bool; return this; } public Builder rep_float(List<Float> rep_float) { Internal.checkElementsNotNull(rep_float); this.rep_float = rep_float; return this; } public Builder rep_double(List<Double> rep_double) { Internal.checkElementsNotNull(rep_double); this.rep_double = rep_double; return this; } public Builder rep_string(List<String> rep_string) { Internal.checkElementsNotNull(rep_string); this.rep_string = rep_string; return this; } public Builder rep_bytes(List<ByteString> rep_bytes) { Internal.checkElementsNotNull(rep_bytes); this.rep_bytes = rep_bytes; return this; } public Builder rep_nested_enum(List<NestedEnum> rep_nested_enum) { Internal.checkElementsNotNull(rep_nested_enum); this.rep_nested_enum = rep_nested_enum; return this; } public Builder rep_nested_message(List<NestedMessage> rep_nested_message) { Internal.checkElementsNotNull(rep_nested_message); this.rep_nested_message = rep_nested_message; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder pack_uint32(List<Integer> pack_uint32) { Internal.checkElementsNotNull(pack_uint32); this.pack_uint32 = pack_uint32; return this; } public Builder pack_sint32(List<Integer> pack_sint32) { Internal.checkElementsNotNull(pack_sint32); this.pack_sint32 = pack_sint32; return this; } public Builder pack_fixed32(List<Integer> pack_fixed32) { Internal.checkElementsNotNull(pack_fixed32); this.pack_fixed32 = pack_fixed32; return this; } public Builder pack_sfixed32(List<Integer> pack_sfixed32) { Internal.checkElementsNotNull(pack_sfixed32); this.pack_sfixed32 = pack_sfixed32; return this; } public Builder pack_int64(List<Long> pack_int64) { Internal.checkElementsNotNull(pack_int64); this.pack_int64 = pack_int64; return this; } public Builder pack_uint64(List<Long> pack_uint64) { Internal.checkElementsNotNull(pack_uint64); this.pack_uint64 = pack_uint64; return this; } public Builder pack_sint64(List<Long> pack_sint64) { Internal.checkElementsNotNull(pack_sint64); this.pack_sint64 = pack_sint64; return this; } public Builder pack_fixed64(List<Long> pack_fixed64) { Internal.checkElementsNotNull(pack_fixed64); this.pack_fixed64 = pack_fixed64; return this; } public Builder pack_sfixed64(List<Long> pack_sfixed64) { Internal.checkElementsNotNull(pack_sfixed64); this.pack_sfixed64 = pack_sfixed64; return this; } public Builder pack_bool(List<Boolean> pack_bool) { Internal.checkElementsNotNull(pack_bool); this.pack_bool = pack_bool; return this; } public Builder pack_float(List<Float> pack_float) { Internal.checkElementsNotNull(pack_float); this.pack_float = pack_float; return this; } public Builder pack_double(List<Double> pack_double) { Internal.checkElementsNotNull(pack_double); this.pack_double = pack_double; return this; } public Builder pack_nested_enum(List<NestedEnum> pack_nested_enum) { Internal.checkElementsNotNull(pack_nested_enum); this.pack_nested_enum = pack_nested_enum; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } public Builder map_string_string(Map<String, String> map_string_string) { Internal.checkElementsNotNull(map_string_string); this.map_string_string = map_string_string; return this; } public Builder map_string_message(Map<String, NestedMessage> map_string_message) { Internal.checkElementsNotNull(map_string_message); this.map_string_message = map_string_message; return this; } public Builder map_string_enum(Map<String, NestedEnum> map_string_enum) { Internal.checkElementsNotNull(map_string_enum); this.map_string_enum = map_string_enum; return this; } public Builder oneof_string(String oneof_string) { this.oneof_string = oneof_string; this.oneof_int32 = null; this.oneof_nested_message = null; return this; } public Builder oneof_int32(Integer oneof_int32) { this.oneof_int32 = oneof_int32; this.oneof_string = null; this.oneof_nested_message = null; return this; } public Builder oneof_nested_message(NestedMessage oneof_nested_message) { this.oneof_nested_message = oneof_nested_message; this.oneof_string = null; this.oneof_int32 = null; return this; } @Override public AllTypes build() { return new AllTypes(this, super.buildUnknownFields()); } } public enum NestedEnum implements WireEnum { UNKNOWN(0), A(1); public static final ProtoAdapter<NestedEnum> ADAPTER = ProtoAdapter.newEnumAdapter(NestedEnum.class); private final int value; NestedEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static NestedEnum fromValue(int value) { switch (value) { case 0: return UNKNOWN; case 1: return A; default: return null; } } @Override public int getValue() { return value; } } public static final class NestedMessage extends Message<NestedMessage, NestedMessage.Builder> { public static final ProtoAdapter<NestedMessage> ADAPTER = ProtoAdapter.newMessageAdapter(NestedMessage.class, "type.googleapis.com/squareup.proto3.AllTypes.NestedMessage", Syntax.PROTO_3); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.OMIT_IDENTITY ) public final int a; public NestedMessage(int a) { this(a, ByteString.EMPTY); } public NestedMessage(int a, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedMessage)) return false; NestedMessage o = (NestedMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + Integer.hashCode(a); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<NestedMessage, Builder> { public int a; public Builder() { a = 0; } public Builder a(int a) { this.a = a; return this; } @Override public NestedMessage build() { return new NestedMessage(a, super.buildUnknownFields()); } } } }
7,110
0
Create_ds/wire/samples/simple-sample/src/main/java/com/squareup
Create_ds/wire/samples/simple-sample/src/main/java/com/squareup/dinosaurs/Sample.java
/* * Copyright (C) 2015 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.dinosaurs; import com.squareup.geology.Period; import java.io.IOException; import java.util.Arrays; import okio.ByteString; public final class Sample { public void run() throws IOException { // Create an immutable value object with the Builder API. Dinosaur stegosaurus = new Dinosaur.Builder() .name("Stegosaurus") .period(Period.JURASSIC) .length_meters(9.0) .mass_kilograms(5_000.0) .picture_urls(Arrays.asList("http://goo.gl/LD5KY5", "http://goo.gl/VYRM67")) .build(); // Encode that value to bytes, and print that as base64. byte[] stegosaurusEncoded = Dinosaur.ADAPTER.encode(stegosaurus); System.out.println(ByteString.of(stegosaurusEncoded).base64()); // Decode base64 bytes, and decode those bytes as a dinosaur. ByteString tyrannosaurusEncoded = ByteString.decodeBase64( "Cg1UeXJhbm5vc2F1cnVzEmhodHRwOi8vdmln" + "bmV0dGUxLndpa2lhLm5vY29va2llLm5ldC9qdXJhc3NpY3BhcmsvaW1hZ2VzLzYvNmEvTGVnbzUuanBnL3Jldmlz" + "aW9uL2xhdGVzdD9jYj0yMDE1MDMxOTAxMTIyMRJtaHR0cDovL3ZpZ25ldHRlMy53aWtpYS5ub2Nvb2tpZS5uZXQv" + "anVyYXNzaWNwYXJrL2ltYWdlcy81LzUwL1JleHlfcHJlcGFyaW5nX2Zvcl9iYXR0bGVfd2l0aF9JbmRvbWludXNf" + "cmV4LmpwZxmamZmZmZkoQCEAAAAAAJC6QCgB"); Dinosaur tyrannosaurus = Dinosaur.ADAPTER.decode(tyrannosaurusEncoded.toByteArray()); // Print both of our dinosaurs. System.out.println(stegosaurus.name + " is " + stegosaurus.length_meters + " meters long!"); System.out.println(tyrannosaurus.name + " weighs " + tyrannosaurus.mass_kilograms + " kilos!"); } public static void main(String[] args) throws IOException { new Sample().run(); } }
7,111
0
Create_ds/wire/samples/wire-codegen-sample/src/main/java/com/squareup/wire
Create_ds/wire/samples/wire-codegen-sample/src/main/java/com/squareup/wire/sample/ServiceGenerator.java
/* * Copyright (C) 2016 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.wire.sample; import static javax.lang.model.element.Modifier.ABSTRACT; import static javax.lang.model.element.Modifier.PUBLIC; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.wire.java.JavaGenerator; import com.squareup.wire.schema.ProtoType; import com.squareup.wire.schema.Rpc; import com.squareup.wire.schema.Service; final class ServiceGenerator { final JavaGenerator javaGenerator; ServiceGenerator(JavaGenerator javaGenerator) { this.javaGenerator = javaGenerator; } public TypeSpec api(Service service) { ClassName apiName = (ClassName) javaGenerator.typeName(service.type()); TypeSpec.Builder typeBuilder = TypeSpec.interfaceBuilder(apiName.simpleName()); typeBuilder.addModifiers(PUBLIC); if (!service.documentation().isEmpty()) { typeBuilder.addJavadoc("$L\n", service.documentation()); } for (Rpc rpc : service.rpcs()) { ProtoType requestType = rpc.getRequestType(); TypeName requestJavaType = javaGenerator.typeName(requestType); ProtoType responseType = rpc.getResponseType(); TypeName responseJavaType = javaGenerator.typeName(responseType); MethodSpec.Builder rpcBuilder = MethodSpec.methodBuilder(rpc.getName()); rpcBuilder.addModifiers(PUBLIC, ABSTRACT); rpcBuilder.returns(responseJavaType); rpcBuilder.addParameter(requestJavaType, "request"); if (!rpc.getDocumentation().isEmpty()) { rpcBuilder.addJavadoc("$L\n", rpc.getDocumentation()); } typeBuilder.addMethod(rpcBuilder.build()); } return typeBuilder.build(); } }
7,112
0
Create_ds/wire/samples/android-lib-java-sample/src/main/java/com/squareup/wire/android/lib
Create_ds/wire/samples/android-lib-java-sample/src/main/java/com/squareup/wire/android/lib/java/SomeObject.java
/* * Copyright (C) 2021 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.wire.android.lib.java; public final class SomeObject { public SomeObject() { System.out.println(new SomeText("Hi")); } }
7,113
0
Create_ds/wire/samples/android-app-java-sample/src/main/java/com/squareup/wire/android/app
Create_ds/wire/samples/android-app-java-sample/src/main/java/com/squareup/wire/android/app/java/MainActivity.java
/* * Copyright (C) 2021 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.wire.android.app.java; import android.os.Bundle; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SomeText someText = new SomeText("Hi"); ((TextView) findViewById(R.id.text_view)).setText(someText.value); } }
7,114
0
Create_ds/wire/wire-gradle-plugin/src/test/projects/java-project-java-protos/src/main/java/com/squareup
Create_ds/wire/wire-gradle-plugin/src/test/projects/java-project-java-protos/src/main/java/com/squareup/dinosaurs/Sample.java
/* * Copyright (C) 2023 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.dinosaurs; import com.squareup.geology.Period; import java.io.IOException; import java.util.Arrays; import okio.ByteString; public final class Sample { public void run() throws IOException { // Create an immutable value object with the Builder API. Dinosaur stegosaurus = new Dinosaur.Builder() .name("Stegosaurus") .period(Period.JURASSIC) .length_meters(9.0) .mass_kilograms(5_000.0) .picture_urls(Arrays.asList("http://goo.gl/LD5KY5", "http://goo.gl/VYRM67")) .build(); // Encode that value to bytes, and print that as base64. byte[] stegosaurusEncoded = Dinosaur.ADAPTER.encode(stegosaurus); System.out.println(ByteString.of(stegosaurusEncoded).base64()); } public static void main(String[] args) throws IOException { new Sample().run(); } }
7,115
0
Create_ds/wire/wire-gradle-plugin/src/test/projects/java-project-kotlin-protos/src/main/java/com/squareup
Create_ds/wire/wire-gradle-plugin/src/test/projects/java-project-kotlin-protos/src/main/java/com/squareup/dinosaurs/Sample.java
/* * Copyright (C) 2023 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.dinosaurs; import com.squareup.geology.Period; import java.io.IOException; import java.util.Arrays; import okio.ByteString; public final class Sample { public void run() throws IOException { // Create an immutable value object with the Builder API. Dinosaur stegosaurus = new Dinosaur.Builder() .name("Stegosaurus") .period(Period.JURASSIC) .length_meters(9.0) .mass_kilograms(5_000.0) .picture_urls(Arrays.asList("http://goo.gl/LD5KY5", "http://goo.gl/VYRM67")) .build(); // Encode that value to bytes, and print that as base64. byte[] stegosaurusEncoded = Dinosaur.ADAPTER.encode(stegosaurus); System.out.println(ByteString.of(stegosaurusEncoded).base64()); } public static void main(String[] args) throws IOException { new Sample().run(); } }
7,116
0
Create_ds/wire/wire-moshi-adapter/src/test/java/squareup/proto2
Create_ds/wire/wire-moshi-adapter/src/test/java/squareup/proto2/keywords/KeywordJava.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.keywords.KeywordJava in keyword_java.proto package squareup.proto2.keywords; import com.squareup.wire.EnumAdapter; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireEnumConstant; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Boolean; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import java.util.Map; import okio.ByteString; public final class KeywordJava extends Message<KeywordJava, KeywordJava.Builder> { public static final ProtoAdapter<KeywordJava> ADAPTER = new ProtoAdapter_KeywordJava(); private static final long serialVersionUID = 0L; public static final String DEFAULT_FINAL_ = ""; public static final Boolean DEFAULT_PUBLIC_ = false; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "final" ) public final String final_; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REQUIRED, declaredName = "public" ) public final Boolean public_; @WireField( tag = 3, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "package" ) public final Map<String, String> package_; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED, declaredName = "return" ) public final List<Boolean> return_; @WireField( tag = 5, adapter = "squareup.proto2.keywords.KeywordJava$KeywordJavaEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<KeywordJavaEnum> enums; public KeywordJava(String final_, Boolean public_, Map<String, String> package_, List<Boolean> return_, List<KeywordJavaEnum> enums) { this(final_, public_, package_, return_, enums, ByteString.EMPTY); } public KeywordJava(String final_, Boolean public_, Map<String, String> package_, List<Boolean> return_, List<KeywordJavaEnum> enums, ByteString unknownFields) { super(ADAPTER, unknownFields); this.final_ = final_; this.public_ = public_; this.package_ = Internal.immutableCopyOf("package_", package_); this.return_ = Internal.immutableCopyOf("return_", return_); this.enums = Internal.immutableCopyOf("enums", enums); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.final_ = final_; builder.public_ = public_; builder.package_ = Internal.copyOf(package_); builder.return_ = Internal.copyOf(return_); builder.enums = Internal.copyOf(enums); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof KeywordJava)) return false; KeywordJava o = (KeywordJava) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(final_, o.final_) && public_.equals(o.public_) && package_.equals(o.package_) && return_.equals(o.return_) && enums.equals(o.enums); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (final_ != null ? final_.hashCode() : 0); result = result * 37 + public_.hashCode(); result = result * 37 + package_.hashCode(); result = result * 37 + return_.hashCode(); result = result * 37 + enums.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (final_ != null) builder.append(", final=").append(Internal.sanitize(final_)); builder.append(", public=").append(public_); if (!package_.isEmpty()) builder.append(", package=").append(package_); if (!return_.isEmpty()) builder.append(", return=").append(return_); if (!enums.isEmpty()) builder.append(", enums=").append(enums); return builder.replace(0, 2, "KeywordJava{").append('}').toString(); } public static final class Builder extends Message.Builder<KeywordJava, Builder> { public String final_; public Boolean public_; public Map<String, String> package_; public List<Boolean> return_; public List<KeywordJavaEnum> enums; public Builder() { package_ = Internal.newMutableMap(); return_ = Internal.newMutableList(); enums = Internal.newMutableList(); } public Builder final_(String final_) { this.final_ = final_; return this; } public Builder public_(Boolean public_) { this.public_ = public_; return this; } public Builder package_(Map<String, String> package_) { Internal.checkElementsNotNull(package_); this.package_ = package_; return this; } public Builder return_(List<Boolean> return_) { Internal.checkElementsNotNull(return_); this.return_ = return_; return this; } public Builder enums(List<KeywordJavaEnum> enums) { Internal.checkElementsNotNull(enums); this.enums = enums; return this; } @Override public KeywordJava build() { if (public_ == null) { throw Internal.missingRequiredFields(public_, "public"); } return new KeywordJava(final_, public_, package_, return_, enums, super.buildUnknownFields()); } } public enum KeywordJavaEnum implements WireEnum { @WireEnumConstant( declaredName = "final" ) final_(0), @WireEnumConstant( declaredName = "public" ) public_(1), @WireEnumConstant( declaredName = "package" ) package_(2), @WireEnumConstant( declaredName = "return" ) return_(3); public static final ProtoAdapter<KeywordJavaEnum> ADAPTER = new ProtoAdapter_KeywordJavaEnum(); private final int value; KeywordJavaEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static KeywordJavaEnum fromValue(int value) { switch (value) { case 0: return final_; case 1: return public_; case 2: return package_; case 3: return return_; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_KeywordJavaEnum extends EnumAdapter<KeywordJavaEnum> { ProtoAdapter_KeywordJavaEnum() { super(KeywordJavaEnum.class, Syntax.PROTO_2, KeywordJavaEnum.final_); } @Override protected KeywordJavaEnum fromValue(int value) { return KeywordJavaEnum.fromValue(value); } } } private static final class ProtoAdapter_KeywordJava extends ProtoAdapter<KeywordJava> { private ProtoAdapter<Map<String, String>> package_; public ProtoAdapter_KeywordJava() { super(FieldEncoding.LENGTH_DELIMITED, KeywordJava.class, "type.googleapis.com/squareup.proto2.keywords.KeywordJava", Syntax.PROTO_2, null, "keyword_java.proto"); } @Override public int encodedSize(KeywordJava value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.final_); result += ProtoAdapter.BOOL.encodedSizeWithTag(2, value.public_); result += package_Adapter().encodedSizeWithTag(3, value.package_); result += ProtoAdapter.BOOL.asRepeated().encodedSizeWithTag(4, value.return_); result += KeywordJavaEnum.ADAPTER.asRepeated().encodedSizeWithTag(5, value.enums); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, KeywordJava value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.final_); ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.public_); package_Adapter().encodeWithTag(writer, 3, value.package_); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 4, value.return_); KeywordJavaEnum.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.enums); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, KeywordJava value) throws IOException { writer.writeBytes(value.unknownFields()); KeywordJavaEnum.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.enums); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 4, value.return_); package_Adapter().encodeWithTag(writer, 3, value.package_); ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.public_); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.final_); } @Override public KeywordJava decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.final_(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.public_(ProtoAdapter.BOOL.decode(reader)); break; case 3: builder.package_.putAll(package_Adapter().decode(reader)); break; case 4: builder.return_.add(ProtoAdapter.BOOL.decode(reader)); break; case 5: { try { builder.enums.add(KeywordJavaEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public KeywordJava redact(KeywordJava value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } private ProtoAdapter<Map<String, String>> package_Adapter() { ProtoAdapter<Map<String, String>> result = package_; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.STRING); package_ = result; } return result; } } }
7,117
0
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/MoshiTest.java
/* * Copyright (C) 2018 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.wire; import static org.assertj.core.api.Assertions.assertThat; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.squareup.wire.json.JsonUtils; import com.squareup.wire.proto2.RepeatedPackedAndMap; import com.squareup.wire.proto2.alltypes.AllTypes; import java.io.File; import java.io.IOException; import java.util.Arrays; import okio.ByteString; import okio.Okio; import org.junit.Test; import squareup.proto2.keywords.KeywordJava; import squareup.proto2.keywords.KeywordJava.KeywordJavaEnum; import squareup.proto2.keywords.KeywordKotlin; import squareup.proto2.keywords.KeywordKotlin.KeywordKotlinEnum; public class MoshiTest { private static final String ALL_TYPES_IDENTITY_JSON; static { try { ALL_TYPES_IDENTITY_JSON = Okio.buffer( Okio.source( new File( "../wire-tests/src/commonTest/shared/json", "all_types_identity_proto2.json"))) .readUtf8(); } catch (IOException e) { throw new RuntimeException(e); } } private static AllTypes.Builder createIdentityBuilder() { return new AllTypes.Builder() .opt_int32(0) .opt_uint32(0) .opt_sint32(0) .opt_fixed32(0) .opt_sfixed32(0) .opt_int64(0L) .opt_uint64(0L) .opt_sint64(0L) .opt_fixed64(0L) .opt_sfixed64(0L) .opt_bool(false) .opt_float(0F) .opt_double(0.0) .opt_string("") .opt_bytes(ByteString.EMPTY) .opt_nested_enum(AllTypes.NestedEnum.A) .opt_nested_message(null) .req_int32(0) .req_uint32(0) .req_sint32(0) .req_fixed32(0) .req_sfixed32(0) .req_int64(0L) .req_uint64(0L) .req_sint64(0L) .req_fixed64(0L) .req_sfixed64(0L) .req_bool(true) .req_float(0F) .req_double(0.0) .req_string("") .req_bytes(ByteString.EMPTY) .req_nested_enum(AllTypes.NestedEnum.A) .req_nested_message(new AllTypes.NestedMessage.Builder().a(0).build()); } private final Moshi moshi = new Moshi.Builder().add(new WireJsonAdapterFactory()).build(); @SuppressWarnings("ConstantConditions") @Test public void notIdentityOneOf() throws IOException { JsonAdapter<AllTypes> allTypesAdapter = moshi.adapter(AllTypes.class); AllTypes allTypes = createIdentityBuilder().oneof_int32(0).build(); assertThat(allTypesAdapter.toJson(allTypes)).contains("\"oneof_int32\":0"); AllTypes parsed = allTypesAdapter.fromJson(ALL_TYPES_IDENTITY_JSON); assertThat(parsed.oneof_int32).isNull(); String json = ALL_TYPES_IDENTITY_JSON.substring(0, ALL_TYPES_IDENTITY_JSON.length() - 2) + ",\"oneof_int32\":0}"; parsed = allTypesAdapter.fromJson(json); assertThat(parsed.oneof_int32).isEqualTo(0); } @SuppressWarnings("ConstantConditions") @Test public void nullRepeatedField() throws IOException { RepeatedPackedAndMap parsed = moshi .adapter(RepeatedPackedAndMap.class) .fromJson("{\"rep_int32\":null,\"pack_int32\":null,\"map_int32_int32\":null}"); assertThat(parsed.rep_int32).isEmpty(); assertThat(parsed.pack_int32).isEmpty(); assertThat(parsed.map_int32_int32).isEmpty(); } @Test public void usedKeywordsInKotlin() throws IOException { JsonAdapter<KeywordKotlin> adapter = moshi.adapter(KeywordKotlin.class); KeywordKotlin keyword = new KeywordKotlin.Builder() .object_("object") .when_(1) .enums( Arrays.asList( KeywordKotlinEnum.object_, KeywordKotlinEnum.when_, KeywordKotlinEnum.fun_, KeywordKotlinEnum.return_, KeywordKotlinEnum.open_, KeywordKotlinEnum.name_, KeywordKotlinEnum.ordinal_)) .build(); String json = adapter.toJson(keyword); JsonUtils.assertJsonEquals( "{\"object\":\"object\",\"when\":1, \"fun\":{}, \"return\":[], \"enums\":[\"object\", " + "\"when\", \"fun\", \"return\", \"open\", \"name\", \"ordinal\"]}", json); assertThat(adapter.fromJson(json)).isEqualTo(keyword); String generatedNamedJson = "{\"object_\":\"object\",\"when_\":1, \"fun_\":{}, \"return_\":[], " + "\"enums\":[\"object_\", \"when_\", \"fun_\", \"return_\", \"open_\", \"name_\", " + "\"ordinal_\"]}"; assertThat(adapter.fromJson(generatedNamedJson)).isEqualTo(keyword); } @Test public void usedKeywordsInJava() throws IOException { JsonAdapter<KeywordJava> adapter = moshi.adapter(KeywordJava.class); KeywordJava keyword = new KeywordJava.Builder() .public_(true) .final_("final") .enums( Arrays.asList( KeywordJavaEnum.final_, KeywordJavaEnum.public_, KeywordJavaEnum.package_, KeywordJavaEnum.return_)) .build(); String json = adapter.toJson(keyword); JsonUtils.assertJsonEquals( "{\"final\":\"final\", \"public\":true, \"package\":{}, \"return\":[], " + "\"enums\":[\"final\", \"public\", \"package\", \"return\"]}", json); assertThat(adapter.fromJson(json)).isEqualTo(keyword); String generatedNamedJson = "{\"final_\":\"final\", \"public_\":true, \"package_\":{}, " + "\"return_\":[], \"enums\":[\"final_\", \"public_\", \"package_\", \"return_\"]}"; assertThat(adapter.fromJson(generatedNamedJson)).isEqualTo(keyword); } @Test public void enumKeywordsAtRootInKotlin() throws IOException { JsonAdapter<KeywordKotlinEnum> adapter = moshi.adapter(KeywordKotlinEnum.class); KeywordKotlinEnum constant = KeywordKotlinEnum.object_; String json = adapter.toJson(constant); JsonUtils.assertJsonEquals("\"object\"", json); assertThat(adapter.fromJson(json)).isEqualTo(constant); String generatedNamedJson = "\"object_\""; assertThat(adapter.fromJson(generatedNamedJson)).isEqualTo(constant); } @Test public void enumKeywordsAtRootInJava() throws IOException { JsonAdapter<KeywordJavaEnum> adapter = moshi.adapter(KeywordJavaEnum.class); KeywordJavaEnum constant = KeywordJavaEnum.final_; String json = adapter.toJson(constant); JsonUtils.assertJsonEquals("\"final\"", json); assertThat(adapter.fromJson(json)).isEqualTo(constant); String generatedNamedJson = "\"final_\""; assertThat(adapter.fromJson(generatedNamedJson)).isEqualTo(constant); } }
7,118
0
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/RepeatedPackedAndMap.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.alltypes.RepeatedPackedAndMap in collection_types.proto package com.squareup.wire.proto2; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import java.util.Map; import okio.ByteString; public final class RepeatedPackedAndMap extends Message<RepeatedPackedAndMap, RepeatedPackedAndMap.Builder> { public static final ProtoAdapter<RepeatedPackedAndMap> ADAPTER = new ProtoAdapter_RepeatedPackedAndMap(); private static final long serialVersionUID = 0L; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_int32; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> pack_int32; @WireField( tag = 401, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Map<Integer, Integer> map_int32_int32; public RepeatedPackedAndMap(List<Integer> rep_int32, List<Integer> pack_int32, Map<Integer, Integer> map_int32_int32) { this(rep_int32, pack_int32, map_int32_int32, ByteString.EMPTY); } public RepeatedPackedAndMap(List<Integer> rep_int32, List<Integer> pack_int32, Map<Integer, Integer> map_int32_int32, ByteString unknownFields) { super(ADAPTER, unknownFields); this.rep_int32 = Internal.immutableCopyOf("rep_int32", rep_int32); this.pack_int32 = Internal.immutableCopyOf("pack_int32", pack_int32); this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", map_int32_int32); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.rep_int32 = Internal.copyOf(rep_int32); builder.pack_int32 = Internal.copyOf(pack_int32); builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RepeatedPackedAndMap)) return false; RepeatedPackedAndMap o = (RepeatedPackedAndMap) other; return unknownFields().equals(o.unknownFields()) && rep_int32.equals(o.rep_int32) && pack_int32.equals(o.pack_int32) && map_int32_int32.equals(o.map_int32_int32); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + rep_int32.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + map_int32_int32.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!rep_int32.isEmpty()) builder.append(", rep_int32=").append(rep_int32); if (!pack_int32.isEmpty()) builder.append(", pack_int32=").append(pack_int32); if (!map_int32_int32.isEmpty()) builder.append(", map_int32_int32=").append(map_int32_int32); return builder.replace(0, 2, "RepeatedPackedAndMap{").append('}').toString(); } public static final class Builder extends Message.Builder<RepeatedPackedAndMap, Builder> { public List<Integer> rep_int32; public List<Integer> pack_int32; public Map<Integer, Integer> map_int32_int32; public Builder() { rep_int32 = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } @Override public RepeatedPackedAndMap build() { return new RepeatedPackedAndMap(rep_int32, pack_int32, map_int32_int32, super.buildUnknownFields()); } } private static final class ProtoAdapter_RepeatedPackedAndMap extends ProtoAdapter<RepeatedPackedAndMap> { private ProtoAdapter<Map<Integer, Integer>> map_int32_int32; public ProtoAdapter_RepeatedPackedAndMap() { super(FieldEncoding.LENGTH_DELIMITED, RepeatedPackedAndMap.class, "type.googleapis.com/squareup.proto2.alltypes.RepeatedPackedAndMap", Syntax.PROTO_2, null, "collection_types.proto"); } @Override public int encodedSize(RepeatedPackedAndMap value) { int result = 0; result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(201, value.rep_int32); result += ProtoAdapter.INT32.asPacked().encodedSizeWithTag(301, value.pack_int32); result += map_int32_int32Adapter().encodedSizeWithTag(401, value.map_int32_int32); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RepeatedPackedAndMap value) throws IOException { ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 201, value.rep_int32); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 301, value.pack_int32); map_int32_int32Adapter().encodeWithTag(writer, 401, value.map_int32_int32); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RepeatedPackedAndMap value) throws IOException { writer.writeBytes(value.unknownFields()); map_int32_int32Adapter().encodeWithTag(writer, 401, value.map_int32_int32); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 301, value.pack_int32); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 201, value.rep_int32); } @Override public RepeatedPackedAndMap decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 201: builder.rep_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 301: builder.pack_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 401: builder.map_int32_int32.putAll(map_int32_int32Adapter().decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RepeatedPackedAndMap redact(RepeatedPackedAndMap value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } private ProtoAdapter<Map<Integer, Integer>> map_int32_int32Adapter() { ProtoAdapter<Map<Integer, Integer>> result = map_int32_int32; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.INT32, ProtoAdapter.INT32); map_int32_int32 = result; } return result; } } }
7,119
0
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/alltypes/AllTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.AllTypes in all_types_proto2.proto package com.squareup.wire.proto2.alltypes; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Boolean; import java.lang.Double; import java.lang.Float; import java.lang.Integer; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.List; import java.util.Map; import okio.ByteString; public final class AllTypes extends Message<AllTypes, AllTypes.Builder> { public static final ProtoAdapter<AllTypes> ADAPTER = ProtoAdapter.newMessageAdapter(AllTypes.class, "type.googleapis.com/squareup.proto2.AllTypes", Syntax.PROTO_2); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OPT_INT32 = 0; public static final Integer DEFAULT_OPT_UINT32 = 0; public static final Integer DEFAULT_OPT_SINT32 = 0; public static final Integer DEFAULT_OPT_FIXED32 = 0; public static final Integer DEFAULT_OPT_SFIXED32 = 0; public static final Long DEFAULT_OPT_INT64 = 0L; public static final Long DEFAULT_OPT_UINT64 = 0L; public static final Long DEFAULT_OPT_SINT64 = 0L; public static final Long DEFAULT_OPT_FIXED64 = 0L; public static final Long DEFAULT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_OPT_BOOL = false; public static final Float DEFAULT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_OPT_STRING = ""; public static final ByteString DEFAULT_OPT_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_OPT_NESTED_ENUM = NestedEnum.UNKNOWN; public static final Integer DEFAULT_REQ_INT32 = 0; public static final Integer DEFAULT_REQ_UINT32 = 0; public static final Integer DEFAULT_REQ_SINT32 = 0; public static final Integer DEFAULT_REQ_FIXED32 = 0; public static final Integer DEFAULT_REQ_SFIXED32 = 0; public static final Long DEFAULT_REQ_INT64 = 0L; public static final Long DEFAULT_REQ_UINT64 = 0L; public static final Long DEFAULT_REQ_SINT64 = 0L; public static final Long DEFAULT_REQ_FIXED64 = 0L; public static final Long DEFAULT_REQ_SFIXED64 = 0L; public static final Boolean DEFAULT_REQ_BOOL = false; public static final Float DEFAULT_REQ_FLOAT = 0.0f; public static final Double DEFAULT_REQ_DOUBLE = 0.0d; public static final String DEFAULT_REQ_STRING = ""; public static final ByteString DEFAULT_REQ_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_REQ_NESTED_ENUM = NestedEnum.UNKNOWN; public static final Integer DEFAULT_DEFAULT_INT32 = 2147483647; public static final Integer DEFAULT_DEFAULT_UINT32 = -1; public static final Integer DEFAULT_DEFAULT_SINT32 = -2147483648; public static final Integer DEFAULT_DEFAULT_FIXED32 = -1; public static final Integer DEFAULT_DEFAULT_SFIXED32 = -2147483648; public static final Long DEFAULT_DEFAULT_INT64 = 9223372036854775807L; public static final Long DEFAULT_DEFAULT_UINT64 = -1L; public static final Long DEFAULT_DEFAULT_SINT64 = -9223372036854775808L; public static final Long DEFAULT_DEFAULT_FIXED64 = -1L; public static final Long DEFAULT_DEFAULT_SFIXED64 = -9223372036854775808L; public static final Boolean DEFAULT_DEFAULT_BOOL = true; public static final Float DEFAULT_DEFAULT_FLOAT = 123.456e7f; public static final Double DEFAULT_DEFAULT_DOUBLE = 123.456e78d; public static final String DEFAULT_DEFAULT_STRING = "çok\u0007\b\f\n" + "\r\t\u000b\u0001\u0001\u0001\u000f\u000f~\u0001\u0001\u0011\u0001\u0001\u0011güzel"; public static final ByteString DEFAULT_DEFAULT_BYTES = ByteString.decodeBase64("529rBwgMCg0JCwEBAQ8PfgEBEQEBEWf8emVs"); public static final NestedEnum DEFAULT_DEFAULT_NESTED_ENUM = NestedEnum.A; public static final Integer DEFAULT_EXT_OPT_INT32 = 0; public static final Integer DEFAULT_EXT_OPT_UINT32 = 0; public static final Integer DEFAULT_EXT_OPT_SINT32 = 0; public static final Integer DEFAULT_EXT_OPT_FIXED32 = 0; public static final Integer DEFAULT_EXT_OPT_SFIXED32 = 0; public static final Long DEFAULT_EXT_OPT_INT64 = 0L; public static final Long DEFAULT_EXT_OPT_UINT64 = 0L; public static final Long DEFAULT_EXT_OPT_SINT64 = 0L; public static final Long DEFAULT_EXT_OPT_FIXED64 = 0L; public static final Long DEFAULT_EXT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_EXT_OPT_BOOL = false; public static final Float DEFAULT_EXT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_EXT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_EXT_OPT_STRING = ""; public static final ByteString DEFAULT_EXT_OPT_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_EXT_OPT_NESTED_ENUM = NestedEnum.UNKNOWN; public static final String DEFAULT_ONEOF_STRING = ""; public static final Integer DEFAULT_ONEOF_INT32 = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer opt_int32; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer opt_uint32; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer opt_sint32; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer opt_fixed32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer opt_sfixed32; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long opt_int64; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long opt_uint64; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long opt_sint64; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long opt_fixed64; @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long opt_sfixed64; @WireField( tag = 11, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean opt_bool; @WireField( tag = 12, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float opt_float; @WireField( tag = 13, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double opt_double; @WireField( tag = 14, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String opt_string; @WireField( tag = 15, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString opt_bytes; @WireField( tag = 16, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum opt_nested_enum; @WireField( tag = 17, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage opt_nested_message; @WireField( tag = 101, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer req_int32; @WireField( tag = 102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REQUIRED ) public final Integer req_uint32; @WireField( tag = 103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REQUIRED ) public final Integer req_sint32; @WireField( tag = 104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REQUIRED ) public final Integer req_fixed32; @WireField( tag = 105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REQUIRED ) public final Integer req_sfixed32; @WireField( tag = 106, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REQUIRED ) public final Long req_int64; @WireField( tag = 107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REQUIRED ) public final Long req_uint64; @WireField( tag = 108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REQUIRED ) public final Long req_sint64; @WireField( tag = 109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REQUIRED ) public final Long req_fixed64; @WireField( tag = 110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REQUIRED ) public final Long req_sfixed64; @WireField( tag = 111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REQUIRED ) public final Boolean req_bool; @WireField( tag = 112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REQUIRED ) public final Float req_float; @WireField( tag = 113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REQUIRED ) public final Double req_double; @WireField( tag = 114, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String req_string; @WireField( tag = 115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REQUIRED ) public final ByteString req_bytes; @WireField( tag = 116, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedEnum req_nested_enum; @WireField( tag = 117, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedMessage req_nested_message; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_int32; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_uint32; @WireField( tag = 203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_sint32; @WireField( tag = 204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED ) public final List<Integer> rep_fixed32; @WireField( tag = 205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED ) public final List<Integer> rep_sfixed32; @WireField( tag = 206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED ) public final List<Long> rep_int64; @WireField( tag = 207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED ) public final List<Long> rep_uint64; @WireField( tag = 208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED ) public final List<Long> rep_sint64; @WireField( tag = 209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED ) public final List<Long> rep_fixed64; @WireField( tag = 210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED ) public final List<Long> rep_sfixed64; @WireField( tag = 211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED ) public final List<Boolean> rep_bool; @WireField( tag = 212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> rep_float; @WireField( tag = 213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) public final List<Double> rep_double; @WireField( tag = 214, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> rep_string; @WireField( tag = 215, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED ) public final List<ByteString> rep_bytes; @WireField( tag = 216, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> rep_nested_enum; @WireField( tag = 217, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> rep_nested_message; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> pack_int32; @WireField( tag = 302, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED ) public final List<Integer> pack_uint32; @WireField( tag = 303, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED ) public final List<Integer> pack_sint32; @WireField( tag = 304, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED ) public final List<Integer> pack_fixed32; @WireField( tag = 305, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED ) public final List<Integer> pack_sfixed32; @WireField( tag = 306, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED ) public final List<Long> pack_int64; @WireField( tag = 307, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED ) public final List<Long> pack_uint64; @WireField( tag = 308, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED ) public final List<Long> pack_sint64; @WireField( tag = 309, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED ) public final List<Long> pack_fixed64; @WireField( tag = 310, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED ) public final List<Long> pack_sfixed64; @WireField( tag = 311, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED ) public final List<Boolean> pack_bool; @WireField( tag = 312, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED ) public final List<Float> pack_float; @WireField( tag = 313, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED ) public final List<Double> pack_double; @WireField( tag = 316, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> pack_nested_enum; @WireField( tag = 401, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer default_int32; @WireField( tag = 402, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer default_uint32; @WireField( tag = 403, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer default_sint32; @WireField( tag = 404, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer default_fixed32; @WireField( tag = 405, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer default_sfixed32; @WireField( tag = 406, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long default_int64; @WireField( tag = 407, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long default_uint64; @WireField( tag = 408, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long default_sint64; @WireField( tag = 409, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long default_fixed64; @WireField( tag = 410, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long default_sfixed64; @WireField( tag = 411, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean default_bool; @WireField( tag = 412, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float default_float; @WireField( tag = 413, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double default_double; @WireField( tag = 414, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String default_string; @WireField( tag = 415, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString default_bytes; @WireField( tag = 416, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum default_nested_enum; @WireField( tag = 501, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Map<Integer, Integer> map_int32_int32; @WireField( tag = 502, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final Map<String, String> map_string_string; @WireField( tag = 503, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final Map<String, NestedMessage> map_string_message; @WireField( tag = 504, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final Map<String, NestedEnum> map_string_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1001, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer ext_opt_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1002, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer ext_opt_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1003, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer ext_opt_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1004, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer ext_opt_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1005, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer ext_opt_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1006, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long ext_opt_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1007, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long ext_opt_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1008, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long ext_opt_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1009, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long ext_opt_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1010, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long ext_opt_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1011, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean ext_opt_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1012, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float ext_opt_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1013, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double ext_opt_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1014, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String ext_opt_string; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1015, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString ext_opt_bytes; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1016, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum ext_opt_nested_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1017, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage ext_opt_nested_message; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1101, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1106, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED ) public final List<Boolean> ext_rep_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> ext_rep_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) public final List<Double> ext_rep_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1114, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> ext_rep_string; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED ) public final List<ByteString> ext_rep_bytes; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1116, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> ext_rep_nested_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1117, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> ext_rep_nested_message; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED ) public final List<Boolean> ext_pack_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED ) public final List<Float> ext_pack_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED ) public final List<Double> ext_pack_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1216, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> ext_pack_nested_enum; @WireField( tag = 601, adapter = "com.squareup.wire.ProtoAdapter#STRING", oneofName = "choice" ) public final String oneof_string; @WireField( tag = 602, adapter = "com.squareup.wire.ProtoAdapter#INT32", oneofName = "choice" ) public final Integer oneof_int32; @WireField( tag = 603, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", oneofName = "choice" ) public final NestedMessage oneof_nested_message; public AllTypes(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message may be non-null"); } this.opt_int32 = builder.opt_int32; this.opt_uint32 = builder.opt_uint32; this.opt_sint32 = builder.opt_sint32; this.opt_fixed32 = builder.opt_fixed32; this.opt_sfixed32 = builder.opt_sfixed32; this.opt_int64 = builder.opt_int64; this.opt_uint64 = builder.opt_uint64; this.opt_sint64 = builder.opt_sint64; this.opt_fixed64 = builder.opt_fixed64; this.opt_sfixed64 = builder.opt_sfixed64; this.opt_bool = builder.opt_bool; this.opt_float = builder.opt_float; this.opt_double = builder.opt_double; this.opt_string = builder.opt_string; this.opt_bytes = builder.opt_bytes; this.opt_nested_enum = builder.opt_nested_enum; this.opt_nested_message = builder.opt_nested_message; this.req_int32 = builder.req_int32; this.req_uint32 = builder.req_uint32; this.req_sint32 = builder.req_sint32; this.req_fixed32 = builder.req_fixed32; this.req_sfixed32 = builder.req_sfixed32; this.req_int64 = builder.req_int64; this.req_uint64 = builder.req_uint64; this.req_sint64 = builder.req_sint64; this.req_fixed64 = builder.req_fixed64; this.req_sfixed64 = builder.req_sfixed64; this.req_bool = builder.req_bool; this.req_float = builder.req_float; this.req_double = builder.req_double; this.req_string = builder.req_string; this.req_bytes = builder.req_bytes; this.req_nested_enum = builder.req_nested_enum; this.req_nested_message = builder.req_nested_message; this.rep_int32 = Internal.immutableCopyOf("rep_int32", builder.rep_int32); this.rep_uint32 = Internal.immutableCopyOf("rep_uint32", builder.rep_uint32); this.rep_sint32 = Internal.immutableCopyOf("rep_sint32", builder.rep_sint32); this.rep_fixed32 = Internal.immutableCopyOf("rep_fixed32", builder.rep_fixed32); this.rep_sfixed32 = Internal.immutableCopyOf("rep_sfixed32", builder.rep_sfixed32); this.rep_int64 = Internal.immutableCopyOf("rep_int64", builder.rep_int64); this.rep_uint64 = Internal.immutableCopyOf("rep_uint64", builder.rep_uint64); this.rep_sint64 = Internal.immutableCopyOf("rep_sint64", builder.rep_sint64); this.rep_fixed64 = Internal.immutableCopyOf("rep_fixed64", builder.rep_fixed64); this.rep_sfixed64 = Internal.immutableCopyOf("rep_sfixed64", builder.rep_sfixed64); this.rep_bool = Internal.immutableCopyOf("rep_bool", builder.rep_bool); this.rep_float = Internal.immutableCopyOf("rep_float", builder.rep_float); this.rep_double = Internal.immutableCopyOf("rep_double", builder.rep_double); this.rep_string = Internal.immutableCopyOf("rep_string", builder.rep_string); this.rep_bytes = Internal.immutableCopyOf("rep_bytes", builder.rep_bytes); this.rep_nested_enum = Internal.immutableCopyOf("rep_nested_enum", builder.rep_nested_enum); this.rep_nested_message = Internal.immutableCopyOf("rep_nested_message", builder.rep_nested_message); this.pack_int32 = Internal.immutableCopyOf("pack_int32", builder.pack_int32); this.pack_uint32 = Internal.immutableCopyOf("pack_uint32", builder.pack_uint32); this.pack_sint32 = Internal.immutableCopyOf("pack_sint32", builder.pack_sint32); this.pack_fixed32 = Internal.immutableCopyOf("pack_fixed32", builder.pack_fixed32); this.pack_sfixed32 = Internal.immutableCopyOf("pack_sfixed32", builder.pack_sfixed32); this.pack_int64 = Internal.immutableCopyOf("pack_int64", builder.pack_int64); this.pack_uint64 = Internal.immutableCopyOf("pack_uint64", builder.pack_uint64); this.pack_sint64 = Internal.immutableCopyOf("pack_sint64", builder.pack_sint64); this.pack_fixed64 = Internal.immutableCopyOf("pack_fixed64", builder.pack_fixed64); this.pack_sfixed64 = Internal.immutableCopyOf("pack_sfixed64", builder.pack_sfixed64); this.pack_bool = Internal.immutableCopyOf("pack_bool", builder.pack_bool); this.pack_float = Internal.immutableCopyOf("pack_float", builder.pack_float); this.pack_double = Internal.immutableCopyOf("pack_double", builder.pack_double); this.pack_nested_enum = Internal.immutableCopyOf("pack_nested_enum", builder.pack_nested_enum); this.default_int32 = builder.default_int32; this.default_uint32 = builder.default_uint32; this.default_sint32 = builder.default_sint32; this.default_fixed32 = builder.default_fixed32; this.default_sfixed32 = builder.default_sfixed32; this.default_int64 = builder.default_int64; this.default_uint64 = builder.default_uint64; this.default_sint64 = builder.default_sint64; this.default_fixed64 = builder.default_fixed64; this.default_sfixed64 = builder.default_sfixed64; this.default_bool = builder.default_bool; this.default_float = builder.default_float; this.default_double = builder.default_double; this.default_string = builder.default_string; this.default_bytes = builder.default_bytes; this.default_nested_enum = builder.default_nested_enum; this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", builder.map_int32_int32); this.map_string_string = Internal.immutableCopyOf("map_string_string", builder.map_string_string); this.map_string_message = Internal.immutableCopyOf("map_string_message", builder.map_string_message); this.map_string_enum = Internal.immutableCopyOf("map_string_enum", builder.map_string_enum); this.ext_opt_int32 = builder.ext_opt_int32; this.ext_opt_uint32 = builder.ext_opt_uint32; this.ext_opt_sint32 = builder.ext_opt_sint32; this.ext_opt_fixed32 = builder.ext_opt_fixed32; this.ext_opt_sfixed32 = builder.ext_opt_sfixed32; this.ext_opt_int64 = builder.ext_opt_int64; this.ext_opt_uint64 = builder.ext_opt_uint64; this.ext_opt_sint64 = builder.ext_opt_sint64; this.ext_opt_fixed64 = builder.ext_opt_fixed64; this.ext_opt_sfixed64 = builder.ext_opt_sfixed64; this.ext_opt_bool = builder.ext_opt_bool; this.ext_opt_float = builder.ext_opt_float; this.ext_opt_double = builder.ext_opt_double; this.ext_opt_string = builder.ext_opt_string; this.ext_opt_bytes = builder.ext_opt_bytes; this.ext_opt_nested_enum = builder.ext_opt_nested_enum; this.ext_opt_nested_message = builder.ext_opt_nested_message; this.ext_rep_int32 = Internal.immutableCopyOf("ext_rep_int32", builder.ext_rep_int32); this.ext_rep_uint32 = Internal.immutableCopyOf("ext_rep_uint32", builder.ext_rep_uint32); this.ext_rep_sint32 = Internal.immutableCopyOf("ext_rep_sint32", builder.ext_rep_sint32); this.ext_rep_fixed32 = Internal.immutableCopyOf("ext_rep_fixed32", builder.ext_rep_fixed32); this.ext_rep_sfixed32 = Internal.immutableCopyOf("ext_rep_sfixed32", builder.ext_rep_sfixed32); this.ext_rep_int64 = Internal.immutableCopyOf("ext_rep_int64", builder.ext_rep_int64); this.ext_rep_uint64 = Internal.immutableCopyOf("ext_rep_uint64", builder.ext_rep_uint64); this.ext_rep_sint64 = Internal.immutableCopyOf("ext_rep_sint64", builder.ext_rep_sint64); this.ext_rep_fixed64 = Internal.immutableCopyOf("ext_rep_fixed64", builder.ext_rep_fixed64); this.ext_rep_sfixed64 = Internal.immutableCopyOf("ext_rep_sfixed64", builder.ext_rep_sfixed64); this.ext_rep_bool = Internal.immutableCopyOf("ext_rep_bool", builder.ext_rep_bool); this.ext_rep_float = Internal.immutableCopyOf("ext_rep_float", builder.ext_rep_float); this.ext_rep_double = Internal.immutableCopyOf("ext_rep_double", builder.ext_rep_double); this.ext_rep_string = Internal.immutableCopyOf("ext_rep_string", builder.ext_rep_string); this.ext_rep_bytes = Internal.immutableCopyOf("ext_rep_bytes", builder.ext_rep_bytes); this.ext_rep_nested_enum = Internal.immutableCopyOf("ext_rep_nested_enum", builder.ext_rep_nested_enum); this.ext_rep_nested_message = Internal.immutableCopyOf("ext_rep_nested_message", builder.ext_rep_nested_message); this.ext_pack_int32 = Internal.immutableCopyOf("ext_pack_int32", builder.ext_pack_int32); this.ext_pack_uint32 = Internal.immutableCopyOf("ext_pack_uint32", builder.ext_pack_uint32); this.ext_pack_sint32 = Internal.immutableCopyOf("ext_pack_sint32", builder.ext_pack_sint32); this.ext_pack_fixed32 = Internal.immutableCopyOf("ext_pack_fixed32", builder.ext_pack_fixed32); this.ext_pack_sfixed32 = Internal.immutableCopyOf("ext_pack_sfixed32", builder.ext_pack_sfixed32); this.ext_pack_int64 = Internal.immutableCopyOf("ext_pack_int64", builder.ext_pack_int64); this.ext_pack_uint64 = Internal.immutableCopyOf("ext_pack_uint64", builder.ext_pack_uint64); this.ext_pack_sint64 = Internal.immutableCopyOf("ext_pack_sint64", builder.ext_pack_sint64); this.ext_pack_fixed64 = Internal.immutableCopyOf("ext_pack_fixed64", builder.ext_pack_fixed64); this.ext_pack_sfixed64 = Internal.immutableCopyOf("ext_pack_sfixed64", builder.ext_pack_sfixed64); this.ext_pack_bool = Internal.immutableCopyOf("ext_pack_bool", builder.ext_pack_bool); this.ext_pack_float = Internal.immutableCopyOf("ext_pack_float", builder.ext_pack_float); this.ext_pack_double = Internal.immutableCopyOf("ext_pack_double", builder.ext_pack_double); this.ext_pack_nested_enum = Internal.immutableCopyOf("ext_pack_nested_enum", builder.ext_pack_nested_enum); this.oneof_string = builder.oneof_string; this.oneof_int32 = builder.oneof_int32; this.oneof_nested_message = builder.oneof_nested_message; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.opt_int32 = opt_int32; builder.opt_uint32 = opt_uint32; builder.opt_sint32 = opt_sint32; builder.opt_fixed32 = opt_fixed32; builder.opt_sfixed32 = opt_sfixed32; builder.opt_int64 = opt_int64; builder.opt_uint64 = opt_uint64; builder.opt_sint64 = opt_sint64; builder.opt_fixed64 = opt_fixed64; builder.opt_sfixed64 = opt_sfixed64; builder.opt_bool = opt_bool; builder.opt_float = opt_float; builder.opt_double = opt_double; builder.opt_string = opt_string; builder.opt_bytes = opt_bytes; builder.opt_nested_enum = opt_nested_enum; builder.opt_nested_message = opt_nested_message; builder.req_int32 = req_int32; builder.req_uint32 = req_uint32; builder.req_sint32 = req_sint32; builder.req_fixed32 = req_fixed32; builder.req_sfixed32 = req_sfixed32; builder.req_int64 = req_int64; builder.req_uint64 = req_uint64; builder.req_sint64 = req_sint64; builder.req_fixed64 = req_fixed64; builder.req_sfixed64 = req_sfixed64; builder.req_bool = req_bool; builder.req_float = req_float; builder.req_double = req_double; builder.req_string = req_string; builder.req_bytes = req_bytes; builder.req_nested_enum = req_nested_enum; builder.req_nested_message = req_nested_message; builder.rep_int32 = Internal.copyOf(rep_int32); builder.rep_uint32 = Internal.copyOf(rep_uint32); builder.rep_sint32 = Internal.copyOf(rep_sint32); builder.rep_fixed32 = Internal.copyOf(rep_fixed32); builder.rep_sfixed32 = Internal.copyOf(rep_sfixed32); builder.rep_int64 = Internal.copyOf(rep_int64); builder.rep_uint64 = Internal.copyOf(rep_uint64); builder.rep_sint64 = Internal.copyOf(rep_sint64); builder.rep_fixed64 = Internal.copyOf(rep_fixed64); builder.rep_sfixed64 = Internal.copyOf(rep_sfixed64); builder.rep_bool = Internal.copyOf(rep_bool); builder.rep_float = Internal.copyOf(rep_float); builder.rep_double = Internal.copyOf(rep_double); builder.rep_string = Internal.copyOf(rep_string); builder.rep_bytes = Internal.copyOf(rep_bytes); builder.rep_nested_enum = Internal.copyOf(rep_nested_enum); builder.rep_nested_message = Internal.copyOf(rep_nested_message); builder.pack_int32 = Internal.copyOf(pack_int32); builder.pack_uint32 = Internal.copyOf(pack_uint32); builder.pack_sint32 = Internal.copyOf(pack_sint32); builder.pack_fixed32 = Internal.copyOf(pack_fixed32); builder.pack_sfixed32 = Internal.copyOf(pack_sfixed32); builder.pack_int64 = Internal.copyOf(pack_int64); builder.pack_uint64 = Internal.copyOf(pack_uint64); builder.pack_sint64 = Internal.copyOf(pack_sint64); builder.pack_fixed64 = Internal.copyOf(pack_fixed64); builder.pack_sfixed64 = Internal.copyOf(pack_sfixed64); builder.pack_bool = Internal.copyOf(pack_bool); builder.pack_float = Internal.copyOf(pack_float); builder.pack_double = Internal.copyOf(pack_double); builder.pack_nested_enum = Internal.copyOf(pack_nested_enum); builder.default_int32 = default_int32; builder.default_uint32 = default_uint32; builder.default_sint32 = default_sint32; builder.default_fixed32 = default_fixed32; builder.default_sfixed32 = default_sfixed32; builder.default_int64 = default_int64; builder.default_uint64 = default_uint64; builder.default_sint64 = default_sint64; builder.default_fixed64 = default_fixed64; builder.default_sfixed64 = default_sfixed64; builder.default_bool = default_bool; builder.default_float = default_float; builder.default_double = default_double; builder.default_string = default_string; builder.default_bytes = default_bytes; builder.default_nested_enum = default_nested_enum; builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.map_string_string = Internal.copyOf(map_string_string); builder.map_string_message = Internal.copyOf(map_string_message); builder.map_string_enum = Internal.copyOf(map_string_enum); builder.ext_opt_int32 = ext_opt_int32; builder.ext_opt_uint32 = ext_opt_uint32; builder.ext_opt_sint32 = ext_opt_sint32; builder.ext_opt_fixed32 = ext_opt_fixed32; builder.ext_opt_sfixed32 = ext_opt_sfixed32; builder.ext_opt_int64 = ext_opt_int64; builder.ext_opt_uint64 = ext_opt_uint64; builder.ext_opt_sint64 = ext_opt_sint64; builder.ext_opt_fixed64 = ext_opt_fixed64; builder.ext_opt_sfixed64 = ext_opt_sfixed64; builder.ext_opt_bool = ext_opt_bool; builder.ext_opt_float = ext_opt_float; builder.ext_opt_double = ext_opt_double; builder.ext_opt_string = ext_opt_string; builder.ext_opt_bytes = ext_opt_bytes; builder.ext_opt_nested_enum = ext_opt_nested_enum; builder.ext_opt_nested_message = ext_opt_nested_message; builder.ext_rep_int32 = Internal.copyOf(ext_rep_int32); builder.ext_rep_uint32 = Internal.copyOf(ext_rep_uint32); builder.ext_rep_sint32 = Internal.copyOf(ext_rep_sint32); builder.ext_rep_fixed32 = Internal.copyOf(ext_rep_fixed32); builder.ext_rep_sfixed32 = Internal.copyOf(ext_rep_sfixed32); builder.ext_rep_int64 = Internal.copyOf(ext_rep_int64); builder.ext_rep_uint64 = Internal.copyOf(ext_rep_uint64); builder.ext_rep_sint64 = Internal.copyOf(ext_rep_sint64); builder.ext_rep_fixed64 = Internal.copyOf(ext_rep_fixed64); builder.ext_rep_sfixed64 = Internal.copyOf(ext_rep_sfixed64); builder.ext_rep_bool = Internal.copyOf(ext_rep_bool); builder.ext_rep_float = Internal.copyOf(ext_rep_float); builder.ext_rep_double = Internal.copyOf(ext_rep_double); builder.ext_rep_string = Internal.copyOf(ext_rep_string); builder.ext_rep_bytes = Internal.copyOf(ext_rep_bytes); builder.ext_rep_nested_enum = Internal.copyOf(ext_rep_nested_enum); builder.ext_rep_nested_message = Internal.copyOf(ext_rep_nested_message); builder.ext_pack_int32 = Internal.copyOf(ext_pack_int32); builder.ext_pack_uint32 = Internal.copyOf(ext_pack_uint32); builder.ext_pack_sint32 = Internal.copyOf(ext_pack_sint32); builder.ext_pack_fixed32 = Internal.copyOf(ext_pack_fixed32); builder.ext_pack_sfixed32 = Internal.copyOf(ext_pack_sfixed32); builder.ext_pack_int64 = Internal.copyOf(ext_pack_int64); builder.ext_pack_uint64 = Internal.copyOf(ext_pack_uint64); builder.ext_pack_sint64 = Internal.copyOf(ext_pack_sint64); builder.ext_pack_fixed64 = Internal.copyOf(ext_pack_fixed64); builder.ext_pack_sfixed64 = Internal.copyOf(ext_pack_sfixed64); builder.ext_pack_bool = Internal.copyOf(ext_pack_bool); builder.ext_pack_float = Internal.copyOf(ext_pack_float); builder.ext_pack_double = Internal.copyOf(ext_pack_double); builder.ext_pack_nested_enum = Internal.copyOf(ext_pack_nested_enum); builder.oneof_string = oneof_string; builder.oneof_int32 = oneof_int32; builder.oneof_nested_message = oneof_nested_message; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof AllTypes)) return false; AllTypes o = (AllTypes) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(opt_int32, o.opt_int32) && Internal.equals(opt_uint32, o.opt_uint32) && Internal.equals(opt_sint32, o.opt_sint32) && Internal.equals(opt_fixed32, o.opt_fixed32) && Internal.equals(opt_sfixed32, o.opt_sfixed32) && Internal.equals(opt_int64, o.opt_int64) && Internal.equals(opt_uint64, o.opt_uint64) && Internal.equals(opt_sint64, o.opt_sint64) && Internal.equals(opt_fixed64, o.opt_fixed64) && Internal.equals(opt_sfixed64, o.opt_sfixed64) && Internal.equals(opt_bool, o.opt_bool) && Internal.equals(opt_float, o.opt_float) && Internal.equals(opt_double, o.opt_double) && Internal.equals(opt_string, o.opt_string) && Internal.equals(opt_bytes, o.opt_bytes) && Internal.equals(opt_nested_enum, o.opt_nested_enum) && Internal.equals(opt_nested_message, o.opt_nested_message) && req_int32.equals(o.req_int32) && req_uint32.equals(o.req_uint32) && req_sint32.equals(o.req_sint32) && req_fixed32.equals(o.req_fixed32) && req_sfixed32.equals(o.req_sfixed32) && req_int64.equals(o.req_int64) && req_uint64.equals(o.req_uint64) && req_sint64.equals(o.req_sint64) && req_fixed64.equals(o.req_fixed64) && req_sfixed64.equals(o.req_sfixed64) && req_bool.equals(o.req_bool) && req_float.equals(o.req_float) && req_double.equals(o.req_double) && req_string.equals(o.req_string) && req_bytes.equals(o.req_bytes) && req_nested_enum.equals(o.req_nested_enum) && req_nested_message.equals(o.req_nested_message) && rep_int32.equals(o.rep_int32) && rep_uint32.equals(o.rep_uint32) && rep_sint32.equals(o.rep_sint32) && rep_fixed32.equals(o.rep_fixed32) && rep_sfixed32.equals(o.rep_sfixed32) && rep_int64.equals(o.rep_int64) && rep_uint64.equals(o.rep_uint64) && rep_sint64.equals(o.rep_sint64) && rep_fixed64.equals(o.rep_fixed64) && rep_sfixed64.equals(o.rep_sfixed64) && rep_bool.equals(o.rep_bool) && rep_float.equals(o.rep_float) && rep_double.equals(o.rep_double) && rep_string.equals(o.rep_string) && rep_bytes.equals(o.rep_bytes) && rep_nested_enum.equals(o.rep_nested_enum) && rep_nested_message.equals(o.rep_nested_message) && pack_int32.equals(o.pack_int32) && pack_uint32.equals(o.pack_uint32) && pack_sint32.equals(o.pack_sint32) && pack_fixed32.equals(o.pack_fixed32) && pack_sfixed32.equals(o.pack_sfixed32) && pack_int64.equals(o.pack_int64) && pack_uint64.equals(o.pack_uint64) && pack_sint64.equals(o.pack_sint64) && pack_fixed64.equals(o.pack_fixed64) && pack_sfixed64.equals(o.pack_sfixed64) && pack_bool.equals(o.pack_bool) && pack_float.equals(o.pack_float) && pack_double.equals(o.pack_double) && pack_nested_enum.equals(o.pack_nested_enum) && Internal.equals(default_int32, o.default_int32) && Internal.equals(default_uint32, o.default_uint32) && Internal.equals(default_sint32, o.default_sint32) && Internal.equals(default_fixed32, o.default_fixed32) && Internal.equals(default_sfixed32, o.default_sfixed32) && Internal.equals(default_int64, o.default_int64) && Internal.equals(default_uint64, o.default_uint64) && Internal.equals(default_sint64, o.default_sint64) && Internal.equals(default_fixed64, o.default_fixed64) && Internal.equals(default_sfixed64, o.default_sfixed64) && Internal.equals(default_bool, o.default_bool) && Internal.equals(default_float, o.default_float) && Internal.equals(default_double, o.default_double) && Internal.equals(default_string, o.default_string) && Internal.equals(default_bytes, o.default_bytes) && Internal.equals(default_nested_enum, o.default_nested_enum) && map_int32_int32.equals(o.map_int32_int32) && map_string_string.equals(o.map_string_string) && map_string_message.equals(o.map_string_message) && map_string_enum.equals(o.map_string_enum) && Internal.equals(ext_opt_int32, o.ext_opt_int32) && Internal.equals(ext_opt_uint32, o.ext_opt_uint32) && Internal.equals(ext_opt_sint32, o.ext_opt_sint32) && Internal.equals(ext_opt_fixed32, o.ext_opt_fixed32) && Internal.equals(ext_opt_sfixed32, o.ext_opt_sfixed32) && Internal.equals(ext_opt_int64, o.ext_opt_int64) && Internal.equals(ext_opt_uint64, o.ext_opt_uint64) && Internal.equals(ext_opt_sint64, o.ext_opt_sint64) && Internal.equals(ext_opt_fixed64, o.ext_opt_fixed64) && Internal.equals(ext_opt_sfixed64, o.ext_opt_sfixed64) && Internal.equals(ext_opt_bool, o.ext_opt_bool) && Internal.equals(ext_opt_float, o.ext_opt_float) && Internal.equals(ext_opt_double, o.ext_opt_double) && Internal.equals(ext_opt_string, o.ext_opt_string) && Internal.equals(ext_opt_bytes, o.ext_opt_bytes) && Internal.equals(ext_opt_nested_enum, o.ext_opt_nested_enum) && Internal.equals(ext_opt_nested_message, o.ext_opt_nested_message) && ext_rep_int32.equals(o.ext_rep_int32) && ext_rep_uint32.equals(o.ext_rep_uint32) && ext_rep_sint32.equals(o.ext_rep_sint32) && ext_rep_fixed32.equals(o.ext_rep_fixed32) && ext_rep_sfixed32.equals(o.ext_rep_sfixed32) && ext_rep_int64.equals(o.ext_rep_int64) && ext_rep_uint64.equals(o.ext_rep_uint64) && ext_rep_sint64.equals(o.ext_rep_sint64) && ext_rep_fixed64.equals(o.ext_rep_fixed64) && ext_rep_sfixed64.equals(o.ext_rep_sfixed64) && ext_rep_bool.equals(o.ext_rep_bool) && ext_rep_float.equals(o.ext_rep_float) && ext_rep_double.equals(o.ext_rep_double) && ext_rep_string.equals(o.ext_rep_string) && ext_rep_bytes.equals(o.ext_rep_bytes) && ext_rep_nested_enum.equals(o.ext_rep_nested_enum) && ext_rep_nested_message.equals(o.ext_rep_nested_message) && ext_pack_int32.equals(o.ext_pack_int32) && ext_pack_uint32.equals(o.ext_pack_uint32) && ext_pack_sint32.equals(o.ext_pack_sint32) && ext_pack_fixed32.equals(o.ext_pack_fixed32) && ext_pack_sfixed32.equals(o.ext_pack_sfixed32) && ext_pack_int64.equals(o.ext_pack_int64) && ext_pack_uint64.equals(o.ext_pack_uint64) && ext_pack_sint64.equals(o.ext_pack_sint64) && ext_pack_fixed64.equals(o.ext_pack_fixed64) && ext_pack_sfixed64.equals(o.ext_pack_sfixed64) && ext_pack_bool.equals(o.ext_pack_bool) && ext_pack_float.equals(o.ext_pack_float) && ext_pack_double.equals(o.ext_pack_double) && ext_pack_nested_enum.equals(o.ext_pack_nested_enum) && Internal.equals(oneof_string, o.oneof_string) && Internal.equals(oneof_int32, o.oneof_int32) && Internal.equals(oneof_nested_message, o.oneof_nested_message); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (opt_int32 != null ? opt_int32.hashCode() : 0); result = result * 37 + (opt_uint32 != null ? opt_uint32.hashCode() : 0); result = result * 37 + (opt_sint32 != null ? opt_sint32.hashCode() : 0); result = result * 37 + (opt_fixed32 != null ? opt_fixed32.hashCode() : 0); result = result * 37 + (opt_sfixed32 != null ? opt_sfixed32.hashCode() : 0); result = result * 37 + (opt_int64 != null ? opt_int64.hashCode() : 0); result = result * 37 + (opt_uint64 != null ? opt_uint64.hashCode() : 0); result = result * 37 + (opt_sint64 != null ? opt_sint64.hashCode() : 0); result = result * 37 + (opt_fixed64 != null ? opt_fixed64.hashCode() : 0); result = result * 37 + (opt_sfixed64 != null ? opt_sfixed64.hashCode() : 0); result = result * 37 + (opt_bool != null ? opt_bool.hashCode() : 0); result = result * 37 + (opt_float != null ? opt_float.hashCode() : 0); result = result * 37 + (opt_double != null ? opt_double.hashCode() : 0); result = result * 37 + (opt_string != null ? opt_string.hashCode() : 0); result = result * 37 + (opt_bytes != null ? opt_bytes.hashCode() : 0); result = result * 37 + (opt_nested_enum != null ? opt_nested_enum.hashCode() : 0); result = result * 37 + (opt_nested_message != null ? opt_nested_message.hashCode() : 0); result = result * 37 + req_int32.hashCode(); result = result * 37 + req_uint32.hashCode(); result = result * 37 + req_sint32.hashCode(); result = result * 37 + req_fixed32.hashCode(); result = result * 37 + req_sfixed32.hashCode(); result = result * 37 + req_int64.hashCode(); result = result * 37 + req_uint64.hashCode(); result = result * 37 + req_sint64.hashCode(); result = result * 37 + req_fixed64.hashCode(); result = result * 37 + req_sfixed64.hashCode(); result = result * 37 + req_bool.hashCode(); result = result * 37 + req_float.hashCode(); result = result * 37 + req_double.hashCode(); result = result * 37 + req_string.hashCode(); result = result * 37 + req_bytes.hashCode(); result = result * 37 + req_nested_enum.hashCode(); result = result * 37 + req_nested_message.hashCode(); result = result * 37 + rep_int32.hashCode(); result = result * 37 + rep_uint32.hashCode(); result = result * 37 + rep_sint32.hashCode(); result = result * 37 + rep_fixed32.hashCode(); result = result * 37 + rep_sfixed32.hashCode(); result = result * 37 + rep_int64.hashCode(); result = result * 37 + rep_uint64.hashCode(); result = result * 37 + rep_sint64.hashCode(); result = result * 37 + rep_fixed64.hashCode(); result = result * 37 + rep_sfixed64.hashCode(); result = result * 37 + rep_bool.hashCode(); result = result * 37 + rep_float.hashCode(); result = result * 37 + rep_double.hashCode(); result = result * 37 + rep_string.hashCode(); result = result * 37 + rep_bytes.hashCode(); result = result * 37 + rep_nested_enum.hashCode(); result = result * 37 + rep_nested_message.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + pack_uint32.hashCode(); result = result * 37 + pack_sint32.hashCode(); result = result * 37 + pack_fixed32.hashCode(); result = result * 37 + pack_sfixed32.hashCode(); result = result * 37 + pack_int64.hashCode(); result = result * 37 + pack_uint64.hashCode(); result = result * 37 + pack_sint64.hashCode(); result = result * 37 + pack_fixed64.hashCode(); result = result * 37 + pack_sfixed64.hashCode(); result = result * 37 + pack_bool.hashCode(); result = result * 37 + pack_float.hashCode(); result = result * 37 + pack_double.hashCode(); result = result * 37 + pack_nested_enum.hashCode(); result = result * 37 + (default_int32 != null ? default_int32.hashCode() : 0); result = result * 37 + (default_uint32 != null ? default_uint32.hashCode() : 0); result = result * 37 + (default_sint32 != null ? default_sint32.hashCode() : 0); result = result * 37 + (default_fixed32 != null ? default_fixed32.hashCode() : 0); result = result * 37 + (default_sfixed32 != null ? default_sfixed32.hashCode() : 0); result = result * 37 + (default_int64 != null ? default_int64.hashCode() : 0); result = result * 37 + (default_uint64 != null ? default_uint64.hashCode() : 0); result = result * 37 + (default_sint64 != null ? default_sint64.hashCode() : 0); result = result * 37 + (default_fixed64 != null ? default_fixed64.hashCode() : 0); result = result * 37 + (default_sfixed64 != null ? default_sfixed64.hashCode() : 0); result = result * 37 + (default_bool != null ? default_bool.hashCode() : 0); result = result * 37 + (default_float != null ? default_float.hashCode() : 0); result = result * 37 + (default_double != null ? default_double.hashCode() : 0); result = result * 37 + (default_string != null ? default_string.hashCode() : 0); result = result * 37 + (default_bytes != null ? default_bytes.hashCode() : 0); result = result * 37 + (default_nested_enum != null ? default_nested_enum.hashCode() : 0); result = result * 37 + map_int32_int32.hashCode(); result = result * 37 + map_string_string.hashCode(); result = result * 37 + map_string_message.hashCode(); result = result * 37 + map_string_enum.hashCode(); result = result * 37 + (ext_opt_int32 != null ? ext_opt_int32.hashCode() : 0); result = result * 37 + (ext_opt_uint32 != null ? ext_opt_uint32.hashCode() : 0); result = result * 37 + (ext_opt_sint32 != null ? ext_opt_sint32.hashCode() : 0); result = result * 37 + (ext_opt_fixed32 != null ? ext_opt_fixed32.hashCode() : 0); result = result * 37 + (ext_opt_sfixed32 != null ? ext_opt_sfixed32.hashCode() : 0); result = result * 37 + (ext_opt_int64 != null ? ext_opt_int64.hashCode() : 0); result = result * 37 + (ext_opt_uint64 != null ? ext_opt_uint64.hashCode() : 0); result = result * 37 + (ext_opt_sint64 != null ? ext_opt_sint64.hashCode() : 0); result = result * 37 + (ext_opt_fixed64 != null ? ext_opt_fixed64.hashCode() : 0); result = result * 37 + (ext_opt_sfixed64 != null ? ext_opt_sfixed64.hashCode() : 0); result = result * 37 + (ext_opt_bool != null ? ext_opt_bool.hashCode() : 0); result = result * 37 + (ext_opt_float != null ? ext_opt_float.hashCode() : 0); result = result * 37 + (ext_opt_double != null ? ext_opt_double.hashCode() : 0); result = result * 37 + (ext_opt_string != null ? ext_opt_string.hashCode() : 0); result = result * 37 + (ext_opt_bytes != null ? ext_opt_bytes.hashCode() : 0); result = result * 37 + (ext_opt_nested_enum != null ? ext_opt_nested_enum.hashCode() : 0); result = result * 37 + (ext_opt_nested_message != null ? ext_opt_nested_message.hashCode() : 0); result = result * 37 + ext_rep_int32.hashCode(); result = result * 37 + ext_rep_uint32.hashCode(); result = result * 37 + ext_rep_sint32.hashCode(); result = result * 37 + ext_rep_fixed32.hashCode(); result = result * 37 + ext_rep_sfixed32.hashCode(); result = result * 37 + ext_rep_int64.hashCode(); result = result * 37 + ext_rep_uint64.hashCode(); result = result * 37 + ext_rep_sint64.hashCode(); result = result * 37 + ext_rep_fixed64.hashCode(); result = result * 37 + ext_rep_sfixed64.hashCode(); result = result * 37 + ext_rep_bool.hashCode(); result = result * 37 + ext_rep_float.hashCode(); result = result * 37 + ext_rep_double.hashCode(); result = result * 37 + ext_rep_string.hashCode(); result = result * 37 + ext_rep_bytes.hashCode(); result = result * 37 + ext_rep_nested_enum.hashCode(); result = result * 37 + ext_rep_nested_message.hashCode(); result = result * 37 + ext_pack_int32.hashCode(); result = result * 37 + ext_pack_uint32.hashCode(); result = result * 37 + ext_pack_sint32.hashCode(); result = result * 37 + ext_pack_fixed32.hashCode(); result = result * 37 + ext_pack_sfixed32.hashCode(); result = result * 37 + ext_pack_int64.hashCode(); result = result * 37 + ext_pack_uint64.hashCode(); result = result * 37 + ext_pack_sint64.hashCode(); result = result * 37 + ext_pack_fixed64.hashCode(); result = result * 37 + ext_pack_sfixed64.hashCode(); result = result * 37 + ext_pack_bool.hashCode(); result = result * 37 + ext_pack_float.hashCode(); result = result * 37 + ext_pack_double.hashCode(); result = result * 37 + ext_pack_nested_enum.hashCode(); result = result * 37 + (oneof_string != null ? oneof_string.hashCode() : 0); result = result * 37 + (oneof_int32 != null ? oneof_int32.hashCode() : 0); result = result * 37 + (oneof_nested_message != null ? oneof_nested_message.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<AllTypes, Builder> { public Integer opt_int32; public Integer opt_uint32; public Integer opt_sint32; public Integer opt_fixed32; public Integer opt_sfixed32; public Long opt_int64; public Long opt_uint64; public Long opt_sint64; public Long opt_fixed64; public Long opt_sfixed64; public Boolean opt_bool; public Float opt_float; public Double opt_double; public String opt_string; public ByteString opt_bytes; public NestedEnum opt_nested_enum; public NestedMessage opt_nested_message; public Integer req_int32; public Integer req_uint32; public Integer req_sint32; public Integer req_fixed32; public Integer req_sfixed32; public Long req_int64; public Long req_uint64; public Long req_sint64; public Long req_fixed64; public Long req_sfixed64; public Boolean req_bool; public Float req_float; public Double req_double; public String req_string; public ByteString req_bytes; public NestedEnum req_nested_enum; public NestedMessage req_nested_message; public List<Integer> rep_int32; public List<Integer> rep_uint32; public List<Integer> rep_sint32; public List<Integer> rep_fixed32; public List<Integer> rep_sfixed32; public List<Long> rep_int64; public List<Long> rep_uint64; public List<Long> rep_sint64; public List<Long> rep_fixed64; public List<Long> rep_sfixed64; public List<Boolean> rep_bool; public List<Float> rep_float; public List<Double> rep_double; public List<String> rep_string; public List<ByteString> rep_bytes; public List<NestedEnum> rep_nested_enum; public List<NestedMessage> rep_nested_message; public List<Integer> pack_int32; public List<Integer> pack_uint32; public List<Integer> pack_sint32; public List<Integer> pack_fixed32; public List<Integer> pack_sfixed32; public List<Long> pack_int64; public List<Long> pack_uint64; public List<Long> pack_sint64; public List<Long> pack_fixed64; public List<Long> pack_sfixed64; public List<Boolean> pack_bool; public List<Float> pack_float; public List<Double> pack_double; public List<NestedEnum> pack_nested_enum; public Integer default_int32; public Integer default_uint32; public Integer default_sint32; public Integer default_fixed32; public Integer default_sfixed32; public Long default_int64; public Long default_uint64; public Long default_sint64; public Long default_fixed64; public Long default_sfixed64; public Boolean default_bool; public Float default_float; public Double default_double; public String default_string; public ByteString default_bytes; public NestedEnum default_nested_enum; public Map<Integer, Integer> map_int32_int32; public Map<String, String> map_string_string; public Map<String, NestedMessage> map_string_message; public Map<String, NestedEnum> map_string_enum; public Integer ext_opt_int32; public Integer ext_opt_uint32; public Integer ext_opt_sint32; public Integer ext_opt_fixed32; public Integer ext_opt_sfixed32; public Long ext_opt_int64; public Long ext_opt_uint64; public Long ext_opt_sint64; public Long ext_opt_fixed64; public Long ext_opt_sfixed64; public Boolean ext_opt_bool; public Float ext_opt_float; public Double ext_opt_double; public String ext_opt_string; public ByteString ext_opt_bytes; public NestedEnum ext_opt_nested_enum; public NestedMessage ext_opt_nested_message; public List<Integer> ext_rep_int32; public List<Integer> ext_rep_uint32; public List<Integer> ext_rep_sint32; public List<Integer> ext_rep_fixed32; public List<Integer> ext_rep_sfixed32; public List<Long> ext_rep_int64; public List<Long> ext_rep_uint64; public List<Long> ext_rep_sint64; public List<Long> ext_rep_fixed64; public List<Long> ext_rep_sfixed64; public List<Boolean> ext_rep_bool; public List<Float> ext_rep_float; public List<Double> ext_rep_double; public List<String> ext_rep_string; public List<ByteString> ext_rep_bytes; public List<NestedEnum> ext_rep_nested_enum; public List<NestedMessage> ext_rep_nested_message; public List<Integer> ext_pack_int32; public List<Integer> ext_pack_uint32; public List<Integer> ext_pack_sint32; public List<Integer> ext_pack_fixed32; public List<Integer> ext_pack_sfixed32; public List<Long> ext_pack_int64; public List<Long> ext_pack_uint64; public List<Long> ext_pack_sint64; public List<Long> ext_pack_fixed64; public List<Long> ext_pack_sfixed64; public List<Boolean> ext_pack_bool; public List<Float> ext_pack_float; public List<Double> ext_pack_double; public List<NestedEnum> ext_pack_nested_enum; public String oneof_string; public Integer oneof_int32; public NestedMessage oneof_nested_message; public Builder() { rep_int32 = Internal.newMutableList(); rep_uint32 = Internal.newMutableList(); rep_sint32 = Internal.newMutableList(); rep_fixed32 = Internal.newMutableList(); rep_sfixed32 = Internal.newMutableList(); rep_int64 = Internal.newMutableList(); rep_uint64 = Internal.newMutableList(); rep_sint64 = Internal.newMutableList(); rep_fixed64 = Internal.newMutableList(); rep_sfixed64 = Internal.newMutableList(); rep_bool = Internal.newMutableList(); rep_float = Internal.newMutableList(); rep_double = Internal.newMutableList(); rep_string = Internal.newMutableList(); rep_bytes = Internal.newMutableList(); rep_nested_enum = Internal.newMutableList(); rep_nested_message = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); pack_uint32 = Internal.newMutableList(); pack_sint32 = Internal.newMutableList(); pack_fixed32 = Internal.newMutableList(); pack_sfixed32 = Internal.newMutableList(); pack_int64 = Internal.newMutableList(); pack_uint64 = Internal.newMutableList(); pack_sint64 = Internal.newMutableList(); pack_fixed64 = Internal.newMutableList(); pack_sfixed64 = Internal.newMutableList(); pack_bool = Internal.newMutableList(); pack_float = Internal.newMutableList(); pack_double = Internal.newMutableList(); pack_nested_enum = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); map_string_string = Internal.newMutableMap(); map_string_message = Internal.newMutableMap(); map_string_enum = Internal.newMutableMap(); ext_rep_int32 = Internal.newMutableList(); ext_rep_uint32 = Internal.newMutableList(); ext_rep_sint32 = Internal.newMutableList(); ext_rep_fixed32 = Internal.newMutableList(); ext_rep_sfixed32 = Internal.newMutableList(); ext_rep_int64 = Internal.newMutableList(); ext_rep_uint64 = Internal.newMutableList(); ext_rep_sint64 = Internal.newMutableList(); ext_rep_fixed64 = Internal.newMutableList(); ext_rep_sfixed64 = Internal.newMutableList(); ext_rep_bool = Internal.newMutableList(); ext_rep_float = Internal.newMutableList(); ext_rep_double = Internal.newMutableList(); ext_rep_string = Internal.newMutableList(); ext_rep_bytes = Internal.newMutableList(); ext_rep_nested_enum = Internal.newMutableList(); ext_rep_nested_message = Internal.newMutableList(); ext_pack_int32 = Internal.newMutableList(); ext_pack_uint32 = Internal.newMutableList(); ext_pack_sint32 = Internal.newMutableList(); ext_pack_fixed32 = Internal.newMutableList(); ext_pack_sfixed32 = Internal.newMutableList(); ext_pack_int64 = Internal.newMutableList(); ext_pack_uint64 = Internal.newMutableList(); ext_pack_sint64 = Internal.newMutableList(); ext_pack_fixed64 = Internal.newMutableList(); ext_pack_sfixed64 = Internal.newMutableList(); ext_pack_bool = Internal.newMutableList(); ext_pack_float = Internal.newMutableList(); ext_pack_double = Internal.newMutableList(); ext_pack_nested_enum = Internal.newMutableList(); } public Builder opt_int32(Integer opt_int32) { this.opt_int32 = opt_int32; return this; } public Builder opt_uint32(Integer opt_uint32) { this.opt_uint32 = opt_uint32; return this; } public Builder opt_sint32(Integer opt_sint32) { this.opt_sint32 = opt_sint32; return this; } public Builder opt_fixed32(Integer opt_fixed32) { this.opt_fixed32 = opt_fixed32; return this; } public Builder opt_sfixed32(Integer opt_sfixed32) { this.opt_sfixed32 = opt_sfixed32; return this; } public Builder opt_int64(Long opt_int64) { this.opt_int64 = opt_int64; return this; } public Builder opt_uint64(Long opt_uint64) { this.opt_uint64 = opt_uint64; return this; } public Builder opt_sint64(Long opt_sint64) { this.opt_sint64 = opt_sint64; return this; } public Builder opt_fixed64(Long opt_fixed64) { this.opt_fixed64 = opt_fixed64; return this; } public Builder opt_sfixed64(Long opt_sfixed64) { this.opt_sfixed64 = opt_sfixed64; return this; } public Builder opt_bool(Boolean opt_bool) { this.opt_bool = opt_bool; return this; } public Builder opt_float(Float opt_float) { this.opt_float = opt_float; return this; } public Builder opt_double(Double opt_double) { this.opt_double = opt_double; return this; } public Builder opt_string(String opt_string) { this.opt_string = opt_string; return this; } public Builder opt_bytes(ByteString opt_bytes) { this.opt_bytes = opt_bytes; return this; } public Builder opt_nested_enum(NestedEnum opt_nested_enum) { this.opt_nested_enum = opt_nested_enum; return this; } public Builder opt_nested_message(NestedMessage opt_nested_message) { this.opt_nested_message = opt_nested_message; return this; } public Builder req_int32(Integer req_int32) { this.req_int32 = req_int32; return this; } public Builder req_uint32(Integer req_uint32) { this.req_uint32 = req_uint32; return this; } public Builder req_sint32(Integer req_sint32) { this.req_sint32 = req_sint32; return this; } public Builder req_fixed32(Integer req_fixed32) { this.req_fixed32 = req_fixed32; return this; } public Builder req_sfixed32(Integer req_sfixed32) { this.req_sfixed32 = req_sfixed32; return this; } public Builder req_int64(Long req_int64) { this.req_int64 = req_int64; return this; } public Builder req_uint64(Long req_uint64) { this.req_uint64 = req_uint64; return this; } public Builder req_sint64(Long req_sint64) { this.req_sint64 = req_sint64; return this; } public Builder req_fixed64(Long req_fixed64) { this.req_fixed64 = req_fixed64; return this; } public Builder req_sfixed64(Long req_sfixed64) { this.req_sfixed64 = req_sfixed64; return this; } public Builder req_bool(Boolean req_bool) { this.req_bool = req_bool; return this; } public Builder req_float(Float req_float) { this.req_float = req_float; return this; } public Builder req_double(Double req_double) { this.req_double = req_double; return this; } public Builder req_string(String req_string) { this.req_string = req_string; return this; } public Builder req_bytes(ByteString req_bytes) { this.req_bytes = req_bytes; return this; } public Builder req_nested_enum(NestedEnum req_nested_enum) { this.req_nested_enum = req_nested_enum; return this; } public Builder req_nested_message(NestedMessage req_nested_message) { this.req_nested_message = req_nested_message; return this; } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder rep_uint32(List<Integer> rep_uint32) { Internal.checkElementsNotNull(rep_uint32); this.rep_uint32 = rep_uint32; return this; } public Builder rep_sint32(List<Integer> rep_sint32) { Internal.checkElementsNotNull(rep_sint32); this.rep_sint32 = rep_sint32; return this; } public Builder rep_fixed32(List<Integer> rep_fixed32) { Internal.checkElementsNotNull(rep_fixed32); this.rep_fixed32 = rep_fixed32; return this; } public Builder rep_sfixed32(List<Integer> rep_sfixed32) { Internal.checkElementsNotNull(rep_sfixed32); this.rep_sfixed32 = rep_sfixed32; return this; } public Builder rep_int64(List<Long> rep_int64) { Internal.checkElementsNotNull(rep_int64); this.rep_int64 = rep_int64; return this; } public Builder rep_uint64(List<Long> rep_uint64) { Internal.checkElementsNotNull(rep_uint64); this.rep_uint64 = rep_uint64; return this; } public Builder rep_sint64(List<Long> rep_sint64) { Internal.checkElementsNotNull(rep_sint64); this.rep_sint64 = rep_sint64; return this; } public Builder rep_fixed64(List<Long> rep_fixed64) { Internal.checkElementsNotNull(rep_fixed64); this.rep_fixed64 = rep_fixed64; return this; } public Builder rep_sfixed64(List<Long> rep_sfixed64) { Internal.checkElementsNotNull(rep_sfixed64); this.rep_sfixed64 = rep_sfixed64; return this; } public Builder rep_bool(List<Boolean> rep_bool) { Internal.checkElementsNotNull(rep_bool); this.rep_bool = rep_bool; return this; } public Builder rep_float(List<Float> rep_float) { Internal.checkElementsNotNull(rep_float); this.rep_float = rep_float; return this; } public Builder rep_double(List<Double> rep_double) { Internal.checkElementsNotNull(rep_double); this.rep_double = rep_double; return this; } public Builder rep_string(List<String> rep_string) { Internal.checkElementsNotNull(rep_string); this.rep_string = rep_string; return this; } public Builder rep_bytes(List<ByteString> rep_bytes) { Internal.checkElementsNotNull(rep_bytes); this.rep_bytes = rep_bytes; return this; } public Builder rep_nested_enum(List<NestedEnum> rep_nested_enum) { Internal.checkElementsNotNull(rep_nested_enum); this.rep_nested_enum = rep_nested_enum; return this; } public Builder rep_nested_message(List<NestedMessage> rep_nested_message) { Internal.checkElementsNotNull(rep_nested_message); this.rep_nested_message = rep_nested_message; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder pack_uint32(List<Integer> pack_uint32) { Internal.checkElementsNotNull(pack_uint32); this.pack_uint32 = pack_uint32; return this; } public Builder pack_sint32(List<Integer> pack_sint32) { Internal.checkElementsNotNull(pack_sint32); this.pack_sint32 = pack_sint32; return this; } public Builder pack_fixed32(List<Integer> pack_fixed32) { Internal.checkElementsNotNull(pack_fixed32); this.pack_fixed32 = pack_fixed32; return this; } public Builder pack_sfixed32(List<Integer> pack_sfixed32) { Internal.checkElementsNotNull(pack_sfixed32); this.pack_sfixed32 = pack_sfixed32; return this; } public Builder pack_int64(List<Long> pack_int64) { Internal.checkElementsNotNull(pack_int64); this.pack_int64 = pack_int64; return this; } public Builder pack_uint64(List<Long> pack_uint64) { Internal.checkElementsNotNull(pack_uint64); this.pack_uint64 = pack_uint64; return this; } public Builder pack_sint64(List<Long> pack_sint64) { Internal.checkElementsNotNull(pack_sint64); this.pack_sint64 = pack_sint64; return this; } public Builder pack_fixed64(List<Long> pack_fixed64) { Internal.checkElementsNotNull(pack_fixed64); this.pack_fixed64 = pack_fixed64; return this; } public Builder pack_sfixed64(List<Long> pack_sfixed64) { Internal.checkElementsNotNull(pack_sfixed64); this.pack_sfixed64 = pack_sfixed64; return this; } public Builder pack_bool(List<Boolean> pack_bool) { Internal.checkElementsNotNull(pack_bool); this.pack_bool = pack_bool; return this; } public Builder pack_float(List<Float> pack_float) { Internal.checkElementsNotNull(pack_float); this.pack_float = pack_float; return this; } public Builder pack_double(List<Double> pack_double) { Internal.checkElementsNotNull(pack_double); this.pack_double = pack_double; return this; } public Builder pack_nested_enum(List<NestedEnum> pack_nested_enum) { Internal.checkElementsNotNull(pack_nested_enum); this.pack_nested_enum = pack_nested_enum; return this; } public Builder default_int32(Integer default_int32) { this.default_int32 = default_int32; return this; } public Builder default_uint32(Integer default_uint32) { this.default_uint32 = default_uint32; return this; } public Builder default_sint32(Integer default_sint32) { this.default_sint32 = default_sint32; return this; } public Builder default_fixed32(Integer default_fixed32) { this.default_fixed32 = default_fixed32; return this; } public Builder default_sfixed32(Integer default_sfixed32) { this.default_sfixed32 = default_sfixed32; return this; } public Builder default_int64(Long default_int64) { this.default_int64 = default_int64; return this; } public Builder default_uint64(Long default_uint64) { this.default_uint64 = default_uint64; return this; } public Builder default_sint64(Long default_sint64) { this.default_sint64 = default_sint64; return this; } public Builder default_fixed64(Long default_fixed64) { this.default_fixed64 = default_fixed64; return this; } public Builder default_sfixed64(Long default_sfixed64) { this.default_sfixed64 = default_sfixed64; return this; } public Builder default_bool(Boolean default_bool) { this.default_bool = default_bool; return this; } public Builder default_float(Float default_float) { this.default_float = default_float; return this; } public Builder default_double(Double default_double) { this.default_double = default_double; return this; } public Builder default_string(String default_string) { this.default_string = default_string; return this; } public Builder default_bytes(ByteString default_bytes) { this.default_bytes = default_bytes; return this; } public Builder default_nested_enum(NestedEnum default_nested_enum) { this.default_nested_enum = default_nested_enum; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } public Builder map_string_string(Map<String, String> map_string_string) { Internal.checkElementsNotNull(map_string_string); this.map_string_string = map_string_string; return this; } public Builder map_string_message(Map<String, NestedMessage> map_string_message) { Internal.checkElementsNotNull(map_string_message); this.map_string_message = map_string_message; return this; } public Builder map_string_enum(Map<String, NestedEnum> map_string_enum) { Internal.checkElementsNotNull(map_string_enum); this.map_string_enum = map_string_enum; return this; } public Builder ext_opt_int32(Integer ext_opt_int32) { this.ext_opt_int32 = ext_opt_int32; return this; } public Builder ext_opt_uint32(Integer ext_opt_uint32) { this.ext_opt_uint32 = ext_opt_uint32; return this; } public Builder ext_opt_sint32(Integer ext_opt_sint32) { this.ext_opt_sint32 = ext_opt_sint32; return this; } public Builder ext_opt_fixed32(Integer ext_opt_fixed32) { this.ext_opt_fixed32 = ext_opt_fixed32; return this; } public Builder ext_opt_sfixed32(Integer ext_opt_sfixed32) { this.ext_opt_sfixed32 = ext_opt_sfixed32; return this; } public Builder ext_opt_int64(Long ext_opt_int64) { this.ext_opt_int64 = ext_opt_int64; return this; } public Builder ext_opt_uint64(Long ext_opt_uint64) { this.ext_opt_uint64 = ext_opt_uint64; return this; } public Builder ext_opt_sint64(Long ext_opt_sint64) { this.ext_opt_sint64 = ext_opt_sint64; return this; } public Builder ext_opt_fixed64(Long ext_opt_fixed64) { this.ext_opt_fixed64 = ext_opt_fixed64; return this; } public Builder ext_opt_sfixed64(Long ext_opt_sfixed64) { this.ext_opt_sfixed64 = ext_opt_sfixed64; return this; } public Builder ext_opt_bool(Boolean ext_opt_bool) { this.ext_opt_bool = ext_opt_bool; return this; } public Builder ext_opt_float(Float ext_opt_float) { this.ext_opt_float = ext_opt_float; return this; } public Builder ext_opt_double(Double ext_opt_double) { this.ext_opt_double = ext_opt_double; return this; } public Builder ext_opt_string(String ext_opt_string) { this.ext_opt_string = ext_opt_string; return this; } public Builder ext_opt_bytes(ByteString ext_opt_bytes) { this.ext_opt_bytes = ext_opt_bytes; return this; } public Builder ext_opt_nested_enum(NestedEnum ext_opt_nested_enum) { this.ext_opt_nested_enum = ext_opt_nested_enum; return this; } public Builder ext_opt_nested_message(NestedMessage ext_opt_nested_message) { this.ext_opt_nested_message = ext_opt_nested_message; return this; } public Builder ext_rep_int32(List<Integer> ext_rep_int32) { Internal.checkElementsNotNull(ext_rep_int32); this.ext_rep_int32 = ext_rep_int32; return this; } public Builder ext_rep_uint32(List<Integer> ext_rep_uint32) { Internal.checkElementsNotNull(ext_rep_uint32); this.ext_rep_uint32 = ext_rep_uint32; return this; } public Builder ext_rep_sint32(List<Integer> ext_rep_sint32) { Internal.checkElementsNotNull(ext_rep_sint32); this.ext_rep_sint32 = ext_rep_sint32; return this; } public Builder ext_rep_fixed32(List<Integer> ext_rep_fixed32) { Internal.checkElementsNotNull(ext_rep_fixed32); this.ext_rep_fixed32 = ext_rep_fixed32; return this; } public Builder ext_rep_sfixed32(List<Integer> ext_rep_sfixed32) { Internal.checkElementsNotNull(ext_rep_sfixed32); this.ext_rep_sfixed32 = ext_rep_sfixed32; return this; } public Builder ext_rep_int64(List<Long> ext_rep_int64) { Internal.checkElementsNotNull(ext_rep_int64); this.ext_rep_int64 = ext_rep_int64; return this; } public Builder ext_rep_uint64(List<Long> ext_rep_uint64) { Internal.checkElementsNotNull(ext_rep_uint64); this.ext_rep_uint64 = ext_rep_uint64; return this; } public Builder ext_rep_sint64(List<Long> ext_rep_sint64) { Internal.checkElementsNotNull(ext_rep_sint64); this.ext_rep_sint64 = ext_rep_sint64; return this; } public Builder ext_rep_fixed64(List<Long> ext_rep_fixed64) { Internal.checkElementsNotNull(ext_rep_fixed64); this.ext_rep_fixed64 = ext_rep_fixed64; return this; } public Builder ext_rep_sfixed64(List<Long> ext_rep_sfixed64) { Internal.checkElementsNotNull(ext_rep_sfixed64); this.ext_rep_sfixed64 = ext_rep_sfixed64; return this; } public Builder ext_rep_bool(List<Boolean> ext_rep_bool) { Internal.checkElementsNotNull(ext_rep_bool); this.ext_rep_bool = ext_rep_bool; return this; } public Builder ext_rep_float(List<Float> ext_rep_float) { Internal.checkElementsNotNull(ext_rep_float); this.ext_rep_float = ext_rep_float; return this; } public Builder ext_rep_double(List<Double> ext_rep_double) { Internal.checkElementsNotNull(ext_rep_double); this.ext_rep_double = ext_rep_double; return this; } public Builder ext_rep_string(List<String> ext_rep_string) { Internal.checkElementsNotNull(ext_rep_string); this.ext_rep_string = ext_rep_string; return this; } public Builder ext_rep_bytes(List<ByteString> ext_rep_bytes) { Internal.checkElementsNotNull(ext_rep_bytes); this.ext_rep_bytes = ext_rep_bytes; return this; } public Builder ext_rep_nested_enum(List<NestedEnum> ext_rep_nested_enum) { Internal.checkElementsNotNull(ext_rep_nested_enum); this.ext_rep_nested_enum = ext_rep_nested_enum; return this; } public Builder ext_rep_nested_message(List<NestedMessage> ext_rep_nested_message) { Internal.checkElementsNotNull(ext_rep_nested_message); this.ext_rep_nested_message = ext_rep_nested_message; return this; } public Builder ext_pack_int32(List<Integer> ext_pack_int32) { Internal.checkElementsNotNull(ext_pack_int32); this.ext_pack_int32 = ext_pack_int32; return this; } public Builder ext_pack_uint32(List<Integer> ext_pack_uint32) { Internal.checkElementsNotNull(ext_pack_uint32); this.ext_pack_uint32 = ext_pack_uint32; return this; } public Builder ext_pack_sint32(List<Integer> ext_pack_sint32) { Internal.checkElementsNotNull(ext_pack_sint32); this.ext_pack_sint32 = ext_pack_sint32; return this; } public Builder ext_pack_fixed32(List<Integer> ext_pack_fixed32) { Internal.checkElementsNotNull(ext_pack_fixed32); this.ext_pack_fixed32 = ext_pack_fixed32; return this; } public Builder ext_pack_sfixed32(List<Integer> ext_pack_sfixed32) { Internal.checkElementsNotNull(ext_pack_sfixed32); this.ext_pack_sfixed32 = ext_pack_sfixed32; return this; } public Builder ext_pack_int64(List<Long> ext_pack_int64) { Internal.checkElementsNotNull(ext_pack_int64); this.ext_pack_int64 = ext_pack_int64; return this; } public Builder ext_pack_uint64(List<Long> ext_pack_uint64) { Internal.checkElementsNotNull(ext_pack_uint64); this.ext_pack_uint64 = ext_pack_uint64; return this; } public Builder ext_pack_sint64(List<Long> ext_pack_sint64) { Internal.checkElementsNotNull(ext_pack_sint64); this.ext_pack_sint64 = ext_pack_sint64; return this; } public Builder ext_pack_fixed64(List<Long> ext_pack_fixed64) { Internal.checkElementsNotNull(ext_pack_fixed64); this.ext_pack_fixed64 = ext_pack_fixed64; return this; } public Builder ext_pack_sfixed64(List<Long> ext_pack_sfixed64) { Internal.checkElementsNotNull(ext_pack_sfixed64); this.ext_pack_sfixed64 = ext_pack_sfixed64; return this; } public Builder ext_pack_bool(List<Boolean> ext_pack_bool) { Internal.checkElementsNotNull(ext_pack_bool); this.ext_pack_bool = ext_pack_bool; return this; } public Builder ext_pack_float(List<Float> ext_pack_float) { Internal.checkElementsNotNull(ext_pack_float); this.ext_pack_float = ext_pack_float; return this; } public Builder ext_pack_double(List<Double> ext_pack_double) { Internal.checkElementsNotNull(ext_pack_double); this.ext_pack_double = ext_pack_double; return this; } public Builder ext_pack_nested_enum(List<NestedEnum> ext_pack_nested_enum) { Internal.checkElementsNotNull(ext_pack_nested_enum); this.ext_pack_nested_enum = ext_pack_nested_enum; return this; } public Builder oneof_string(String oneof_string) { this.oneof_string = oneof_string; this.oneof_int32 = null; this.oneof_nested_message = null; return this; } public Builder oneof_int32(Integer oneof_int32) { this.oneof_int32 = oneof_int32; this.oneof_string = null; this.oneof_nested_message = null; return this; } public Builder oneof_nested_message(NestedMessage oneof_nested_message) { this.oneof_nested_message = oneof_nested_message; this.oneof_string = null; this.oneof_int32 = null; return this; } @Override public AllTypes build() { if (req_int32 == null || req_uint32 == null || req_sint32 == null || req_fixed32 == null || req_sfixed32 == null || req_int64 == null || req_uint64 == null || req_sint64 == null || req_fixed64 == null || req_sfixed64 == null || req_bool == null || req_float == null || req_double == null || req_string == null || req_bytes == null || req_nested_enum == null || req_nested_message == null) { throw Internal.missingRequiredFields(req_int32, "req_int32", req_uint32, "req_uint32", req_sint32, "req_sint32", req_fixed32, "req_fixed32", req_sfixed32, "req_sfixed32", req_int64, "req_int64", req_uint64, "req_uint64", req_sint64, "req_sint64", req_fixed64, "req_fixed64", req_sfixed64, "req_sfixed64", req_bool, "req_bool", req_float, "req_float", req_double, "req_double", req_string, "req_string", req_bytes, "req_bytes", req_nested_enum, "req_nested_enum", req_nested_message, "req_nested_message"); } return new AllTypes(this, super.buildUnknownFields()); } } public enum NestedEnum implements WireEnum { UNKNOWN(0), A(1); public static final ProtoAdapter<NestedEnum> ADAPTER = ProtoAdapter.newEnumAdapter(NestedEnum.class); private final int value; NestedEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static NestedEnum fromValue(int value) { switch (value) { case 0: return UNKNOWN; case 1: return A; default: return null; } } @Override public int getValue() { return value; } } public static final class NestedMessage extends Message<NestedMessage, NestedMessage.Builder> { public static final ProtoAdapter<NestedMessage> ADAPTER = ProtoAdapter.newMessageAdapter(NestedMessage.class, "type.googleapis.com/squareup.proto2.AllTypes.NestedMessage", Syntax.PROTO_2); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_A = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer a; public NestedMessage(Integer a) { this(a, ByteString.EMPTY); } public NestedMessage(Integer a, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedMessage)) return false; NestedMessage o = (NestedMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (a != null ? a.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<NestedMessage, Builder> { public Integer a; public Builder() { } public Builder a(Integer a) { this.a = a; return this; } @Override public NestedMessage build() { return new NestedMessage(a, super.buildUnknownFields()); } } } }
7,120
0
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/person
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/person/java/Person.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.person.java.Person in person_java.proto package com.squareup.wire.proto2.person.java; import com.squareup.wire.EnumAdapter; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import okio.ByteString; /** * Message representing a person, includes their name, unique ID number, email and phone number. */ public final class Person extends Message<Person, Person.Builder> { public static final ProtoAdapter<Person> ADAPTER = new ProtoAdapter_Person(); private static final long serialVersionUID = 0L; public static final String DEFAULT_NAME = ""; public static final Integer DEFAULT_ID = 0; public static final String DEFAULT_EMAIL = ""; /** * The customer's full name. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String name; /** * The customer's ID number. */ @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer id; /** * Email address for the customer. */ @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String email; /** * A list of the customer's phone numbers. */ @WireField( tag = 4, adapter = "com.squareup.wire.proto2.person.java.Person$PhoneNumber#ADAPTER", label = WireField.Label.REPEATED ) public final List<PhoneNumber> phone; public Person(String name, Integer id, String email, List<PhoneNumber> phone) { this(name, id, email, phone, ByteString.EMPTY); } public Person(String name, Integer id, String email, List<PhoneNumber> phone, ByteString unknownFields) { super(ADAPTER, unknownFields); this.name = name; this.id = id; this.email = email; this.phone = Internal.immutableCopyOf("phone", phone); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.name = name; builder.id = id; builder.email = email; builder.phone = Internal.copyOf(phone); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Person)) return false; Person o = (Person) other; return unknownFields().equals(o.unknownFields()) && name.equals(o.name) && id.equals(o.id) && Internal.equals(email, o.email) && phone.equals(o.phone); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + name.hashCode(); result = result * 37 + id.hashCode(); result = result * 37 + (email != null ? email.hashCode() : 0); result = result * 37 + phone.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(", name=").append(Internal.sanitize(name)); builder.append(", id=").append(id); if (email != null) builder.append(", email=").append(Internal.sanitize(email)); if (!phone.isEmpty()) builder.append(", phone=").append(phone); return builder.replace(0, 2, "Person{").append('}').toString(); } public static final class Builder extends Message.Builder<Person, Builder> { public String name; public Integer id; public String email; public List<PhoneNumber> phone; public Builder() { phone = Internal.newMutableList(); } /** * The customer's full name. */ public Builder name(String name) { this.name = name; return this; } /** * The customer's ID number. */ public Builder id(Integer id) { this.id = id; return this; } /** * Email address for the customer. */ public Builder email(String email) { this.email = email; return this; } /** * A list of the customer's phone numbers. */ public Builder phone(List<PhoneNumber> phone) { Internal.checkElementsNotNull(phone); this.phone = phone; return this; } @Override public Person build() { if (name == null || id == null) { throw Internal.missingRequiredFields(name, "name", id, "id"); } return new Person(name, id, email, phone, super.buildUnknownFields()); } } /** * Represents the type of the phone number: mobile, home or work. */ public enum PhoneType implements WireEnum { MOBILE(0), HOME(1), /** * Could be phone or fax. */ WORK(2); public static final ProtoAdapter<PhoneType> ADAPTER = new ProtoAdapter_PhoneType(); private final int value; PhoneType(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static PhoneType fromValue(int value) { switch (value) { case 0: return MOBILE; case 1: return HOME; case 2: return WORK; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_PhoneType extends EnumAdapter<PhoneType> { ProtoAdapter_PhoneType() { super(PhoneType.class, Syntax.PROTO_2, PhoneType.MOBILE); } @Override protected PhoneType fromValue(int value) { return PhoneType.fromValue(value); } } } public static final class PhoneNumber extends Message<PhoneNumber, PhoneNumber.Builder> { public static final ProtoAdapter<PhoneNumber> ADAPTER = new ProtoAdapter_PhoneNumber(); private static final long serialVersionUID = 0L; public static final String DEFAULT_NUMBER = ""; public static final PhoneType DEFAULT_TYPE = PhoneType.HOME; /** * The customer's phone number. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String number; /** * The type of phone stored here. */ @WireField( tag = 2, adapter = "com.squareup.wire.proto2.person.java.Person$PhoneType#ADAPTER" ) public final PhoneType type; public PhoneNumber(String number, PhoneType type) { this(number, type, ByteString.EMPTY); } public PhoneNumber(String number, PhoneType type, ByteString unknownFields) { super(ADAPTER, unknownFields); this.number = number; this.type = type; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.number = number; builder.type = type; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof PhoneNumber)) return false; PhoneNumber o = (PhoneNumber) other; return unknownFields().equals(o.unknownFields()) && number.equals(o.number) && Internal.equals(type, o.type); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + number.hashCode(); result = result * 37 + (type != null ? type.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(", number=").append(Internal.sanitize(number)); if (type != null) builder.append(", type=").append(type); return builder.replace(0, 2, "PhoneNumber{").append('}').toString(); } public static final class Builder extends Message.Builder<PhoneNumber, Builder> { public String number; public PhoneType type; public Builder() { } /** * The customer's phone number. */ public Builder number(String number) { this.number = number; return this; } /** * The type of phone stored here. */ public Builder type(PhoneType type) { this.type = type; return this; } @Override public PhoneNumber build() { if (number == null) { throw Internal.missingRequiredFields(number, "number"); } return new PhoneNumber(number, type, super.buildUnknownFields()); } } private static final class ProtoAdapter_PhoneNumber extends ProtoAdapter<PhoneNumber> { public ProtoAdapter_PhoneNumber() { super(FieldEncoding.LENGTH_DELIMITED, PhoneNumber.class, "type.googleapis.com/squareup.proto2.person.java.Person.PhoneNumber", Syntax.PROTO_2, null, "person_java.proto"); } @Override public int encodedSize(PhoneNumber value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.number); result += PhoneType.ADAPTER.encodedSizeWithTag(2, value.type); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, PhoneNumber value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.number); PhoneType.ADAPTER.encodeWithTag(writer, 2, value.type); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, PhoneNumber value) throws IOException { writer.writeBytes(value.unknownFields()); PhoneType.ADAPTER.encodeWithTag(writer, 2, value.type); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.number); } @Override public PhoneNumber decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.number(ProtoAdapter.STRING.decode(reader)); break; case 2: { try { builder.type(PhoneType.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public PhoneNumber redact(PhoneNumber value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_Person extends ProtoAdapter<Person> { public ProtoAdapter_Person() { super(FieldEncoding.LENGTH_DELIMITED, Person.class, "type.googleapis.com/squareup.proto2.person.java.Person", Syntax.PROTO_2, null, "person_java.proto"); } @Override public int encodedSize(Person value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name); result += ProtoAdapter.INT32.encodedSizeWithTag(2, value.id); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.email); result += PhoneNumber.ADAPTER.asRepeated().encodedSizeWithTag(4, value.phone); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Person value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.id); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.email); PhoneNumber.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.phone); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Person value) throws IOException { writer.writeBytes(value.unknownFields()); PhoneNumber.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.phone); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.email); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.id); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); } @Override public Person decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.name(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.id(ProtoAdapter.INT32.decode(reader)); break; case 3: builder.email(ProtoAdapter.STRING.decode(reader)); break; case 4: builder.phone.add(PhoneNumber.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Person redact(Person value) { Builder builder = value.newBuilder(); Internal.redactElements(builder.phone, PhoneNumber.ADAPTER); builder.clearUnknownFields(); return builder.build(); } } }
7,121
0
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/geology
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/geology/java/Period.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.geology.java.Period in period_java.proto package com.squareup.wire.proto2.geology.java; import com.squareup.wire.EnumAdapter; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import java.lang.Override; public enum Period implements WireEnum { /** * 145.5 million years ago — 66.0 million years ago. */ CRETACEOUS(1), /** * 201.3 million years ago — 145.0 million years ago. */ JURASSIC(2), /** * 252.17 million years ago — 201.3 million years ago. */ TRIASSIC(3); public static final ProtoAdapter<Period> ADAPTER = new ProtoAdapter_Period(); private final int value; Period(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static Period fromValue(int value) { switch (value) { case 1: return CRETACEOUS; case 2: return JURASSIC; case 3: return TRIASSIC; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_Period extends EnumAdapter<Period> { ProtoAdapter_Period() { super(Period.class, Syntax.PROTO_2, null); } @Override protected Period fromValue(int value) { return Period.fromValue(value); } } }
7,122
0
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/dinosaurs
Create_ds/wire/wire-moshi-adapter/src/test/java/com/squareup/wire/proto2/dinosaurs/java/Dinosaur.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.dinosaurs.java.Dinosaur in dinosaur_java.proto package com.squareup.wire.proto2.dinosaurs.java; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import com.squareup.wire.proto2.geology.java.Period; import java.io.IOException; import java.lang.Double; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import okio.ByteString; public final class Dinosaur extends Message<Dinosaur, Dinosaur.Builder> { public static final ProtoAdapter<Dinosaur> ADAPTER = new ProtoAdapter_Dinosaur(); private static final long serialVersionUID = 0L; public static final String DEFAULT_NAME = ""; public static final Double DEFAULT_LENGTH_METERS = 0.0d; public static final Double DEFAULT_MASS_KILOGRAMS = 0.0d; public static final Period DEFAULT_PERIOD = Period.CRETACEOUS; /** * Common name of this dinosaur, like "Stegosaurus". */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String name; /** * URLs with images of this dinosaur. */ @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> picture_urls; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double length_meters; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double mass_kilograms; @WireField( tag = 5, adapter = "com.squareup.wire.proto2.geology.java.Period#ADAPTER" ) public final Period period; public Dinosaur(String name, List<String> picture_urls, Double length_meters, Double mass_kilograms, Period period) { this(name, picture_urls, length_meters, mass_kilograms, period, ByteString.EMPTY); } public Dinosaur(String name, List<String> picture_urls, Double length_meters, Double mass_kilograms, Period period, ByteString unknownFields) { super(ADAPTER, unknownFields); this.name = name; this.picture_urls = Internal.immutableCopyOf("picture_urls", picture_urls); this.length_meters = length_meters; this.mass_kilograms = mass_kilograms; this.period = period; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.name = name; builder.picture_urls = Internal.copyOf(picture_urls); builder.length_meters = length_meters; builder.mass_kilograms = mass_kilograms; builder.period = period; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Dinosaur)) return false; Dinosaur o = (Dinosaur) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(name, o.name) && picture_urls.equals(o.picture_urls) && Internal.equals(length_meters, o.length_meters) && Internal.equals(mass_kilograms, o.mass_kilograms) && Internal.equals(period, o.period); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (name != null ? name.hashCode() : 0); result = result * 37 + picture_urls.hashCode(); result = result * 37 + (length_meters != null ? length_meters.hashCode() : 0); result = result * 37 + (mass_kilograms != null ? mass_kilograms.hashCode() : 0); result = result * 37 + (period != null ? period.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (name != null) builder.append(", name=").append(Internal.sanitize(name)); if (!picture_urls.isEmpty()) builder.append(", picture_urls=").append(Internal.sanitize(picture_urls)); if (length_meters != null) builder.append(", length_meters=").append(length_meters); if (mass_kilograms != null) builder.append(", mass_kilograms=").append(mass_kilograms); if (period != null) builder.append(", period=").append(period); return builder.replace(0, 2, "Dinosaur{").append('}').toString(); } public static final class Builder extends Message.Builder<Dinosaur, Builder> { public String name; public List<String> picture_urls; public Double length_meters; public Double mass_kilograms; public Period period; public Builder() { picture_urls = Internal.newMutableList(); } /** * Common name of this dinosaur, like "Stegosaurus". */ public Builder name(String name) { this.name = name; return this; } /** * URLs with images of this dinosaur. */ public Builder picture_urls(List<String> picture_urls) { Internal.checkElementsNotNull(picture_urls); this.picture_urls = picture_urls; return this; } public Builder length_meters(Double length_meters) { this.length_meters = length_meters; return this; } public Builder mass_kilograms(Double mass_kilograms) { this.mass_kilograms = mass_kilograms; return this; } public Builder period(Period period) { this.period = period; return this; } @Override public Dinosaur build() { return new Dinosaur(name, picture_urls, length_meters, mass_kilograms, period, super.buildUnknownFields()); } } private static final class ProtoAdapter_Dinosaur extends ProtoAdapter<Dinosaur> { public ProtoAdapter_Dinosaur() { super(FieldEncoding.LENGTH_DELIMITED, Dinosaur.class, "type.googleapis.com/squareup.dinosaurs.java.Dinosaur", Syntax.PROTO_2, null, "dinosaur_java.proto"); } @Override public int encodedSize(Dinosaur value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(2, value.picture_urls); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(3, value.length_meters); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(4, value.mass_kilograms); result += Period.ADAPTER.encodedSizeWithTag(5, value.period); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Dinosaur value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 2, value.picture_urls); ProtoAdapter.DOUBLE.encodeWithTag(writer, 3, value.length_meters); ProtoAdapter.DOUBLE.encodeWithTag(writer, 4, value.mass_kilograms); Period.ADAPTER.encodeWithTag(writer, 5, value.period); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Dinosaur value) throws IOException { writer.writeBytes(value.unknownFields()); Period.ADAPTER.encodeWithTag(writer, 5, value.period); ProtoAdapter.DOUBLE.encodeWithTag(writer, 4, value.mass_kilograms); ProtoAdapter.DOUBLE.encodeWithTag(writer, 3, value.length_meters); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 2, value.picture_urls); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); } @Override public Dinosaur decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.name(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.picture_urls.add(ProtoAdapter.STRING.decode(reader)); break; case 3: builder.length_meters(ProtoAdapter.DOUBLE.decode(reader)); break; case 4: builder.mass_kilograms(ProtoAdapter.DOUBLE.decode(reader)); break; case 5: { try { builder.period(Period.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Dinosaur redact(Dinosaur value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
7,123
0
Create_ds/wire/wire-gson-support/src/test/java/squareup/proto2
Create_ds/wire/wire-gson-support/src/test/java/squareup/proto2/keywords/KeywordJava.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.keywords.KeywordJava in keyword_java.proto package squareup.proto2.keywords; import com.squareup.wire.EnumAdapter; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireEnumConstant; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Boolean; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import java.util.Map; import okio.ByteString; public final class KeywordJava extends Message<KeywordJava, KeywordJava.Builder> { public static final ProtoAdapter<KeywordJava> ADAPTER = new ProtoAdapter_KeywordJava(); private static final long serialVersionUID = 0L; public static final String DEFAULT_FINAL_ = ""; public static final Boolean DEFAULT_PUBLIC_ = false; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "final" ) public final String final_; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REQUIRED, declaredName = "public" ) public final Boolean public_; @WireField( tag = 3, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "package" ) public final Map<String, String> package_; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED, declaredName = "return" ) public final List<Boolean> return_; @WireField( tag = 5, adapter = "squareup.proto2.keywords.KeywordJava$KeywordJavaEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<KeywordJavaEnum> enums; public KeywordJava(String final_, Boolean public_, Map<String, String> package_, List<Boolean> return_, List<KeywordJavaEnum> enums) { this(final_, public_, package_, return_, enums, ByteString.EMPTY); } public KeywordJava(String final_, Boolean public_, Map<String, String> package_, List<Boolean> return_, List<KeywordJavaEnum> enums, ByteString unknownFields) { super(ADAPTER, unknownFields); this.final_ = final_; this.public_ = public_; this.package_ = Internal.immutableCopyOf("package_", package_); this.return_ = Internal.immutableCopyOf("return_", return_); this.enums = Internal.immutableCopyOf("enums", enums); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.final_ = final_; builder.public_ = public_; builder.package_ = Internal.copyOf(package_); builder.return_ = Internal.copyOf(return_); builder.enums = Internal.copyOf(enums); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof KeywordJava)) return false; KeywordJava o = (KeywordJava) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(final_, o.final_) && public_.equals(o.public_) && package_.equals(o.package_) && return_.equals(o.return_) && enums.equals(o.enums); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (final_ != null ? final_.hashCode() : 0); result = result * 37 + public_.hashCode(); result = result * 37 + package_.hashCode(); result = result * 37 + return_.hashCode(); result = result * 37 + enums.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (final_ != null) builder.append(", final=").append(Internal.sanitize(final_)); builder.append(", public=").append(public_); if (!package_.isEmpty()) builder.append(", package=").append(package_); if (!return_.isEmpty()) builder.append(", return=").append(return_); if (!enums.isEmpty()) builder.append(", enums=").append(enums); return builder.replace(0, 2, "KeywordJava{").append('}').toString(); } public static final class Builder extends Message.Builder<KeywordJava, Builder> { public String final_; public Boolean public_; public Map<String, String> package_; public List<Boolean> return_; public List<KeywordJavaEnum> enums; public Builder() { package_ = Internal.newMutableMap(); return_ = Internal.newMutableList(); enums = Internal.newMutableList(); } public Builder final_(String final_) { this.final_ = final_; return this; } public Builder public_(Boolean public_) { this.public_ = public_; return this; } public Builder package_(Map<String, String> package_) { Internal.checkElementsNotNull(package_); this.package_ = package_; return this; } public Builder return_(List<Boolean> return_) { Internal.checkElementsNotNull(return_); this.return_ = return_; return this; } public Builder enums(List<KeywordJavaEnum> enums) { Internal.checkElementsNotNull(enums); this.enums = enums; return this; } @Override public KeywordJava build() { if (public_ == null) { throw Internal.missingRequiredFields(public_, "public"); } return new KeywordJava(final_, public_, package_, return_, enums, super.buildUnknownFields()); } } public enum KeywordJavaEnum implements WireEnum { @WireEnumConstant( declaredName = "final" ) final_(0), @WireEnumConstant( declaredName = "public" ) public_(1), @WireEnumConstant( declaredName = "package" ) package_(2), @WireEnumConstant( declaredName = "return" ) return_(3); public static final ProtoAdapter<KeywordJavaEnum> ADAPTER = new ProtoAdapter_KeywordJavaEnum(); private final int value; KeywordJavaEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static KeywordJavaEnum fromValue(int value) { switch (value) { case 0: return final_; case 1: return public_; case 2: return package_; case 3: return return_; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_KeywordJavaEnum extends EnumAdapter<KeywordJavaEnum> { ProtoAdapter_KeywordJavaEnum() { super(KeywordJavaEnum.class, Syntax.PROTO_2, KeywordJavaEnum.final_); } @Override protected KeywordJavaEnum fromValue(int value) { return KeywordJavaEnum.fromValue(value); } } } private static final class ProtoAdapter_KeywordJava extends ProtoAdapter<KeywordJava> { private ProtoAdapter<Map<String, String>> package_; public ProtoAdapter_KeywordJava() { super(FieldEncoding.LENGTH_DELIMITED, KeywordJava.class, "type.googleapis.com/squareup.proto2.keywords.KeywordJava", Syntax.PROTO_2, null, "keyword_java.proto"); } @Override public int encodedSize(KeywordJava value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.final_); result += ProtoAdapter.BOOL.encodedSizeWithTag(2, value.public_); result += package_Adapter().encodedSizeWithTag(3, value.package_); result += ProtoAdapter.BOOL.asRepeated().encodedSizeWithTag(4, value.return_); result += KeywordJavaEnum.ADAPTER.asRepeated().encodedSizeWithTag(5, value.enums); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, KeywordJava value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.final_); ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.public_); package_Adapter().encodeWithTag(writer, 3, value.package_); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 4, value.return_); KeywordJavaEnum.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.enums); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, KeywordJava value) throws IOException { writer.writeBytes(value.unknownFields()); KeywordJavaEnum.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.enums); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 4, value.return_); package_Adapter().encodeWithTag(writer, 3, value.package_); ProtoAdapter.BOOL.encodeWithTag(writer, 2, value.public_); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.final_); } @Override public KeywordJava decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.final_(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.public_(ProtoAdapter.BOOL.decode(reader)); break; case 3: builder.package_.putAll(package_Adapter().decode(reader)); break; case 4: builder.return_.add(ProtoAdapter.BOOL.decode(reader)); break; case 5: { try { builder.enums.add(KeywordJavaEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public KeywordJava redact(KeywordJava value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } private ProtoAdapter<Map<String, String>> package_Adapter() { ProtoAdapter<Map<String, String>> result = package_; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.STRING); package_ = result; } return result; } } }
7,124
0
Create_ds/wire/wire-gson-support/src/test/java/com/squareup
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/GsonTest.java
/* * Copyright (C) 2013 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.wire; import static com.squareup.wire.json.JsonUtils.assertJsonEquals; import static org.assertj.core.api.Assertions.assertThat; import com.google.common.collect.ImmutableMap; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.squareup.wire.proto2.RepeatedPackedAndMap; import com.squareup.wire.proto2.alltypes.AllTypes; import com.squareup.wire.proto2.kotlin.Getters; import com.squareup.wire.proto2.person.kotlin.Person; import com.squareup.wire.proto2.person.kotlin.Person.PhoneNumber; import java.io.File; import java.io.IOException; import java.util.Arrays; import okio.ByteString; import okio.Okio; import org.junit.Test; import squareup.proto2.keywords.KeywordJava; import squareup.proto2.keywords.KeywordJava.KeywordJavaEnum; import squareup.proto2.keywords.KeywordKotlin; import squareup.proto2.keywords.KeywordKotlin.KeywordKotlinEnum; public class GsonTest { private static final String ALL_TYPES_JSON; static { try { ALL_TYPES_JSON = Okio.buffer( Okio.source( new File( "../wire-tests/src/commonTest/shared/json", "all_types_proto2.json"))) .readUtf8(); } catch (IOException e) { throw new RuntimeException(e); } } private final Gson gson = new GsonBuilder() .registerTypeAdapterFactory(new WireTypeAdapterFactory()) .disableHtmlEscaping() .create(); @Test public void deserializationOfNullValues() { // Modifying JSON string manually, cause serialization omits fields with null values. String json = ALL_TYPES_JSON.replace("\"opt_string\": \"124\",", "\"opt_string\": null,"); AllTypes deserializedAllTypesWithNulls = gson.fromJson(json, AllTypes.class); assertThat(deserializedAllTypesWithNulls.opt_string).isNull(); } @Test public void nullRepeatedField() { RepeatedPackedAndMap parsed = gson.fromJson( "{rep_int32=null,pack_int32=null,map_int32_int32=null}", RepeatedPackedAndMap.class); assertThat(parsed.rep_int32).isEmpty(); assertThat(parsed.pack_int32).isEmpty(); assertThat(parsed.map_int32_int32).isEmpty(); } @Test public void usedKeywordsInKotlin() { KeywordKotlin keyword = new KeywordKotlin.Builder() .object_("object") .when_(1) .enums( Arrays.asList( KeywordKotlinEnum.object_, KeywordKotlinEnum.when_, KeywordKotlinEnum.fun_, KeywordKotlinEnum.return_, KeywordKotlinEnum.open_, KeywordKotlinEnum.name_, KeywordKotlinEnum.ordinal_)) .build(); String json = gson.toJson(keyword); assertJsonEquals( "{\"object\":\"object\",\"when\":1, \"fun\":{}, \"return\":[], \"enums\":[\"object\", " + "\"when\", \"fun\", \"return\", \"open\", \"name\", \"ordinal\"]}", json); KeywordKotlin parseKeyword = gson.fromJson(json, KeywordKotlin.class); assertThat(parseKeyword).isEqualTo(keyword); String generatedNamedJson = "{\"object_\":\"object\",\"when_\":1, \"fun_\":{}, \"return_\":[], " + "\"enums\":[\"object_\", \"when_\", \"fun_\", \"return_\", \"open_\", \"name_\", " + "\"ordinal_\"]}"; assertThat(gson.fromJson(generatedNamedJson, KeywordKotlin.class)).isEqualTo(keyword); } @Test public void usedKeywordsInJava() { KeywordJava keyword = new KeywordJava.Builder() .final_("final") .public_(true) .enums( Arrays.asList( KeywordJavaEnum.final_, KeywordJavaEnum.public_, KeywordJavaEnum.package_, KeywordJavaEnum.return_)) .build(); String json = gson.toJson(keyword); assertJsonEquals( "{\"final\":\"final\", \"public\":true, \"package\":{}, \"return\":[], " + "\"enums\":[\"final\", \"public\", \"package\", \"return\"]}", json); KeywordJava parseKeyword = gson.fromJson(json, KeywordJava.class); assertThat(parseKeyword).isEqualTo(keyword); String generatedNamedJson = "{\"final_\":\"final\", \"public_\":true, \"package_\":{}, " + "\"return_\":[], \"enums\":[\"final_\", \"public_\", \"package_\", \"return_\"]}"; assertThat(gson.fromJson(generatedNamedJson, KeywordJava.class)).isEqualTo(keyword); } @Test public void enumKeywordsAtRootInKotlin() { KeywordKotlinEnum constant = KeywordKotlinEnum.object_; String json = gson.toJson(constant); assertJsonEquals("\"object\"", json); KeywordKotlinEnum parseKeyword = gson.fromJson(json, KeywordKotlinEnum.class); assertThat(parseKeyword).isEqualTo(constant); String generatedNamedJson = "\"object_\""; assertThat(gson.fromJson(generatedNamedJson, KeywordKotlinEnum.class)).isEqualTo(constant); } @Test public void enumKeywordsAtRootInJava() { KeywordJavaEnum constant = KeywordJavaEnum.final_; String json = gson.toJson(constant); assertJsonEquals("\"final\"", json); KeywordJavaEnum parseKeyword = gson.fromJson(json, KeywordJavaEnum.class); assertThat(parseKeyword).isEqualTo(constant); String generatedNamedJson = "\"final_\""; assertThat(gson.fromJson(generatedNamedJson, KeywordJavaEnum.class)).isEqualTo(constant); } @Test public void kotlinWithoutBuilderFromJson() { Person person = gson.fromJson( "{" + "\"id\":1," + "\"name\":\"Jo\"," + "\"email\":\"foo@square.com\"," + "\"phone\":[{\"number\": \"555-555-5555\"}, {\"number\": \"444-444-4444\"}]," + "\"favorite_numbers\":[1, 2, 3]," + "\"area_numbers\":{\"519\":\"555-5555\"}," + "\"is_canadian\":true" + "}", Person.class); assertThat(person) .isEqualTo( new Person( "Jo", 1, "foo@square.com", Arrays.asList( new PhoneNumber("555-555-5555", null, ByteString.EMPTY), new PhoneNumber("444-444-4444", null, ByteString.EMPTY)), Arrays.asList(1, 2, 3), ImmutableMap.<Integer, String>builder().put(519, "555-5555").build(), true, ByteString.EMPTY)); } @Test public void kotlinWithoutBuilderToJson() { Person person = new Person( "Jo", 1, "foo@square.com", Arrays.asList( new PhoneNumber("555-555-5555", null, ByteString.EMPTY), new PhoneNumber("444-444-4444", null, ByteString.EMPTY)), Arrays.asList(1, 2, 3), ImmutableMap.<Integer, String>builder().put(519, "555-5555").build(), false, ByteString.EMPTY); String json = gson.toJson(person); assertJsonEquals( "{" + "\"id\":1," + "\"name\":\"Jo\"," + "\"email\":\"foo@square.com\"," + "\"phone\":[{\"number\": \"555-555-5555\"}, {\"number\": \"444-444-4444\"}]," + "\"favorite_numbers\":[1, 2, 3]," + "\"area_numbers\":{\"519\":\"555-5555\"}," + "\"is_canadian\":false" + "}", json); } @Test public void kotlinGettersFromJson() { Getters getters = gson.fromJson("{\"isa\":1,\"isA\":2,\"is_a\":3,\"is32\":32,\"isb\":true}", Getters.class); assertThat(getters).isEqualTo(new Getters(1, 2, 3, 32, true, ByteString.EMPTY)); } @Test public void kotlinGettersToJson() { Getters getters = new Getters(1, 2, 3, 32, true, ByteString.EMPTY); String json = gson.toJson(getters); assertJsonEquals("{\"isa\":1,\"isA\":2,\"is_a\":3,\"is32\":32,\"isb\":true}", json); } }
7,125
0
Create_ds/wire/wire-gson-support/src/test/java/com/squareup
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/GsonNoAdapterTest.java
/* * Copyright (C) 2019 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.squareup.wire; import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.squareup.wire.proto2.dinosaurs.java.Dinosaur; import com.squareup.wire.proto2.geology.java.Period; import java.util.Arrays; import java.util.Collections; import okio.ByteString; import org.junit.Ignore; import org.junit.Test; /** * Using Gson without the adapter is quite fragile: it leaks implementation details of how Gson * works, and it breaks on absent collection types. Nevertheless this is sufficiently commonplace * that we support it like it were a public API. */ public class GsonNoAdapterTest { private final Gson gson = new GsonBuilder().disableHtmlEscaping().create(); @Test public void javaFullObject() { Dinosaur value = new Dinosaur.Builder() .name("Stegosaurus") .period(Period.JURASSIC) .length_meters(9.0) .mass_kilograms(5_000.0) .picture_urls(Arrays.asList("http://goo.gl/LD5KY5", "http://goo.gl/VYRM67")) .build(); String json = "{" + "\"name\":\"Stegosaurus\"," + "\"picture_urls\":[\"http://goo.gl/LD5KY5\",\"http://goo.gl/VYRM67\"]," + "\"length_meters\":9.0," + "\"mass_kilograms\":5000.0," + "\"period\":\"JURASSIC\"" + "}"; assertThat(gson.toJson(value)).isEqualTo(json); Dinosaur decoded = gson.fromJson(json, Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void javaListsOnly() { Dinosaur value = new Dinosaur.Builder().build(); String json = "{" + "\"picture_urls\":[]" + "}"; assertThat(gson.toJson(value)).isEqualTo(json); Dinosaur decoded = gson.fromJson(json, Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Ignore("Absent lists are initialized to null in Java.") @Test public void javaEmptyObject() { Dinosaur value = new Dinosaur.Builder().build(); String json = "{}"; assertThat(gson.toJson(value)).isEqualTo("{\"picture_urls\":[]}"); Dinosaur decoded = gson.fromJson(json, Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void interopFullObject() { com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur value = new com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur.Builder() .name("Stegosaurus") .period(com.squareup.wire.proto2.geology.javainteropkotlin.Period.JURASSIC) .length_meters(9.0) .mass_kilograms(5_000.0) .picture_urls(Arrays.asList("http://goo.gl/LD5KY5", "http://goo.gl/VYRM67")) .build(); String json = "{" + "\"name\":\"Stegosaurus\"," + "\"length_meters\":9.0," + "\"mass_kilograms\":5000.0," + "\"period\":\"JURASSIC\"," + "\"picture_urls\":[\"http://goo.gl/LD5KY5\",\"http://goo.gl/VYRM67\"]" + "}"; assertThat(gson.toJson(value)).isEqualTo(json); com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur decoded = gson.fromJson(json, com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void interopListsOnly() { com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur value = new com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur.Builder().build(); String json = "{" + "\"picture_urls\":[]" + "}"; assertThat(gson.toJson(value)).isEqualTo(json); com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur decoded = gson.fromJson(json, com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void interopEmptyObject() { com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur value = new com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur.Builder().build(); String json = "{}"; assertThat(gson.toJson(value)).isEqualTo("{\"picture_urls\":[]}"); com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur decoded = gson.fromJson(json, com.squareup.wire.proto2.dinosaurs.javainteropkotlin.Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void kotlinFullObject() { com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur value = new com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur( "Stegosaurus", Arrays.asList("http://goo.gl/LD5KY5", "http://goo.gl/VYRM67"), 9.0, 5_000.0, com.squareup.wire.proto2.geology.kotlin.Period.JURASSIC, ByteString.EMPTY); String json = "{" + "\"name\":\"Stegosaurus\"," + "\"length_meters\":9.0," + "\"mass_kilograms\":5000.0," + "\"period\":\"JURASSIC\"," + "\"picture_urls\":[\"http://goo.gl/LD5KY5\",\"http://goo.gl/VYRM67\"]" + "}"; assertThat(gson.toJson(value)).isEqualTo(json); com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur decoded = gson.fromJson(json, com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void kotlinListsOnly() { com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur value = new com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur( null, Collections.emptyList(), null, null, null, ByteString.EMPTY); String json = "{" + "\"picture_urls\":[]" + "}"; assertThat(gson.toJson(value)).isEqualTo(json); com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur decoded = gson.fromJson(json, com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } @Test public void kotlinEmptyObject() { com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur value = new com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur( null, Collections.emptyList(), null, null, null, ByteString.EMPTY); String json = "{}"; assertThat(gson.toJson(value)).isEqualTo("{\"picture_urls\":[]}"); com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur decoded = gson.fromJson(json, com.squareup.wire.proto2.dinosaurs.kotlin.Dinosaur.class); assertThat(decoded).isEqualTo(value); assertThat(decoded.hashCode()).isEqualTo(value.hashCode()); assertThat(decoded.toString()).isEqualTo(value.toString()); } }
7,126
0
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2/RepeatedPackedAndMap.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.alltypes.RepeatedPackedAndMap in collection_types.proto package com.squareup.wire.proto2; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import java.util.Map; import okio.ByteString; public final class RepeatedPackedAndMap extends Message<RepeatedPackedAndMap, RepeatedPackedAndMap.Builder> { public static final ProtoAdapter<RepeatedPackedAndMap> ADAPTER = new ProtoAdapter_RepeatedPackedAndMap(); private static final long serialVersionUID = 0L; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_int32; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> pack_int32; @WireField( tag = 401, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Map<Integer, Integer> map_int32_int32; public RepeatedPackedAndMap(List<Integer> rep_int32, List<Integer> pack_int32, Map<Integer, Integer> map_int32_int32) { this(rep_int32, pack_int32, map_int32_int32, ByteString.EMPTY); } public RepeatedPackedAndMap(List<Integer> rep_int32, List<Integer> pack_int32, Map<Integer, Integer> map_int32_int32, ByteString unknownFields) { super(ADAPTER, unknownFields); this.rep_int32 = Internal.immutableCopyOf("rep_int32", rep_int32); this.pack_int32 = Internal.immutableCopyOf("pack_int32", pack_int32); this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", map_int32_int32); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.rep_int32 = Internal.copyOf(rep_int32); builder.pack_int32 = Internal.copyOf(pack_int32); builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RepeatedPackedAndMap)) return false; RepeatedPackedAndMap o = (RepeatedPackedAndMap) other; return unknownFields().equals(o.unknownFields()) && rep_int32.equals(o.rep_int32) && pack_int32.equals(o.pack_int32) && map_int32_int32.equals(o.map_int32_int32); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + rep_int32.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + map_int32_int32.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!rep_int32.isEmpty()) builder.append(", rep_int32=").append(rep_int32); if (!pack_int32.isEmpty()) builder.append(", pack_int32=").append(pack_int32); if (!map_int32_int32.isEmpty()) builder.append(", map_int32_int32=").append(map_int32_int32); return builder.replace(0, 2, "RepeatedPackedAndMap{").append('}').toString(); } public static final class Builder extends Message.Builder<RepeatedPackedAndMap, Builder> { public List<Integer> rep_int32; public List<Integer> pack_int32; public Map<Integer, Integer> map_int32_int32; public Builder() { rep_int32 = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } @Override public RepeatedPackedAndMap build() { return new RepeatedPackedAndMap(rep_int32, pack_int32, map_int32_int32, super.buildUnknownFields()); } } private static final class ProtoAdapter_RepeatedPackedAndMap extends ProtoAdapter<RepeatedPackedAndMap> { private ProtoAdapter<Map<Integer, Integer>> map_int32_int32; public ProtoAdapter_RepeatedPackedAndMap() { super(FieldEncoding.LENGTH_DELIMITED, RepeatedPackedAndMap.class, "type.googleapis.com/squareup.proto2.alltypes.RepeatedPackedAndMap", Syntax.PROTO_2, null, "collection_types.proto"); } @Override public int encodedSize(RepeatedPackedAndMap value) { int result = 0; result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(201, value.rep_int32); result += ProtoAdapter.INT32.asPacked().encodedSizeWithTag(301, value.pack_int32); result += map_int32_int32Adapter().encodedSizeWithTag(401, value.map_int32_int32); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RepeatedPackedAndMap value) throws IOException { ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 201, value.rep_int32); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 301, value.pack_int32); map_int32_int32Adapter().encodeWithTag(writer, 401, value.map_int32_int32); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RepeatedPackedAndMap value) throws IOException { writer.writeBytes(value.unknownFields()); map_int32_int32Adapter().encodeWithTag(writer, 401, value.map_int32_int32); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 301, value.pack_int32); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 201, value.rep_int32); } @Override public RepeatedPackedAndMap decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 201: builder.rep_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 301: builder.pack_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 401: builder.map_int32_int32.putAll(map_int32_int32Adapter().decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RepeatedPackedAndMap redact(RepeatedPackedAndMap value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } private ProtoAdapter<Map<Integer, Integer>> map_int32_int32Adapter() { ProtoAdapter<Map<Integer, Integer>> result = map_int32_int32; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.INT32, ProtoAdapter.INT32); map_int32_int32 = result; } return result; } } }
7,127
0
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2/alltypes/AllTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.proto2.AllTypes in all_types_proto2.proto package com.squareup.wire.proto2.alltypes; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.lang.Boolean; import java.lang.Double; import java.lang.Float; import java.lang.Integer; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.List; import java.util.Map; import okio.ByteString; public final class AllTypes extends Message<AllTypes, AllTypes.Builder> { public static final ProtoAdapter<AllTypes> ADAPTER = ProtoAdapter.newMessageAdapter(AllTypes.class, "type.googleapis.com/squareup.proto2.AllTypes", Syntax.PROTO_2); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OPT_INT32 = 0; public static final Integer DEFAULT_OPT_UINT32 = 0; public static final Integer DEFAULT_OPT_SINT32 = 0; public static final Integer DEFAULT_OPT_FIXED32 = 0; public static final Integer DEFAULT_OPT_SFIXED32 = 0; public static final Long DEFAULT_OPT_INT64 = 0L; public static final Long DEFAULT_OPT_UINT64 = 0L; public static final Long DEFAULT_OPT_SINT64 = 0L; public static final Long DEFAULT_OPT_FIXED64 = 0L; public static final Long DEFAULT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_OPT_BOOL = false; public static final Float DEFAULT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_OPT_STRING = ""; public static final ByteString DEFAULT_OPT_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_OPT_NESTED_ENUM = NestedEnum.UNKNOWN; public static final Integer DEFAULT_REQ_INT32 = 0; public static final Integer DEFAULT_REQ_UINT32 = 0; public static final Integer DEFAULT_REQ_SINT32 = 0; public static final Integer DEFAULT_REQ_FIXED32 = 0; public static final Integer DEFAULT_REQ_SFIXED32 = 0; public static final Long DEFAULT_REQ_INT64 = 0L; public static final Long DEFAULT_REQ_UINT64 = 0L; public static final Long DEFAULT_REQ_SINT64 = 0L; public static final Long DEFAULT_REQ_FIXED64 = 0L; public static final Long DEFAULT_REQ_SFIXED64 = 0L; public static final Boolean DEFAULT_REQ_BOOL = false; public static final Float DEFAULT_REQ_FLOAT = 0.0f; public static final Double DEFAULT_REQ_DOUBLE = 0.0d; public static final String DEFAULT_REQ_STRING = ""; public static final ByteString DEFAULT_REQ_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_REQ_NESTED_ENUM = NestedEnum.UNKNOWN; public static final Integer DEFAULT_DEFAULT_INT32 = 2147483647; public static final Integer DEFAULT_DEFAULT_UINT32 = -1; public static final Integer DEFAULT_DEFAULT_SINT32 = -2147483648; public static final Integer DEFAULT_DEFAULT_FIXED32 = -1; public static final Integer DEFAULT_DEFAULT_SFIXED32 = -2147483648; public static final Long DEFAULT_DEFAULT_INT64 = 9223372036854775807L; public static final Long DEFAULT_DEFAULT_UINT64 = -1L; public static final Long DEFAULT_DEFAULT_SINT64 = -9223372036854775808L; public static final Long DEFAULT_DEFAULT_FIXED64 = -1L; public static final Long DEFAULT_DEFAULT_SFIXED64 = -9223372036854775808L; public static final Boolean DEFAULT_DEFAULT_BOOL = true; public static final Float DEFAULT_DEFAULT_FLOAT = 123.456e7f; public static final Double DEFAULT_DEFAULT_DOUBLE = 123.456e78d; public static final String DEFAULT_DEFAULT_STRING = "çok\u0007\b\f\n" + "\r\t\u000b\u0001\u0001\u0001\u000f\u000f~\u0001\u0001\u0011\u0001\u0001\u0011güzel"; public static final ByteString DEFAULT_DEFAULT_BYTES = ByteString.decodeBase64("529rBwgMCg0JCwEBAQ8PfgEBEQEBEWf8emVs"); public static final NestedEnum DEFAULT_DEFAULT_NESTED_ENUM = NestedEnum.A; public static final Integer DEFAULT_EXT_OPT_INT32 = 0; public static final Integer DEFAULT_EXT_OPT_UINT32 = 0; public static final Integer DEFAULT_EXT_OPT_SINT32 = 0; public static final Integer DEFAULT_EXT_OPT_FIXED32 = 0; public static final Integer DEFAULT_EXT_OPT_SFIXED32 = 0; public static final Long DEFAULT_EXT_OPT_INT64 = 0L; public static final Long DEFAULT_EXT_OPT_UINT64 = 0L; public static final Long DEFAULT_EXT_OPT_SINT64 = 0L; public static final Long DEFAULT_EXT_OPT_FIXED64 = 0L; public static final Long DEFAULT_EXT_OPT_SFIXED64 = 0L; public static final Boolean DEFAULT_EXT_OPT_BOOL = false; public static final Float DEFAULT_EXT_OPT_FLOAT = 0.0f; public static final Double DEFAULT_EXT_OPT_DOUBLE = 0.0d; public static final String DEFAULT_EXT_OPT_STRING = ""; public static final ByteString DEFAULT_EXT_OPT_BYTES = ByteString.EMPTY; public static final NestedEnum DEFAULT_EXT_OPT_NESTED_ENUM = NestedEnum.UNKNOWN; public static final String DEFAULT_ONEOF_STRING = ""; public static final Integer DEFAULT_ONEOF_INT32 = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer opt_int32; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer opt_uint32; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer opt_sint32; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer opt_fixed32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer opt_sfixed32; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long opt_int64; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long opt_uint64; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long opt_sint64; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long opt_fixed64; @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long opt_sfixed64; @WireField( tag = 11, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean opt_bool; @WireField( tag = 12, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float opt_float; @WireField( tag = 13, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double opt_double; @WireField( tag = 14, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String opt_string; @WireField( tag = 15, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString opt_bytes; @WireField( tag = 16, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum opt_nested_enum; @WireField( tag = 17, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage opt_nested_message; @WireField( tag = 101, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer req_int32; @WireField( tag = 102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REQUIRED ) public final Integer req_uint32; @WireField( tag = 103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REQUIRED ) public final Integer req_sint32; @WireField( tag = 104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REQUIRED ) public final Integer req_fixed32; @WireField( tag = 105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REQUIRED ) public final Integer req_sfixed32; @WireField( tag = 106, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REQUIRED ) public final Long req_int64; @WireField( tag = 107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REQUIRED ) public final Long req_uint64; @WireField( tag = 108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REQUIRED ) public final Long req_sint64; @WireField( tag = 109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REQUIRED ) public final Long req_fixed64; @WireField( tag = 110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REQUIRED ) public final Long req_sfixed64; @WireField( tag = 111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REQUIRED ) public final Boolean req_bool; @WireField( tag = 112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REQUIRED ) public final Float req_float; @WireField( tag = 113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REQUIRED ) public final Double req_double; @WireField( tag = 114, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String req_string; @WireField( tag = 115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REQUIRED ) public final ByteString req_bytes; @WireField( tag = 116, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedEnum req_nested_enum; @WireField( tag = 117, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedMessage req_nested_message; @WireField( tag = 201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_int32; @WireField( tag = 202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_uint32; @WireField( tag = 203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED ) public final List<Integer> rep_sint32; @WireField( tag = 204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED ) public final List<Integer> rep_fixed32; @WireField( tag = 205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED ) public final List<Integer> rep_sfixed32; @WireField( tag = 206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED ) public final List<Long> rep_int64; @WireField( tag = 207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED ) public final List<Long> rep_uint64; @WireField( tag = 208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED ) public final List<Long> rep_sint64; @WireField( tag = 209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED ) public final List<Long> rep_fixed64; @WireField( tag = 210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED ) public final List<Long> rep_sfixed64; @WireField( tag = 211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED ) public final List<Boolean> rep_bool; @WireField( tag = 212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> rep_float; @WireField( tag = 213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) public final List<Double> rep_double; @WireField( tag = 214, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> rep_string; @WireField( tag = 215, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED ) public final List<ByteString> rep_bytes; @WireField( tag = 216, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> rep_nested_enum; @WireField( tag = 217, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> rep_nested_message; @WireField( tag = 301, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> pack_int32; @WireField( tag = 302, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED ) public final List<Integer> pack_uint32; @WireField( tag = 303, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED ) public final List<Integer> pack_sint32; @WireField( tag = 304, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED ) public final List<Integer> pack_fixed32; @WireField( tag = 305, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED ) public final List<Integer> pack_sfixed32; @WireField( tag = 306, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED ) public final List<Long> pack_int64; @WireField( tag = 307, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED ) public final List<Long> pack_uint64; @WireField( tag = 308, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED ) public final List<Long> pack_sint64; @WireField( tag = 309, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED ) public final List<Long> pack_fixed64; @WireField( tag = 310, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED ) public final List<Long> pack_sfixed64; @WireField( tag = 311, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED ) public final List<Boolean> pack_bool; @WireField( tag = 312, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED ) public final List<Float> pack_float; @WireField( tag = 313, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED ) public final List<Double> pack_double; @WireField( tag = 316, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> pack_nested_enum; @WireField( tag = 401, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer default_int32; @WireField( tag = 402, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer default_uint32; @WireField( tag = 403, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer default_sint32; @WireField( tag = 404, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer default_fixed32; @WireField( tag = 405, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer default_sfixed32; @WireField( tag = 406, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long default_int64; @WireField( tag = 407, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long default_uint64; @WireField( tag = 408, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long default_sint64; @WireField( tag = 409, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long default_fixed64; @WireField( tag = 410, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long default_sfixed64; @WireField( tag = 411, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean default_bool; @WireField( tag = 412, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float default_float; @WireField( tag = 413, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double default_double; @WireField( tag = 414, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String default_string; @WireField( tag = 415, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString default_bytes; @WireField( tag = 416, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum default_nested_enum; @WireField( tag = 501, keyAdapter = "com.squareup.wire.ProtoAdapter#INT32", adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Map<Integer, Integer> map_int32_int32; @WireField( tag = 502, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final Map<String, String> map_string_string; @WireField( tag = 503, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final Map<String, NestedMessage> map_string_message; @WireField( tag = 504, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final Map<String, NestedEnum> map_string_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1001, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer ext_opt_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1002, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer ext_opt_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1003, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer ext_opt_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1004, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer ext_opt_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1005, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer ext_opt_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1006, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long ext_opt_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1007, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long ext_opt_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1008, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long ext_opt_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1009, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long ext_opt_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1010, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long ext_opt_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1011, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean ext_opt_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1012, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float ext_opt_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1013, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double ext_opt_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1014, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String ext_opt_string; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1015, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString ext_opt_bytes; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1016, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum ext_opt_nested_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1017, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage ext_opt_nested_message; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1101, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1102, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1103, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1104, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1105, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.REPEATED ) public final List<Integer> ext_rep_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1106, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1107, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1108, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1109, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1110, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.REPEATED ) public final List<Long> ext_rep_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1111, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.REPEATED ) public final List<Boolean> ext_rep_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1112, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> ext_rep_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1113, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) public final List<Double> ext_rep_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1114, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> ext_rep_string; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1115, adapter = "com.squareup.wire.ProtoAdapter#BYTES", label = WireField.Label.REPEATED ) public final List<ByteString> ext_rep_bytes; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1116, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> ext_rep_nested_enum; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1117, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> ext_rep_nested_message; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1201, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_int32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1202, adapter = "com.squareup.wire.ProtoAdapter#UINT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_uint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1203, adapter = "com.squareup.wire.ProtoAdapter#SINT32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_sint32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1204, adapter = "com.squareup.wire.ProtoAdapter#FIXED32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_fixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1205, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32", label = WireField.Label.PACKED ) public final List<Integer> ext_pack_sfixed32; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1206, adapter = "com.squareup.wire.ProtoAdapter#INT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_int64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1207, adapter = "com.squareup.wire.ProtoAdapter#UINT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_uint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1208, adapter = "com.squareup.wire.ProtoAdapter#SINT64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_sint64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1209, adapter = "com.squareup.wire.ProtoAdapter#FIXED64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_fixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1210, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64", label = WireField.Label.PACKED ) public final List<Long> ext_pack_sfixed64; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1211, adapter = "com.squareup.wire.ProtoAdapter#BOOL", label = WireField.Label.PACKED ) public final List<Boolean> ext_pack_bool; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1212, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.PACKED ) public final List<Float> ext_pack_float; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1213, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.PACKED ) public final List<Double> ext_pack_double; /** * Extension source: all_types_proto2.proto */ @WireField( tag = 1216, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> ext_pack_nested_enum; @WireField( tag = 601, adapter = "com.squareup.wire.ProtoAdapter#STRING", oneofName = "choice" ) public final String oneof_string; @WireField( tag = 602, adapter = "com.squareup.wire.ProtoAdapter#INT32", oneofName = "choice" ) public final Integer oneof_int32; @WireField( tag = 603, adapter = "com.squareup.wire.proto2.alltypes.AllTypes$NestedMessage#ADAPTER", oneofName = "choice" ) public final NestedMessage oneof_nested_message; public AllTypes(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message) > 1) { throw new IllegalArgumentException("at most one of builder.oneof_string, builder.oneof_int32, builder.oneof_nested_message may be non-null"); } this.opt_int32 = builder.opt_int32; this.opt_uint32 = builder.opt_uint32; this.opt_sint32 = builder.opt_sint32; this.opt_fixed32 = builder.opt_fixed32; this.opt_sfixed32 = builder.opt_sfixed32; this.opt_int64 = builder.opt_int64; this.opt_uint64 = builder.opt_uint64; this.opt_sint64 = builder.opt_sint64; this.opt_fixed64 = builder.opt_fixed64; this.opt_sfixed64 = builder.opt_sfixed64; this.opt_bool = builder.opt_bool; this.opt_float = builder.opt_float; this.opt_double = builder.opt_double; this.opt_string = builder.opt_string; this.opt_bytes = builder.opt_bytes; this.opt_nested_enum = builder.opt_nested_enum; this.opt_nested_message = builder.opt_nested_message; this.req_int32 = builder.req_int32; this.req_uint32 = builder.req_uint32; this.req_sint32 = builder.req_sint32; this.req_fixed32 = builder.req_fixed32; this.req_sfixed32 = builder.req_sfixed32; this.req_int64 = builder.req_int64; this.req_uint64 = builder.req_uint64; this.req_sint64 = builder.req_sint64; this.req_fixed64 = builder.req_fixed64; this.req_sfixed64 = builder.req_sfixed64; this.req_bool = builder.req_bool; this.req_float = builder.req_float; this.req_double = builder.req_double; this.req_string = builder.req_string; this.req_bytes = builder.req_bytes; this.req_nested_enum = builder.req_nested_enum; this.req_nested_message = builder.req_nested_message; this.rep_int32 = Internal.immutableCopyOf("rep_int32", builder.rep_int32); this.rep_uint32 = Internal.immutableCopyOf("rep_uint32", builder.rep_uint32); this.rep_sint32 = Internal.immutableCopyOf("rep_sint32", builder.rep_sint32); this.rep_fixed32 = Internal.immutableCopyOf("rep_fixed32", builder.rep_fixed32); this.rep_sfixed32 = Internal.immutableCopyOf("rep_sfixed32", builder.rep_sfixed32); this.rep_int64 = Internal.immutableCopyOf("rep_int64", builder.rep_int64); this.rep_uint64 = Internal.immutableCopyOf("rep_uint64", builder.rep_uint64); this.rep_sint64 = Internal.immutableCopyOf("rep_sint64", builder.rep_sint64); this.rep_fixed64 = Internal.immutableCopyOf("rep_fixed64", builder.rep_fixed64); this.rep_sfixed64 = Internal.immutableCopyOf("rep_sfixed64", builder.rep_sfixed64); this.rep_bool = Internal.immutableCopyOf("rep_bool", builder.rep_bool); this.rep_float = Internal.immutableCopyOf("rep_float", builder.rep_float); this.rep_double = Internal.immutableCopyOf("rep_double", builder.rep_double); this.rep_string = Internal.immutableCopyOf("rep_string", builder.rep_string); this.rep_bytes = Internal.immutableCopyOf("rep_bytes", builder.rep_bytes); this.rep_nested_enum = Internal.immutableCopyOf("rep_nested_enum", builder.rep_nested_enum); this.rep_nested_message = Internal.immutableCopyOf("rep_nested_message", builder.rep_nested_message); this.pack_int32 = Internal.immutableCopyOf("pack_int32", builder.pack_int32); this.pack_uint32 = Internal.immutableCopyOf("pack_uint32", builder.pack_uint32); this.pack_sint32 = Internal.immutableCopyOf("pack_sint32", builder.pack_sint32); this.pack_fixed32 = Internal.immutableCopyOf("pack_fixed32", builder.pack_fixed32); this.pack_sfixed32 = Internal.immutableCopyOf("pack_sfixed32", builder.pack_sfixed32); this.pack_int64 = Internal.immutableCopyOf("pack_int64", builder.pack_int64); this.pack_uint64 = Internal.immutableCopyOf("pack_uint64", builder.pack_uint64); this.pack_sint64 = Internal.immutableCopyOf("pack_sint64", builder.pack_sint64); this.pack_fixed64 = Internal.immutableCopyOf("pack_fixed64", builder.pack_fixed64); this.pack_sfixed64 = Internal.immutableCopyOf("pack_sfixed64", builder.pack_sfixed64); this.pack_bool = Internal.immutableCopyOf("pack_bool", builder.pack_bool); this.pack_float = Internal.immutableCopyOf("pack_float", builder.pack_float); this.pack_double = Internal.immutableCopyOf("pack_double", builder.pack_double); this.pack_nested_enum = Internal.immutableCopyOf("pack_nested_enum", builder.pack_nested_enum); this.default_int32 = builder.default_int32; this.default_uint32 = builder.default_uint32; this.default_sint32 = builder.default_sint32; this.default_fixed32 = builder.default_fixed32; this.default_sfixed32 = builder.default_sfixed32; this.default_int64 = builder.default_int64; this.default_uint64 = builder.default_uint64; this.default_sint64 = builder.default_sint64; this.default_fixed64 = builder.default_fixed64; this.default_sfixed64 = builder.default_sfixed64; this.default_bool = builder.default_bool; this.default_float = builder.default_float; this.default_double = builder.default_double; this.default_string = builder.default_string; this.default_bytes = builder.default_bytes; this.default_nested_enum = builder.default_nested_enum; this.map_int32_int32 = Internal.immutableCopyOf("map_int32_int32", builder.map_int32_int32); this.map_string_string = Internal.immutableCopyOf("map_string_string", builder.map_string_string); this.map_string_message = Internal.immutableCopyOf("map_string_message", builder.map_string_message); this.map_string_enum = Internal.immutableCopyOf("map_string_enum", builder.map_string_enum); this.ext_opt_int32 = builder.ext_opt_int32; this.ext_opt_uint32 = builder.ext_opt_uint32; this.ext_opt_sint32 = builder.ext_opt_sint32; this.ext_opt_fixed32 = builder.ext_opt_fixed32; this.ext_opt_sfixed32 = builder.ext_opt_sfixed32; this.ext_opt_int64 = builder.ext_opt_int64; this.ext_opt_uint64 = builder.ext_opt_uint64; this.ext_opt_sint64 = builder.ext_opt_sint64; this.ext_opt_fixed64 = builder.ext_opt_fixed64; this.ext_opt_sfixed64 = builder.ext_opt_sfixed64; this.ext_opt_bool = builder.ext_opt_bool; this.ext_opt_float = builder.ext_opt_float; this.ext_opt_double = builder.ext_opt_double; this.ext_opt_string = builder.ext_opt_string; this.ext_opt_bytes = builder.ext_opt_bytes; this.ext_opt_nested_enum = builder.ext_opt_nested_enum; this.ext_opt_nested_message = builder.ext_opt_nested_message; this.ext_rep_int32 = Internal.immutableCopyOf("ext_rep_int32", builder.ext_rep_int32); this.ext_rep_uint32 = Internal.immutableCopyOf("ext_rep_uint32", builder.ext_rep_uint32); this.ext_rep_sint32 = Internal.immutableCopyOf("ext_rep_sint32", builder.ext_rep_sint32); this.ext_rep_fixed32 = Internal.immutableCopyOf("ext_rep_fixed32", builder.ext_rep_fixed32); this.ext_rep_sfixed32 = Internal.immutableCopyOf("ext_rep_sfixed32", builder.ext_rep_sfixed32); this.ext_rep_int64 = Internal.immutableCopyOf("ext_rep_int64", builder.ext_rep_int64); this.ext_rep_uint64 = Internal.immutableCopyOf("ext_rep_uint64", builder.ext_rep_uint64); this.ext_rep_sint64 = Internal.immutableCopyOf("ext_rep_sint64", builder.ext_rep_sint64); this.ext_rep_fixed64 = Internal.immutableCopyOf("ext_rep_fixed64", builder.ext_rep_fixed64); this.ext_rep_sfixed64 = Internal.immutableCopyOf("ext_rep_sfixed64", builder.ext_rep_sfixed64); this.ext_rep_bool = Internal.immutableCopyOf("ext_rep_bool", builder.ext_rep_bool); this.ext_rep_float = Internal.immutableCopyOf("ext_rep_float", builder.ext_rep_float); this.ext_rep_double = Internal.immutableCopyOf("ext_rep_double", builder.ext_rep_double); this.ext_rep_string = Internal.immutableCopyOf("ext_rep_string", builder.ext_rep_string); this.ext_rep_bytes = Internal.immutableCopyOf("ext_rep_bytes", builder.ext_rep_bytes); this.ext_rep_nested_enum = Internal.immutableCopyOf("ext_rep_nested_enum", builder.ext_rep_nested_enum); this.ext_rep_nested_message = Internal.immutableCopyOf("ext_rep_nested_message", builder.ext_rep_nested_message); this.ext_pack_int32 = Internal.immutableCopyOf("ext_pack_int32", builder.ext_pack_int32); this.ext_pack_uint32 = Internal.immutableCopyOf("ext_pack_uint32", builder.ext_pack_uint32); this.ext_pack_sint32 = Internal.immutableCopyOf("ext_pack_sint32", builder.ext_pack_sint32); this.ext_pack_fixed32 = Internal.immutableCopyOf("ext_pack_fixed32", builder.ext_pack_fixed32); this.ext_pack_sfixed32 = Internal.immutableCopyOf("ext_pack_sfixed32", builder.ext_pack_sfixed32); this.ext_pack_int64 = Internal.immutableCopyOf("ext_pack_int64", builder.ext_pack_int64); this.ext_pack_uint64 = Internal.immutableCopyOf("ext_pack_uint64", builder.ext_pack_uint64); this.ext_pack_sint64 = Internal.immutableCopyOf("ext_pack_sint64", builder.ext_pack_sint64); this.ext_pack_fixed64 = Internal.immutableCopyOf("ext_pack_fixed64", builder.ext_pack_fixed64); this.ext_pack_sfixed64 = Internal.immutableCopyOf("ext_pack_sfixed64", builder.ext_pack_sfixed64); this.ext_pack_bool = Internal.immutableCopyOf("ext_pack_bool", builder.ext_pack_bool); this.ext_pack_float = Internal.immutableCopyOf("ext_pack_float", builder.ext_pack_float); this.ext_pack_double = Internal.immutableCopyOf("ext_pack_double", builder.ext_pack_double); this.ext_pack_nested_enum = Internal.immutableCopyOf("ext_pack_nested_enum", builder.ext_pack_nested_enum); this.oneof_string = builder.oneof_string; this.oneof_int32 = builder.oneof_int32; this.oneof_nested_message = builder.oneof_nested_message; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.opt_int32 = opt_int32; builder.opt_uint32 = opt_uint32; builder.opt_sint32 = opt_sint32; builder.opt_fixed32 = opt_fixed32; builder.opt_sfixed32 = opt_sfixed32; builder.opt_int64 = opt_int64; builder.opt_uint64 = opt_uint64; builder.opt_sint64 = opt_sint64; builder.opt_fixed64 = opt_fixed64; builder.opt_sfixed64 = opt_sfixed64; builder.opt_bool = opt_bool; builder.opt_float = opt_float; builder.opt_double = opt_double; builder.opt_string = opt_string; builder.opt_bytes = opt_bytes; builder.opt_nested_enum = opt_nested_enum; builder.opt_nested_message = opt_nested_message; builder.req_int32 = req_int32; builder.req_uint32 = req_uint32; builder.req_sint32 = req_sint32; builder.req_fixed32 = req_fixed32; builder.req_sfixed32 = req_sfixed32; builder.req_int64 = req_int64; builder.req_uint64 = req_uint64; builder.req_sint64 = req_sint64; builder.req_fixed64 = req_fixed64; builder.req_sfixed64 = req_sfixed64; builder.req_bool = req_bool; builder.req_float = req_float; builder.req_double = req_double; builder.req_string = req_string; builder.req_bytes = req_bytes; builder.req_nested_enum = req_nested_enum; builder.req_nested_message = req_nested_message; builder.rep_int32 = Internal.copyOf(rep_int32); builder.rep_uint32 = Internal.copyOf(rep_uint32); builder.rep_sint32 = Internal.copyOf(rep_sint32); builder.rep_fixed32 = Internal.copyOf(rep_fixed32); builder.rep_sfixed32 = Internal.copyOf(rep_sfixed32); builder.rep_int64 = Internal.copyOf(rep_int64); builder.rep_uint64 = Internal.copyOf(rep_uint64); builder.rep_sint64 = Internal.copyOf(rep_sint64); builder.rep_fixed64 = Internal.copyOf(rep_fixed64); builder.rep_sfixed64 = Internal.copyOf(rep_sfixed64); builder.rep_bool = Internal.copyOf(rep_bool); builder.rep_float = Internal.copyOf(rep_float); builder.rep_double = Internal.copyOf(rep_double); builder.rep_string = Internal.copyOf(rep_string); builder.rep_bytes = Internal.copyOf(rep_bytes); builder.rep_nested_enum = Internal.copyOf(rep_nested_enum); builder.rep_nested_message = Internal.copyOf(rep_nested_message); builder.pack_int32 = Internal.copyOf(pack_int32); builder.pack_uint32 = Internal.copyOf(pack_uint32); builder.pack_sint32 = Internal.copyOf(pack_sint32); builder.pack_fixed32 = Internal.copyOf(pack_fixed32); builder.pack_sfixed32 = Internal.copyOf(pack_sfixed32); builder.pack_int64 = Internal.copyOf(pack_int64); builder.pack_uint64 = Internal.copyOf(pack_uint64); builder.pack_sint64 = Internal.copyOf(pack_sint64); builder.pack_fixed64 = Internal.copyOf(pack_fixed64); builder.pack_sfixed64 = Internal.copyOf(pack_sfixed64); builder.pack_bool = Internal.copyOf(pack_bool); builder.pack_float = Internal.copyOf(pack_float); builder.pack_double = Internal.copyOf(pack_double); builder.pack_nested_enum = Internal.copyOf(pack_nested_enum); builder.default_int32 = default_int32; builder.default_uint32 = default_uint32; builder.default_sint32 = default_sint32; builder.default_fixed32 = default_fixed32; builder.default_sfixed32 = default_sfixed32; builder.default_int64 = default_int64; builder.default_uint64 = default_uint64; builder.default_sint64 = default_sint64; builder.default_fixed64 = default_fixed64; builder.default_sfixed64 = default_sfixed64; builder.default_bool = default_bool; builder.default_float = default_float; builder.default_double = default_double; builder.default_string = default_string; builder.default_bytes = default_bytes; builder.default_nested_enum = default_nested_enum; builder.map_int32_int32 = Internal.copyOf(map_int32_int32); builder.map_string_string = Internal.copyOf(map_string_string); builder.map_string_message = Internal.copyOf(map_string_message); builder.map_string_enum = Internal.copyOf(map_string_enum); builder.ext_opt_int32 = ext_opt_int32; builder.ext_opt_uint32 = ext_opt_uint32; builder.ext_opt_sint32 = ext_opt_sint32; builder.ext_opt_fixed32 = ext_opt_fixed32; builder.ext_opt_sfixed32 = ext_opt_sfixed32; builder.ext_opt_int64 = ext_opt_int64; builder.ext_opt_uint64 = ext_opt_uint64; builder.ext_opt_sint64 = ext_opt_sint64; builder.ext_opt_fixed64 = ext_opt_fixed64; builder.ext_opt_sfixed64 = ext_opt_sfixed64; builder.ext_opt_bool = ext_opt_bool; builder.ext_opt_float = ext_opt_float; builder.ext_opt_double = ext_opt_double; builder.ext_opt_string = ext_opt_string; builder.ext_opt_bytes = ext_opt_bytes; builder.ext_opt_nested_enum = ext_opt_nested_enum; builder.ext_opt_nested_message = ext_opt_nested_message; builder.ext_rep_int32 = Internal.copyOf(ext_rep_int32); builder.ext_rep_uint32 = Internal.copyOf(ext_rep_uint32); builder.ext_rep_sint32 = Internal.copyOf(ext_rep_sint32); builder.ext_rep_fixed32 = Internal.copyOf(ext_rep_fixed32); builder.ext_rep_sfixed32 = Internal.copyOf(ext_rep_sfixed32); builder.ext_rep_int64 = Internal.copyOf(ext_rep_int64); builder.ext_rep_uint64 = Internal.copyOf(ext_rep_uint64); builder.ext_rep_sint64 = Internal.copyOf(ext_rep_sint64); builder.ext_rep_fixed64 = Internal.copyOf(ext_rep_fixed64); builder.ext_rep_sfixed64 = Internal.copyOf(ext_rep_sfixed64); builder.ext_rep_bool = Internal.copyOf(ext_rep_bool); builder.ext_rep_float = Internal.copyOf(ext_rep_float); builder.ext_rep_double = Internal.copyOf(ext_rep_double); builder.ext_rep_string = Internal.copyOf(ext_rep_string); builder.ext_rep_bytes = Internal.copyOf(ext_rep_bytes); builder.ext_rep_nested_enum = Internal.copyOf(ext_rep_nested_enum); builder.ext_rep_nested_message = Internal.copyOf(ext_rep_nested_message); builder.ext_pack_int32 = Internal.copyOf(ext_pack_int32); builder.ext_pack_uint32 = Internal.copyOf(ext_pack_uint32); builder.ext_pack_sint32 = Internal.copyOf(ext_pack_sint32); builder.ext_pack_fixed32 = Internal.copyOf(ext_pack_fixed32); builder.ext_pack_sfixed32 = Internal.copyOf(ext_pack_sfixed32); builder.ext_pack_int64 = Internal.copyOf(ext_pack_int64); builder.ext_pack_uint64 = Internal.copyOf(ext_pack_uint64); builder.ext_pack_sint64 = Internal.copyOf(ext_pack_sint64); builder.ext_pack_fixed64 = Internal.copyOf(ext_pack_fixed64); builder.ext_pack_sfixed64 = Internal.copyOf(ext_pack_sfixed64); builder.ext_pack_bool = Internal.copyOf(ext_pack_bool); builder.ext_pack_float = Internal.copyOf(ext_pack_float); builder.ext_pack_double = Internal.copyOf(ext_pack_double); builder.ext_pack_nested_enum = Internal.copyOf(ext_pack_nested_enum); builder.oneof_string = oneof_string; builder.oneof_int32 = oneof_int32; builder.oneof_nested_message = oneof_nested_message; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof AllTypes)) return false; AllTypes o = (AllTypes) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(opt_int32, o.opt_int32) && Internal.equals(opt_uint32, o.opt_uint32) && Internal.equals(opt_sint32, o.opt_sint32) && Internal.equals(opt_fixed32, o.opt_fixed32) && Internal.equals(opt_sfixed32, o.opt_sfixed32) && Internal.equals(opt_int64, o.opt_int64) && Internal.equals(opt_uint64, o.opt_uint64) && Internal.equals(opt_sint64, o.opt_sint64) && Internal.equals(opt_fixed64, o.opt_fixed64) && Internal.equals(opt_sfixed64, o.opt_sfixed64) && Internal.equals(opt_bool, o.opt_bool) && Internal.equals(opt_float, o.opt_float) && Internal.equals(opt_double, o.opt_double) && Internal.equals(opt_string, o.opt_string) && Internal.equals(opt_bytes, o.opt_bytes) && Internal.equals(opt_nested_enum, o.opt_nested_enum) && Internal.equals(opt_nested_message, o.opt_nested_message) && req_int32.equals(o.req_int32) && req_uint32.equals(o.req_uint32) && req_sint32.equals(o.req_sint32) && req_fixed32.equals(o.req_fixed32) && req_sfixed32.equals(o.req_sfixed32) && req_int64.equals(o.req_int64) && req_uint64.equals(o.req_uint64) && req_sint64.equals(o.req_sint64) && req_fixed64.equals(o.req_fixed64) && req_sfixed64.equals(o.req_sfixed64) && req_bool.equals(o.req_bool) && req_float.equals(o.req_float) && req_double.equals(o.req_double) && req_string.equals(o.req_string) && req_bytes.equals(o.req_bytes) && req_nested_enum.equals(o.req_nested_enum) && req_nested_message.equals(o.req_nested_message) && rep_int32.equals(o.rep_int32) && rep_uint32.equals(o.rep_uint32) && rep_sint32.equals(o.rep_sint32) && rep_fixed32.equals(o.rep_fixed32) && rep_sfixed32.equals(o.rep_sfixed32) && rep_int64.equals(o.rep_int64) && rep_uint64.equals(o.rep_uint64) && rep_sint64.equals(o.rep_sint64) && rep_fixed64.equals(o.rep_fixed64) && rep_sfixed64.equals(o.rep_sfixed64) && rep_bool.equals(o.rep_bool) && rep_float.equals(o.rep_float) && rep_double.equals(o.rep_double) && rep_string.equals(o.rep_string) && rep_bytes.equals(o.rep_bytes) && rep_nested_enum.equals(o.rep_nested_enum) && rep_nested_message.equals(o.rep_nested_message) && pack_int32.equals(o.pack_int32) && pack_uint32.equals(o.pack_uint32) && pack_sint32.equals(o.pack_sint32) && pack_fixed32.equals(o.pack_fixed32) && pack_sfixed32.equals(o.pack_sfixed32) && pack_int64.equals(o.pack_int64) && pack_uint64.equals(o.pack_uint64) && pack_sint64.equals(o.pack_sint64) && pack_fixed64.equals(o.pack_fixed64) && pack_sfixed64.equals(o.pack_sfixed64) && pack_bool.equals(o.pack_bool) && pack_float.equals(o.pack_float) && pack_double.equals(o.pack_double) && pack_nested_enum.equals(o.pack_nested_enum) && Internal.equals(default_int32, o.default_int32) && Internal.equals(default_uint32, o.default_uint32) && Internal.equals(default_sint32, o.default_sint32) && Internal.equals(default_fixed32, o.default_fixed32) && Internal.equals(default_sfixed32, o.default_sfixed32) && Internal.equals(default_int64, o.default_int64) && Internal.equals(default_uint64, o.default_uint64) && Internal.equals(default_sint64, o.default_sint64) && Internal.equals(default_fixed64, o.default_fixed64) && Internal.equals(default_sfixed64, o.default_sfixed64) && Internal.equals(default_bool, o.default_bool) && Internal.equals(default_float, o.default_float) && Internal.equals(default_double, o.default_double) && Internal.equals(default_string, o.default_string) && Internal.equals(default_bytes, o.default_bytes) && Internal.equals(default_nested_enum, o.default_nested_enum) && map_int32_int32.equals(o.map_int32_int32) && map_string_string.equals(o.map_string_string) && map_string_message.equals(o.map_string_message) && map_string_enum.equals(o.map_string_enum) && Internal.equals(ext_opt_int32, o.ext_opt_int32) && Internal.equals(ext_opt_uint32, o.ext_opt_uint32) && Internal.equals(ext_opt_sint32, o.ext_opt_sint32) && Internal.equals(ext_opt_fixed32, o.ext_opt_fixed32) && Internal.equals(ext_opt_sfixed32, o.ext_opt_sfixed32) && Internal.equals(ext_opt_int64, o.ext_opt_int64) && Internal.equals(ext_opt_uint64, o.ext_opt_uint64) && Internal.equals(ext_opt_sint64, o.ext_opt_sint64) && Internal.equals(ext_opt_fixed64, o.ext_opt_fixed64) && Internal.equals(ext_opt_sfixed64, o.ext_opt_sfixed64) && Internal.equals(ext_opt_bool, o.ext_opt_bool) && Internal.equals(ext_opt_float, o.ext_opt_float) && Internal.equals(ext_opt_double, o.ext_opt_double) && Internal.equals(ext_opt_string, o.ext_opt_string) && Internal.equals(ext_opt_bytes, o.ext_opt_bytes) && Internal.equals(ext_opt_nested_enum, o.ext_opt_nested_enum) && Internal.equals(ext_opt_nested_message, o.ext_opt_nested_message) && ext_rep_int32.equals(o.ext_rep_int32) && ext_rep_uint32.equals(o.ext_rep_uint32) && ext_rep_sint32.equals(o.ext_rep_sint32) && ext_rep_fixed32.equals(o.ext_rep_fixed32) && ext_rep_sfixed32.equals(o.ext_rep_sfixed32) && ext_rep_int64.equals(o.ext_rep_int64) && ext_rep_uint64.equals(o.ext_rep_uint64) && ext_rep_sint64.equals(o.ext_rep_sint64) && ext_rep_fixed64.equals(o.ext_rep_fixed64) && ext_rep_sfixed64.equals(o.ext_rep_sfixed64) && ext_rep_bool.equals(o.ext_rep_bool) && ext_rep_float.equals(o.ext_rep_float) && ext_rep_double.equals(o.ext_rep_double) && ext_rep_string.equals(o.ext_rep_string) && ext_rep_bytes.equals(o.ext_rep_bytes) && ext_rep_nested_enum.equals(o.ext_rep_nested_enum) && ext_rep_nested_message.equals(o.ext_rep_nested_message) && ext_pack_int32.equals(o.ext_pack_int32) && ext_pack_uint32.equals(o.ext_pack_uint32) && ext_pack_sint32.equals(o.ext_pack_sint32) && ext_pack_fixed32.equals(o.ext_pack_fixed32) && ext_pack_sfixed32.equals(o.ext_pack_sfixed32) && ext_pack_int64.equals(o.ext_pack_int64) && ext_pack_uint64.equals(o.ext_pack_uint64) && ext_pack_sint64.equals(o.ext_pack_sint64) && ext_pack_fixed64.equals(o.ext_pack_fixed64) && ext_pack_sfixed64.equals(o.ext_pack_sfixed64) && ext_pack_bool.equals(o.ext_pack_bool) && ext_pack_float.equals(o.ext_pack_float) && ext_pack_double.equals(o.ext_pack_double) && ext_pack_nested_enum.equals(o.ext_pack_nested_enum) && Internal.equals(oneof_string, o.oneof_string) && Internal.equals(oneof_int32, o.oneof_int32) && Internal.equals(oneof_nested_message, o.oneof_nested_message); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (opt_int32 != null ? opt_int32.hashCode() : 0); result = result * 37 + (opt_uint32 != null ? opt_uint32.hashCode() : 0); result = result * 37 + (opt_sint32 != null ? opt_sint32.hashCode() : 0); result = result * 37 + (opt_fixed32 != null ? opt_fixed32.hashCode() : 0); result = result * 37 + (opt_sfixed32 != null ? opt_sfixed32.hashCode() : 0); result = result * 37 + (opt_int64 != null ? opt_int64.hashCode() : 0); result = result * 37 + (opt_uint64 != null ? opt_uint64.hashCode() : 0); result = result * 37 + (opt_sint64 != null ? opt_sint64.hashCode() : 0); result = result * 37 + (opt_fixed64 != null ? opt_fixed64.hashCode() : 0); result = result * 37 + (opt_sfixed64 != null ? opt_sfixed64.hashCode() : 0); result = result * 37 + (opt_bool != null ? opt_bool.hashCode() : 0); result = result * 37 + (opt_float != null ? opt_float.hashCode() : 0); result = result * 37 + (opt_double != null ? opt_double.hashCode() : 0); result = result * 37 + (opt_string != null ? opt_string.hashCode() : 0); result = result * 37 + (opt_bytes != null ? opt_bytes.hashCode() : 0); result = result * 37 + (opt_nested_enum != null ? opt_nested_enum.hashCode() : 0); result = result * 37 + (opt_nested_message != null ? opt_nested_message.hashCode() : 0); result = result * 37 + req_int32.hashCode(); result = result * 37 + req_uint32.hashCode(); result = result * 37 + req_sint32.hashCode(); result = result * 37 + req_fixed32.hashCode(); result = result * 37 + req_sfixed32.hashCode(); result = result * 37 + req_int64.hashCode(); result = result * 37 + req_uint64.hashCode(); result = result * 37 + req_sint64.hashCode(); result = result * 37 + req_fixed64.hashCode(); result = result * 37 + req_sfixed64.hashCode(); result = result * 37 + req_bool.hashCode(); result = result * 37 + req_float.hashCode(); result = result * 37 + req_double.hashCode(); result = result * 37 + req_string.hashCode(); result = result * 37 + req_bytes.hashCode(); result = result * 37 + req_nested_enum.hashCode(); result = result * 37 + req_nested_message.hashCode(); result = result * 37 + rep_int32.hashCode(); result = result * 37 + rep_uint32.hashCode(); result = result * 37 + rep_sint32.hashCode(); result = result * 37 + rep_fixed32.hashCode(); result = result * 37 + rep_sfixed32.hashCode(); result = result * 37 + rep_int64.hashCode(); result = result * 37 + rep_uint64.hashCode(); result = result * 37 + rep_sint64.hashCode(); result = result * 37 + rep_fixed64.hashCode(); result = result * 37 + rep_sfixed64.hashCode(); result = result * 37 + rep_bool.hashCode(); result = result * 37 + rep_float.hashCode(); result = result * 37 + rep_double.hashCode(); result = result * 37 + rep_string.hashCode(); result = result * 37 + rep_bytes.hashCode(); result = result * 37 + rep_nested_enum.hashCode(); result = result * 37 + rep_nested_message.hashCode(); result = result * 37 + pack_int32.hashCode(); result = result * 37 + pack_uint32.hashCode(); result = result * 37 + pack_sint32.hashCode(); result = result * 37 + pack_fixed32.hashCode(); result = result * 37 + pack_sfixed32.hashCode(); result = result * 37 + pack_int64.hashCode(); result = result * 37 + pack_uint64.hashCode(); result = result * 37 + pack_sint64.hashCode(); result = result * 37 + pack_fixed64.hashCode(); result = result * 37 + pack_sfixed64.hashCode(); result = result * 37 + pack_bool.hashCode(); result = result * 37 + pack_float.hashCode(); result = result * 37 + pack_double.hashCode(); result = result * 37 + pack_nested_enum.hashCode(); result = result * 37 + (default_int32 != null ? default_int32.hashCode() : 0); result = result * 37 + (default_uint32 != null ? default_uint32.hashCode() : 0); result = result * 37 + (default_sint32 != null ? default_sint32.hashCode() : 0); result = result * 37 + (default_fixed32 != null ? default_fixed32.hashCode() : 0); result = result * 37 + (default_sfixed32 != null ? default_sfixed32.hashCode() : 0); result = result * 37 + (default_int64 != null ? default_int64.hashCode() : 0); result = result * 37 + (default_uint64 != null ? default_uint64.hashCode() : 0); result = result * 37 + (default_sint64 != null ? default_sint64.hashCode() : 0); result = result * 37 + (default_fixed64 != null ? default_fixed64.hashCode() : 0); result = result * 37 + (default_sfixed64 != null ? default_sfixed64.hashCode() : 0); result = result * 37 + (default_bool != null ? default_bool.hashCode() : 0); result = result * 37 + (default_float != null ? default_float.hashCode() : 0); result = result * 37 + (default_double != null ? default_double.hashCode() : 0); result = result * 37 + (default_string != null ? default_string.hashCode() : 0); result = result * 37 + (default_bytes != null ? default_bytes.hashCode() : 0); result = result * 37 + (default_nested_enum != null ? default_nested_enum.hashCode() : 0); result = result * 37 + map_int32_int32.hashCode(); result = result * 37 + map_string_string.hashCode(); result = result * 37 + map_string_message.hashCode(); result = result * 37 + map_string_enum.hashCode(); result = result * 37 + (ext_opt_int32 != null ? ext_opt_int32.hashCode() : 0); result = result * 37 + (ext_opt_uint32 != null ? ext_opt_uint32.hashCode() : 0); result = result * 37 + (ext_opt_sint32 != null ? ext_opt_sint32.hashCode() : 0); result = result * 37 + (ext_opt_fixed32 != null ? ext_opt_fixed32.hashCode() : 0); result = result * 37 + (ext_opt_sfixed32 != null ? ext_opt_sfixed32.hashCode() : 0); result = result * 37 + (ext_opt_int64 != null ? ext_opt_int64.hashCode() : 0); result = result * 37 + (ext_opt_uint64 != null ? ext_opt_uint64.hashCode() : 0); result = result * 37 + (ext_opt_sint64 != null ? ext_opt_sint64.hashCode() : 0); result = result * 37 + (ext_opt_fixed64 != null ? ext_opt_fixed64.hashCode() : 0); result = result * 37 + (ext_opt_sfixed64 != null ? ext_opt_sfixed64.hashCode() : 0); result = result * 37 + (ext_opt_bool != null ? ext_opt_bool.hashCode() : 0); result = result * 37 + (ext_opt_float != null ? ext_opt_float.hashCode() : 0); result = result * 37 + (ext_opt_double != null ? ext_opt_double.hashCode() : 0); result = result * 37 + (ext_opt_string != null ? ext_opt_string.hashCode() : 0); result = result * 37 + (ext_opt_bytes != null ? ext_opt_bytes.hashCode() : 0); result = result * 37 + (ext_opt_nested_enum != null ? ext_opt_nested_enum.hashCode() : 0); result = result * 37 + (ext_opt_nested_message != null ? ext_opt_nested_message.hashCode() : 0); result = result * 37 + ext_rep_int32.hashCode(); result = result * 37 + ext_rep_uint32.hashCode(); result = result * 37 + ext_rep_sint32.hashCode(); result = result * 37 + ext_rep_fixed32.hashCode(); result = result * 37 + ext_rep_sfixed32.hashCode(); result = result * 37 + ext_rep_int64.hashCode(); result = result * 37 + ext_rep_uint64.hashCode(); result = result * 37 + ext_rep_sint64.hashCode(); result = result * 37 + ext_rep_fixed64.hashCode(); result = result * 37 + ext_rep_sfixed64.hashCode(); result = result * 37 + ext_rep_bool.hashCode(); result = result * 37 + ext_rep_float.hashCode(); result = result * 37 + ext_rep_double.hashCode(); result = result * 37 + ext_rep_string.hashCode(); result = result * 37 + ext_rep_bytes.hashCode(); result = result * 37 + ext_rep_nested_enum.hashCode(); result = result * 37 + ext_rep_nested_message.hashCode(); result = result * 37 + ext_pack_int32.hashCode(); result = result * 37 + ext_pack_uint32.hashCode(); result = result * 37 + ext_pack_sint32.hashCode(); result = result * 37 + ext_pack_fixed32.hashCode(); result = result * 37 + ext_pack_sfixed32.hashCode(); result = result * 37 + ext_pack_int64.hashCode(); result = result * 37 + ext_pack_uint64.hashCode(); result = result * 37 + ext_pack_sint64.hashCode(); result = result * 37 + ext_pack_fixed64.hashCode(); result = result * 37 + ext_pack_sfixed64.hashCode(); result = result * 37 + ext_pack_bool.hashCode(); result = result * 37 + ext_pack_float.hashCode(); result = result * 37 + ext_pack_double.hashCode(); result = result * 37 + ext_pack_nested_enum.hashCode(); result = result * 37 + (oneof_string != null ? oneof_string.hashCode() : 0); result = result * 37 + (oneof_int32 != null ? oneof_int32.hashCode() : 0); result = result * 37 + (oneof_nested_message != null ? oneof_nested_message.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<AllTypes, Builder> { public Integer opt_int32; public Integer opt_uint32; public Integer opt_sint32; public Integer opt_fixed32; public Integer opt_sfixed32; public Long opt_int64; public Long opt_uint64; public Long opt_sint64; public Long opt_fixed64; public Long opt_sfixed64; public Boolean opt_bool; public Float opt_float; public Double opt_double; public String opt_string; public ByteString opt_bytes; public NestedEnum opt_nested_enum; public NestedMessage opt_nested_message; public Integer req_int32; public Integer req_uint32; public Integer req_sint32; public Integer req_fixed32; public Integer req_sfixed32; public Long req_int64; public Long req_uint64; public Long req_sint64; public Long req_fixed64; public Long req_sfixed64; public Boolean req_bool; public Float req_float; public Double req_double; public String req_string; public ByteString req_bytes; public NestedEnum req_nested_enum; public NestedMessage req_nested_message; public List<Integer> rep_int32; public List<Integer> rep_uint32; public List<Integer> rep_sint32; public List<Integer> rep_fixed32; public List<Integer> rep_sfixed32; public List<Long> rep_int64; public List<Long> rep_uint64; public List<Long> rep_sint64; public List<Long> rep_fixed64; public List<Long> rep_sfixed64; public List<Boolean> rep_bool; public List<Float> rep_float; public List<Double> rep_double; public List<String> rep_string; public List<ByteString> rep_bytes; public List<NestedEnum> rep_nested_enum; public List<NestedMessage> rep_nested_message; public List<Integer> pack_int32; public List<Integer> pack_uint32; public List<Integer> pack_sint32; public List<Integer> pack_fixed32; public List<Integer> pack_sfixed32; public List<Long> pack_int64; public List<Long> pack_uint64; public List<Long> pack_sint64; public List<Long> pack_fixed64; public List<Long> pack_sfixed64; public List<Boolean> pack_bool; public List<Float> pack_float; public List<Double> pack_double; public List<NestedEnum> pack_nested_enum; public Integer default_int32; public Integer default_uint32; public Integer default_sint32; public Integer default_fixed32; public Integer default_sfixed32; public Long default_int64; public Long default_uint64; public Long default_sint64; public Long default_fixed64; public Long default_sfixed64; public Boolean default_bool; public Float default_float; public Double default_double; public String default_string; public ByteString default_bytes; public NestedEnum default_nested_enum; public Map<Integer, Integer> map_int32_int32; public Map<String, String> map_string_string; public Map<String, NestedMessage> map_string_message; public Map<String, NestedEnum> map_string_enum; public Integer ext_opt_int32; public Integer ext_opt_uint32; public Integer ext_opt_sint32; public Integer ext_opt_fixed32; public Integer ext_opt_sfixed32; public Long ext_opt_int64; public Long ext_opt_uint64; public Long ext_opt_sint64; public Long ext_opt_fixed64; public Long ext_opt_sfixed64; public Boolean ext_opt_bool; public Float ext_opt_float; public Double ext_opt_double; public String ext_opt_string; public ByteString ext_opt_bytes; public NestedEnum ext_opt_nested_enum; public NestedMessage ext_opt_nested_message; public List<Integer> ext_rep_int32; public List<Integer> ext_rep_uint32; public List<Integer> ext_rep_sint32; public List<Integer> ext_rep_fixed32; public List<Integer> ext_rep_sfixed32; public List<Long> ext_rep_int64; public List<Long> ext_rep_uint64; public List<Long> ext_rep_sint64; public List<Long> ext_rep_fixed64; public List<Long> ext_rep_sfixed64; public List<Boolean> ext_rep_bool; public List<Float> ext_rep_float; public List<Double> ext_rep_double; public List<String> ext_rep_string; public List<ByteString> ext_rep_bytes; public List<NestedEnum> ext_rep_nested_enum; public List<NestedMessage> ext_rep_nested_message; public List<Integer> ext_pack_int32; public List<Integer> ext_pack_uint32; public List<Integer> ext_pack_sint32; public List<Integer> ext_pack_fixed32; public List<Integer> ext_pack_sfixed32; public List<Long> ext_pack_int64; public List<Long> ext_pack_uint64; public List<Long> ext_pack_sint64; public List<Long> ext_pack_fixed64; public List<Long> ext_pack_sfixed64; public List<Boolean> ext_pack_bool; public List<Float> ext_pack_float; public List<Double> ext_pack_double; public List<NestedEnum> ext_pack_nested_enum; public String oneof_string; public Integer oneof_int32; public NestedMessage oneof_nested_message; public Builder() { rep_int32 = Internal.newMutableList(); rep_uint32 = Internal.newMutableList(); rep_sint32 = Internal.newMutableList(); rep_fixed32 = Internal.newMutableList(); rep_sfixed32 = Internal.newMutableList(); rep_int64 = Internal.newMutableList(); rep_uint64 = Internal.newMutableList(); rep_sint64 = Internal.newMutableList(); rep_fixed64 = Internal.newMutableList(); rep_sfixed64 = Internal.newMutableList(); rep_bool = Internal.newMutableList(); rep_float = Internal.newMutableList(); rep_double = Internal.newMutableList(); rep_string = Internal.newMutableList(); rep_bytes = Internal.newMutableList(); rep_nested_enum = Internal.newMutableList(); rep_nested_message = Internal.newMutableList(); pack_int32 = Internal.newMutableList(); pack_uint32 = Internal.newMutableList(); pack_sint32 = Internal.newMutableList(); pack_fixed32 = Internal.newMutableList(); pack_sfixed32 = Internal.newMutableList(); pack_int64 = Internal.newMutableList(); pack_uint64 = Internal.newMutableList(); pack_sint64 = Internal.newMutableList(); pack_fixed64 = Internal.newMutableList(); pack_sfixed64 = Internal.newMutableList(); pack_bool = Internal.newMutableList(); pack_float = Internal.newMutableList(); pack_double = Internal.newMutableList(); pack_nested_enum = Internal.newMutableList(); map_int32_int32 = Internal.newMutableMap(); map_string_string = Internal.newMutableMap(); map_string_message = Internal.newMutableMap(); map_string_enum = Internal.newMutableMap(); ext_rep_int32 = Internal.newMutableList(); ext_rep_uint32 = Internal.newMutableList(); ext_rep_sint32 = Internal.newMutableList(); ext_rep_fixed32 = Internal.newMutableList(); ext_rep_sfixed32 = Internal.newMutableList(); ext_rep_int64 = Internal.newMutableList(); ext_rep_uint64 = Internal.newMutableList(); ext_rep_sint64 = Internal.newMutableList(); ext_rep_fixed64 = Internal.newMutableList(); ext_rep_sfixed64 = Internal.newMutableList(); ext_rep_bool = Internal.newMutableList(); ext_rep_float = Internal.newMutableList(); ext_rep_double = Internal.newMutableList(); ext_rep_string = Internal.newMutableList(); ext_rep_bytes = Internal.newMutableList(); ext_rep_nested_enum = Internal.newMutableList(); ext_rep_nested_message = Internal.newMutableList(); ext_pack_int32 = Internal.newMutableList(); ext_pack_uint32 = Internal.newMutableList(); ext_pack_sint32 = Internal.newMutableList(); ext_pack_fixed32 = Internal.newMutableList(); ext_pack_sfixed32 = Internal.newMutableList(); ext_pack_int64 = Internal.newMutableList(); ext_pack_uint64 = Internal.newMutableList(); ext_pack_sint64 = Internal.newMutableList(); ext_pack_fixed64 = Internal.newMutableList(); ext_pack_sfixed64 = Internal.newMutableList(); ext_pack_bool = Internal.newMutableList(); ext_pack_float = Internal.newMutableList(); ext_pack_double = Internal.newMutableList(); ext_pack_nested_enum = Internal.newMutableList(); } public Builder opt_int32(Integer opt_int32) { this.opt_int32 = opt_int32; return this; } public Builder opt_uint32(Integer opt_uint32) { this.opt_uint32 = opt_uint32; return this; } public Builder opt_sint32(Integer opt_sint32) { this.opt_sint32 = opt_sint32; return this; } public Builder opt_fixed32(Integer opt_fixed32) { this.opt_fixed32 = opt_fixed32; return this; } public Builder opt_sfixed32(Integer opt_sfixed32) { this.opt_sfixed32 = opt_sfixed32; return this; } public Builder opt_int64(Long opt_int64) { this.opt_int64 = opt_int64; return this; } public Builder opt_uint64(Long opt_uint64) { this.opt_uint64 = opt_uint64; return this; } public Builder opt_sint64(Long opt_sint64) { this.opt_sint64 = opt_sint64; return this; } public Builder opt_fixed64(Long opt_fixed64) { this.opt_fixed64 = opt_fixed64; return this; } public Builder opt_sfixed64(Long opt_sfixed64) { this.opt_sfixed64 = opt_sfixed64; return this; } public Builder opt_bool(Boolean opt_bool) { this.opt_bool = opt_bool; return this; } public Builder opt_float(Float opt_float) { this.opt_float = opt_float; return this; } public Builder opt_double(Double opt_double) { this.opt_double = opt_double; return this; } public Builder opt_string(String opt_string) { this.opt_string = opt_string; return this; } public Builder opt_bytes(ByteString opt_bytes) { this.opt_bytes = opt_bytes; return this; } public Builder opt_nested_enum(NestedEnum opt_nested_enum) { this.opt_nested_enum = opt_nested_enum; return this; } public Builder opt_nested_message(NestedMessage opt_nested_message) { this.opt_nested_message = opt_nested_message; return this; } public Builder req_int32(Integer req_int32) { this.req_int32 = req_int32; return this; } public Builder req_uint32(Integer req_uint32) { this.req_uint32 = req_uint32; return this; } public Builder req_sint32(Integer req_sint32) { this.req_sint32 = req_sint32; return this; } public Builder req_fixed32(Integer req_fixed32) { this.req_fixed32 = req_fixed32; return this; } public Builder req_sfixed32(Integer req_sfixed32) { this.req_sfixed32 = req_sfixed32; return this; } public Builder req_int64(Long req_int64) { this.req_int64 = req_int64; return this; } public Builder req_uint64(Long req_uint64) { this.req_uint64 = req_uint64; return this; } public Builder req_sint64(Long req_sint64) { this.req_sint64 = req_sint64; return this; } public Builder req_fixed64(Long req_fixed64) { this.req_fixed64 = req_fixed64; return this; } public Builder req_sfixed64(Long req_sfixed64) { this.req_sfixed64 = req_sfixed64; return this; } public Builder req_bool(Boolean req_bool) { this.req_bool = req_bool; return this; } public Builder req_float(Float req_float) { this.req_float = req_float; return this; } public Builder req_double(Double req_double) { this.req_double = req_double; return this; } public Builder req_string(String req_string) { this.req_string = req_string; return this; } public Builder req_bytes(ByteString req_bytes) { this.req_bytes = req_bytes; return this; } public Builder req_nested_enum(NestedEnum req_nested_enum) { this.req_nested_enum = req_nested_enum; return this; } public Builder req_nested_message(NestedMessage req_nested_message) { this.req_nested_message = req_nested_message; return this; } public Builder rep_int32(List<Integer> rep_int32) { Internal.checkElementsNotNull(rep_int32); this.rep_int32 = rep_int32; return this; } public Builder rep_uint32(List<Integer> rep_uint32) { Internal.checkElementsNotNull(rep_uint32); this.rep_uint32 = rep_uint32; return this; } public Builder rep_sint32(List<Integer> rep_sint32) { Internal.checkElementsNotNull(rep_sint32); this.rep_sint32 = rep_sint32; return this; } public Builder rep_fixed32(List<Integer> rep_fixed32) { Internal.checkElementsNotNull(rep_fixed32); this.rep_fixed32 = rep_fixed32; return this; } public Builder rep_sfixed32(List<Integer> rep_sfixed32) { Internal.checkElementsNotNull(rep_sfixed32); this.rep_sfixed32 = rep_sfixed32; return this; } public Builder rep_int64(List<Long> rep_int64) { Internal.checkElementsNotNull(rep_int64); this.rep_int64 = rep_int64; return this; } public Builder rep_uint64(List<Long> rep_uint64) { Internal.checkElementsNotNull(rep_uint64); this.rep_uint64 = rep_uint64; return this; } public Builder rep_sint64(List<Long> rep_sint64) { Internal.checkElementsNotNull(rep_sint64); this.rep_sint64 = rep_sint64; return this; } public Builder rep_fixed64(List<Long> rep_fixed64) { Internal.checkElementsNotNull(rep_fixed64); this.rep_fixed64 = rep_fixed64; return this; } public Builder rep_sfixed64(List<Long> rep_sfixed64) { Internal.checkElementsNotNull(rep_sfixed64); this.rep_sfixed64 = rep_sfixed64; return this; } public Builder rep_bool(List<Boolean> rep_bool) { Internal.checkElementsNotNull(rep_bool); this.rep_bool = rep_bool; return this; } public Builder rep_float(List<Float> rep_float) { Internal.checkElementsNotNull(rep_float); this.rep_float = rep_float; return this; } public Builder rep_double(List<Double> rep_double) { Internal.checkElementsNotNull(rep_double); this.rep_double = rep_double; return this; } public Builder rep_string(List<String> rep_string) { Internal.checkElementsNotNull(rep_string); this.rep_string = rep_string; return this; } public Builder rep_bytes(List<ByteString> rep_bytes) { Internal.checkElementsNotNull(rep_bytes); this.rep_bytes = rep_bytes; return this; } public Builder rep_nested_enum(List<NestedEnum> rep_nested_enum) { Internal.checkElementsNotNull(rep_nested_enum); this.rep_nested_enum = rep_nested_enum; return this; } public Builder rep_nested_message(List<NestedMessage> rep_nested_message) { Internal.checkElementsNotNull(rep_nested_message); this.rep_nested_message = rep_nested_message; return this; } public Builder pack_int32(List<Integer> pack_int32) { Internal.checkElementsNotNull(pack_int32); this.pack_int32 = pack_int32; return this; } public Builder pack_uint32(List<Integer> pack_uint32) { Internal.checkElementsNotNull(pack_uint32); this.pack_uint32 = pack_uint32; return this; } public Builder pack_sint32(List<Integer> pack_sint32) { Internal.checkElementsNotNull(pack_sint32); this.pack_sint32 = pack_sint32; return this; } public Builder pack_fixed32(List<Integer> pack_fixed32) { Internal.checkElementsNotNull(pack_fixed32); this.pack_fixed32 = pack_fixed32; return this; } public Builder pack_sfixed32(List<Integer> pack_sfixed32) { Internal.checkElementsNotNull(pack_sfixed32); this.pack_sfixed32 = pack_sfixed32; return this; } public Builder pack_int64(List<Long> pack_int64) { Internal.checkElementsNotNull(pack_int64); this.pack_int64 = pack_int64; return this; } public Builder pack_uint64(List<Long> pack_uint64) { Internal.checkElementsNotNull(pack_uint64); this.pack_uint64 = pack_uint64; return this; } public Builder pack_sint64(List<Long> pack_sint64) { Internal.checkElementsNotNull(pack_sint64); this.pack_sint64 = pack_sint64; return this; } public Builder pack_fixed64(List<Long> pack_fixed64) { Internal.checkElementsNotNull(pack_fixed64); this.pack_fixed64 = pack_fixed64; return this; } public Builder pack_sfixed64(List<Long> pack_sfixed64) { Internal.checkElementsNotNull(pack_sfixed64); this.pack_sfixed64 = pack_sfixed64; return this; } public Builder pack_bool(List<Boolean> pack_bool) { Internal.checkElementsNotNull(pack_bool); this.pack_bool = pack_bool; return this; } public Builder pack_float(List<Float> pack_float) { Internal.checkElementsNotNull(pack_float); this.pack_float = pack_float; return this; } public Builder pack_double(List<Double> pack_double) { Internal.checkElementsNotNull(pack_double); this.pack_double = pack_double; return this; } public Builder pack_nested_enum(List<NestedEnum> pack_nested_enum) { Internal.checkElementsNotNull(pack_nested_enum); this.pack_nested_enum = pack_nested_enum; return this; } public Builder default_int32(Integer default_int32) { this.default_int32 = default_int32; return this; } public Builder default_uint32(Integer default_uint32) { this.default_uint32 = default_uint32; return this; } public Builder default_sint32(Integer default_sint32) { this.default_sint32 = default_sint32; return this; } public Builder default_fixed32(Integer default_fixed32) { this.default_fixed32 = default_fixed32; return this; } public Builder default_sfixed32(Integer default_sfixed32) { this.default_sfixed32 = default_sfixed32; return this; } public Builder default_int64(Long default_int64) { this.default_int64 = default_int64; return this; } public Builder default_uint64(Long default_uint64) { this.default_uint64 = default_uint64; return this; } public Builder default_sint64(Long default_sint64) { this.default_sint64 = default_sint64; return this; } public Builder default_fixed64(Long default_fixed64) { this.default_fixed64 = default_fixed64; return this; } public Builder default_sfixed64(Long default_sfixed64) { this.default_sfixed64 = default_sfixed64; return this; } public Builder default_bool(Boolean default_bool) { this.default_bool = default_bool; return this; } public Builder default_float(Float default_float) { this.default_float = default_float; return this; } public Builder default_double(Double default_double) { this.default_double = default_double; return this; } public Builder default_string(String default_string) { this.default_string = default_string; return this; } public Builder default_bytes(ByteString default_bytes) { this.default_bytes = default_bytes; return this; } public Builder default_nested_enum(NestedEnum default_nested_enum) { this.default_nested_enum = default_nested_enum; return this; } public Builder map_int32_int32(Map<Integer, Integer> map_int32_int32) { Internal.checkElementsNotNull(map_int32_int32); this.map_int32_int32 = map_int32_int32; return this; } public Builder map_string_string(Map<String, String> map_string_string) { Internal.checkElementsNotNull(map_string_string); this.map_string_string = map_string_string; return this; } public Builder map_string_message(Map<String, NestedMessage> map_string_message) { Internal.checkElementsNotNull(map_string_message); this.map_string_message = map_string_message; return this; } public Builder map_string_enum(Map<String, NestedEnum> map_string_enum) { Internal.checkElementsNotNull(map_string_enum); this.map_string_enum = map_string_enum; return this; } public Builder ext_opt_int32(Integer ext_opt_int32) { this.ext_opt_int32 = ext_opt_int32; return this; } public Builder ext_opt_uint32(Integer ext_opt_uint32) { this.ext_opt_uint32 = ext_opt_uint32; return this; } public Builder ext_opt_sint32(Integer ext_opt_sint32) { this.ext_opt_sint32 = ext_opt_sint32; return this; } public Builder ext_opt_fixed32(Integer ext_opt_fixed32) { this.ext_opt_fixed32 = ext_opt_fixed32; return this; } public Builder ext_opt_sfixed32(Integer ext_opt_sfixed32) { this.ext_opt_sfixed32 = ext_opt_sfixed32; return this; } public Builder ext_opt_int64(Long ext_opt_int64) { this.ext_opt_int64 = ext_opt_int64; return this; } public Builder ext_opt_uint64(Long ext_opt_uint64) { this.ext_opt_uint64 = ext_opt_uint64; return this; } public Builder ext_opt_sint64(Long ext_opt_sint64) { this.ext_opt_sint64 = ext_opt_sint64; return this; } public Builder ext_opt_fixed64(Long ext_opt_fixed64) { this.ext_opt_fixed64 = ext_opt_fixed64; return this; } public Builder ext_opt_sfixed64(Long ext_opt_sfixed64) { this.ext_opt_sfixed64 = ext_opt_sfixed64; return this; } public Builder ext_opt_bool(Boolean ext_opt_bool) { this.ext_opt_bool = ext_opt_bool; return this; } public Builder ext_opt_float(Float ext_opt_float) { this.ext_opt_float = ext_opt_float; return this; } public Builder ext_opt_double(Double ext_opt_double) { this.ext_opt_double = ext_opt_double; return this; } public Builder ext_opt_string(String ext_opt_string) { this.ext_opt_string = ext_opt_string; return this; } public Builder ext_opt_bytes(ByteString ext_opt_bytes) { this.ext_opt_bytes = ext_opt_bytes; return this; } public Builder ext_opt_nested_enum(NestedEnum ext_opt_nested_enum) { this.ext_opt_nested_enum = ext_opt_nested_enum; return this; } public Builder ext_opt_nested_message(NestedMessage ext_opt_nested_message) { this.ext_opt_nested_message = ext_opt_nested_message; return this; } public Builder ext_rep_int32(List<Integer> ext_rep_int32) { Internal.checkElementsNotNull(ext_rep_int32); this.ext_rep_int32 = ext_rep_int32; return this; } public Builder ext_rep_uint32(List<Integer> ext_rep_uint32) { Internal.checkElementsNotNull(ext_rep_uint32); this.ext_rep_uint32 = ext_rep_uint32; return this; } public Builder ext_rep_sint32(List<Integer> ext_rep_sint32) { Internal.checkElementsNotNull(ext_rep_sint32); this.ext_rep_sint32 = ext_rep_sint32; return this; } public Builder ext_rep_fixed32(List<Integer> ext_rep_fixed32) { Internal.checkElementsNotNull(ext_rep_fixed32); this.ext_rep_fixed32 = ext_rep_fixed32; return this; } public Builder ext_rep_sfixed32(List<Integer> ext_rep_sfixed32) { Internal.checkElementsNotNull(ext_rep_sfixed32); this.ext_rep_sfixed32 = ext_rep_sfixed32; return this; } public Builder ext_rep_int64(List<Long> ext_rep_int64) { Internal.checkElementsNotNull(ext_rep_int64); this.ext_rep_int64 = ext_rep_int64; return this; } public Builder ext_rep_uint64(List<Long> ext_rep_uint64) { Internal.checkElementsNotNull(ext_rep_uint64); this.ext_rep_uint64 = ext_rep_uint64; return this; } public Builder ext_rep_sint64(List<Long> ext_rep_sint64) { Internal.checkElementsNotNull(ext_rep_sint64); this.ext_rep_sint64 = ext_rep_sint64; return this; } public Builder ext_rep_fixed64(List<Long> ext_rep_fixed64) { Internal.checkElementsNotNull(ext_rep_fixed64); this.ext_rep_fixed64 = ext_rep_fixed64; return this; } public Builder ext_rep_sfixed64(List<Long> ext_rep_sfixed64) { Internal.checkElementsNotNull(ext_rep_sfixed64); this.ext_rep_sfixed64 = ext_rep_sfixed64; return this; } public Builder ext_rep_bool(List<Boolean> ext_rep_bool) { Internal.checkElementsNotNull(ext_rep_bool); this.ext_rep_bool = ext_rep_bool; return this; } public Builder ext_rep_float(List<Float> ext_rep_float) { Internal.checkElementsNotNull(ext_rep_float); this.ext_rep_float = ext_rep_float; return this; } public Builder ext_rep_double(List<Double> ext_rep_double) { Internal.checkElementsNotNull(ext_rep_double); this.ext_rep_double = ext_rep_double; return this; } public Builder ext_rep_string(List<String> ext_rep_string) { Internal.checkElementsNotNull(ext_rep_string); this.ext_rep_string = ext_rep_string; return this; } public Builder ext_rep_bytes(List<ByteString> ext_rep_bytes) { Internal.checkElementsNotNull(ext_rep_bytes); this.ext_rep_bytes = ext_rep_bytes; return this; } public Builder ext_rep_nested_enum(List<NestedEnum> ext_rep_nested_enum) { Internal.checkElementsNotNull(ext_rep_nested_enum); this.ext_rep_nested_enum = ext_rep_nested_enum; return this; } public Builder ext_rep_nested_message(List<NestedMessage> ext_rep_nested_message) { Internal.checkElementsNotNull(ext_rep_nested_message); this.ext_rep_nested_message = ext_rep_nested_message; return this; } public Builder ext_pack_int32(List<Integer> ext_pack_int32) { Internal.checkElementsNotNull(ext_pack_int32); this.ext_pack_int32 = ext_pack_int32; return this; } public Builder ext_pack_uint32(List<Integer> ext_pack_uint32) { Internal.checkElementsNotNull(ext_pack_uint32); this.ext_pack_uint32 = ext_pack_uint32; return this; } public Builder ext_pack_sint32(List<Integer> ext_pack_sint32) { Internal.checkElementsNotNull(ext_pack_sint32); this.ext_pack_sint32 = ext_pack_sint32; return this; } public Builder ext_pack_fixed32(List<Integer> ext_pack_fixed32) { Internal.checkElementsNotNull(ext_pack_fixed32); this.ext_pack_fixed32 = ext_pack_fixed32; return this; } public Builder ext_pack_sfixed32(List<Integer> ext_pack_sfixed32) { Internal.checkElementsNotNull(ext_pack_sfixed32); this.ext_pack_sfixed32 = ext_pack_sfixed32; return this; } public Builder ext_pack_int64(List<Long> ext_pack_int64) { Internal.checkElementsNotNull(ext_pack_int64); this.ext_pack_int64 = ext_pack_int64; return this; } public Builder ext_pack_uint64(List<Long> ext_pack_uint64) { Internal.checkElementsNotNull(ext_pack_uint64); this.ext_pack_uint64 = ext_pack_uint64; return this; } public Builder ext_pack_sint64(List<Long> ext_pack_sint64) { Internal.checkElementsNotNull(ext_pack_sint64); this.ext_pack_sint64 = ext_pack_sint64; return this; } public Builder ext_pack_fixed64(List<Long> ext_pack_fixed64) { Internal.checkElementsNotNull(ext_pack_fixed64); this.ext_pack_fixed64 = ext_pack_fixed64; return this; } public Builder ext_pack_sfixed64(List<Long> ext_pack_sfixed64) { Internal.checkElementsNotNull(ext_pack_sfixed64); this.ext_pack_sfixed64 = ext_pack_sfixed64; return this; } public Builder ext_pack_bool(List<Boolean> ext_pack_bool) { Internal.checkElementsNotNull(ext_pack_bool); this.ext_pack_bool = ext_pack_bool; return this; } public Builder ext_pack_float(List<Float> ext_pack_float) { Internal.checkElementsNotNull(ext_pack_float); this.ext_pack_float = ext_pack_float; return this; } public Builder ext_pack_double(List<Double> ext_pack_double) { Internal.checkElementsNotNull(ext_pack_double); this.ext_pack_double = ext_pack_double; return this; } public Builder ext_pack_nested_enum(List<NestedEnum> ext_pack_nested_enum) { Internal.checkElementsNotNull(ext_pack_nested_enum); this.ext_pack_nested_enum = ext_pack_nested_enum; return this; } public Builder oneof_string(String oneof_string) { this.oneof_string = oneof_string; this.oneof_int32 = null; this.oneof_nested_message = null; return this; } public Builder oneof_int32(Integer oneof_int32) { this.oneof_int32 = oneof_int32; this.oneof_string = null; this.oneof_nested_message = null; return this; } public Builder oneof_nested_message(NestedMessage oneof_nested_message) { this.oneof_nested_message = oneof_nested_message; this.oneof_string = null; this.oneof_int32 = null; return this; } @Override public AllTypes build() { if (req_int32 == null || req_uint32 == null || req_sint32 == null || req_fixed32 == null || req_sfixed32 == null || req_int64 == null || req_uint64 == null || req_sint64 == null || req_fixed64 == null || req_sfixed64 == null || req_bool == null || req_float == null || req_double == null || req_string == null || req_bytes == null || req_nested_enum == null || req_nested_message == null) { throw Internal.missingRequiredFields(req_int32, "req_int32", req_uint32, "req_uint32", req_sint32, "req_sint32", req_fixed32, "req_fixed32", req_sfixed32, "req_sfixed32", req_int64, "req_int64", req_uint64, "req_uint64", req_sint64, "req_sint64", req_fixed64, "req_fixed64", req_sfixed64, "req_sfixed64", req_bool, "req_bool", req_float, "req_float", req_double, "req_double", req_string, "req_string", req_bytes, "req_bytes", req_nested_enum, "req_nested_enum", req_nested_message, "req_nested_message"); } return new AllTypes(this, super.buildUnknownFields()); } } public enum NestedEnum implements WireEnum { UNKNOWN(0), A(1); public static final ProtoAdapter<NestedEnum> ADAPTER = ProtoAdapter.newEnumAdapter(NestedEnum.class); private final int value; NestedEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static NestedEnum fromValue(int value) { switch (value) { case 0: return UNKNOWN; case 1: return A; default: return null; } } @Override public int getValue() { return value; } } public static final class NestedMessage extends Message<NestedMessage, NestedMessage.Builder> { public static final ProtoAdapter<NestedMessage> ADAPTER = ProtoAdapter.newMessageAdapter(NestedMessage.class, "type.googleapis.com/squareup.proto2.AllTypes.NestedMessage", Syntax.PROTO_2); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_A = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer a; public NestedMessage(Integer a) { this(a, ByteString.EMPTY); } public NestedMessage(Integer a, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedMessage)) return false; NestedMessage o = (NestedMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (a != null ? a.hashCode() : 0); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<NestedMessage, Builder> { public Integer a; public Builder() { } public Builder a(Integer a) { this.a = a; return this; } @Override public NestedMessage build() { return new NestedMessage(a, super.buildUnknownFields()); } } } }
7,128
0
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2/geology
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2/geology/java/Period.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.geology.java.Period in period_java.proto package com.squareup.wire.proto2.geology.java; import com.squareup.wire.EnumAdapter; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.Syntax; import com.squareup.wire.WireEnum; import java.lang.Override; public enum Period implements WireEnum { /** * 145.5 million years ago — 66.0 million years ago. */ CRETACEOUS(1), /** * 201.3 million years ago — 145.0 million years ago. */ JURASSIC(2), /** * 252.17 million years ago — 201.3 million years ago. */ TRIASSIC(3); public static final ProtoAdapter<Period> ADAPTER = new ProtoAdapter_Period(); private final int value; Period(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static Period fromValue(int value) { switch (value) { case 1: return CRETACEOUS; case 2: return JURASSIC; case 3: return TRIASSIC; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_Period extends EnumAdapter<Period> { ProtoAdapter_Period() { super(Period.class, Syntax.PROTO_2, null); } @Override protected Period fromValue(int value) { return Period.fromValue(value); } } }
7,129
0
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2/dinosaurs
Create_ds/wire/wire-gson-support/src/test/java/com/squareup/wire/proto2/dinosaurs/java/Dinosaur.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.dinosaurs.java.Dinosaur in dinosaur_java.proto package com.squareup.wire.proto2.dinosaurs.java; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import com.squareup.wire.Syntax; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import com.squareup.wire.proto2.geology.java.Period; import java.io.IOException; import java.lang.Double; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import okio.ByteString; public final class Dinosaur extends Message<Dinosaur, Dinosaur.Builder> { public static final ProtoAdapter<Dinosaur> ADAPTER = new ProtoAdapter_Dinosaur(); private static final long serialVersionUID = 0L; public static final String DEFAULT_NAME = ""; public static final Double DEFAULT_LENGTH_METERS = 0.0d; public static final Double DEFAULT_MASS_KILOGRAMS = 0.0d; public static final Period DEFAULT_PERIOD = Period.CRETACEOUS; /** * Common name of this dinosaur, like "Stegosaurus". */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String name; /** * URLs with images of this dinosaur. */ @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> picture_urls; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double length_meters; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double mass_kilograms; @WireField( tag = 5, adapter = "com.squareup.wire.proto2.geology.java.Period#ADAPTER" ) public final Period period; public Dinosaur(String name, List<String> picture_urls, Double length_meters, Double mass_kilograms, Period period) { this(name, picture_urls, length_meters, mass_kilograms, period, ByteString.EMPTY); } public Dinosaur(String name, List<String> picture_urls, Double length_meters, Double mass_kilograms, Period period, ByteString unknownFields) { super(ADAPTER, unknownFields); this.name = name; this.picture_urls = Internal.immutableCopyOf("picture_urls", picture_urls); this.length_meters = length_meters; this.mass_kilograms = mass_kilograms; this.period = period; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.name = name; builder.picture_urls = Internal.copyOf(picture_urls); builder.length_meters = length_meters; builder.mass_kilograms = mass_kilograms; builder.period = period; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Dinosaur)) return false; Dinosaur o = (Dinosaur) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(name, o.name) && picture_urls.equals(o.picture_urls) && Internal.equals(length_meters, o.length_meters) && Internal.equals(mass_kilograms, o.mass_kilograms) && Internal.equals(period, o.period); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (name != null ? name.hashCode() : 0); result = result * 37 + picture_urls.hashCode(); result = result * 37 + (length_meters != null ? length_meters.hashCode() : 0); result = result * 37 + (mass_kilograms != null ? mass_kilograms.hashCode() : 0); result = result * 37 + (period != null ? period.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (name != null) builder.append(", name=").append(Internal.sanitize(name)); if (!picture_urls.isEmpty()) builder.append(", picture_urls=").append(Internal.sanitize(picture_urls)); if (length_meters != null) builder.append(", length_meters=").append(length_meters); if (mass_kilograms != null) builder.append(", mass_kilograms=").append(mass_kilograms); if (period != null) builder.append(", period=").append(period); return builder.replace(0, 2, "Dinosaur{").append('}').toString(); } public static final class Builder extends Message.Builder<Dinosaur, Builder> { public String name; public List<String> picture_urls; public Double length_meters; public Double mass_kilograms; public Period period; public Builder() { picture_urls = Internal.newMutableList(); } /** * Common name of this dinosaur, like "Stegosaurus". */ public Builder name(String name) { this.name = name; return this; } /** * URLs with images of this dinosaur. */ public Builder picture_urls(List<String> picture_urls) { Internal.checkElementsNotNull(picture_urls); this.picture_urls = picture_urls; return this; } public Builder length_meters(Double length_meters) { this.length_meters = length_meters; return this; } public Builder mass_kilograms(Double mass_kilograms) { this.mass_kilograms = mass_kilograms; return this; } public Builder period(Period period) { this.period = period; return this; } @Override public Dinosaur build() { return new Dinosaur(name, picture_urls, length_meters, mass_kilograms, period, super.buildUnknownFields()); } } private static final class ProtoAdapter_Dinosaur extends ProtoAdapter<Dinosaur> { public ProtoAdapter_Dinosaur() { super(FieldEncoding.LENGTH_DELIMITED, Dinosaur.class, "type.googleapis.com/squareup.dinosaurs.java.Dinosaur", Syntax.PROTO_2, null, "dinosaur_java.proto"); } @Override public int encodedSize(Dinosaur value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(2, value.picture_urls); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(3, value.length_meters); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(4, value.mass_kilograms); result += Period.ADAPTER.encodedSizeWithTag(5, value.period); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Dinosaur value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 2, value.picture_urls); ProtoAdapter.DOUBLE.encodeWithTag(writer, 3, value.length_meters); ProtoAdapter.DOUBLE.encodeWithTag(writer, 4, value.mass_kilograms); Period.ADAPTER.encodeWithTag(writer, 5, value.period); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Dinosaur value) throws IOException { writer.writeBytes(value.unknownFields()); Period.ADAPTER.encodeWithTag(writer, 5, value.period); ProtoAdapter.DOUBLE.encodeWithTag(writer, 4, value.mass_kilograms); ProtoAdapter.DOUBLE.encodeWithTag(writer, 3, value.length_meters); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 2, value.picture_urls); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); } @Override public Dinosaur decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.name(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.picture_urls.add(ProtoAdapter.STRING.decode(reader)); break; case 3: builder.length_meters(ProtoAdapter.DOUBLE.decode(reader)); break; case 4: builder.mass_kilograms(ProtoAdapter.DOUBLE.decode(reader)); break; case 5: { try { builder.period(Period.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Dinosaur redact(Dinosaur value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
7,130
0
Create_ds/abdera/core/src/test/java/org/apache/abdera/test
Create_ds/abdera/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.test.core; import static org.junit.Assert.assertEquals; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.i18n.text.io.CompressionUtil; import org.junit.Test; public class CoreTest { @Test public void testUriNormalization() { assertEquals("http://www.example.org/Bar/%3F/foo/", IRI .normalizeString("HTTP://www.EXAMPLE.org:80/foo/../Bar/%3f/./foo/.")); assertEquals("https://www.example.org/Bar/%3F/foo/", IRI .normalizeString("HTTPs://www.EXAMPLE.org:443/foo/../Bar/%3f/./foo/.")); assertEquals("http://www.example.org:81/Bar/%3F/foo/", IRI .normalizeString("HTTP://www.EXAMPLE.org:81/foo/../Bar/%3f/./foo/.")); assertEquals("https://www.example.org:444/Bar/%3F/foo/", IRI .normalizeString("HTTPs://www.EXAMPLE.org:444/foo/../Bar/%3f/./foo/.")); } @Test public void testCompressionUtil() throws Exception { String s = "abcdefg"; ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputStream cout = CompressionUtil.getEncodedOutputStream(out, CompressionUtil.CompressionCodec.GZIP); cout.write(s.getBytes("UTF-8")); cout.flush(); cout.close(); byte[] bytes = out.toByteArray(); ByteArrayInputStream in = new ByteArrayInputStream(bytes); InputStream cin = CompressionUtil.getDecodingInputStream(in, CompressionUtil.CompressionCodec.GZIP); byte[] buffer = new byte[20]; int r = cin.read(buffer); String t = new String(buffer, 0, r, "UTF-8"); assertEquals(s, t); } }
7,131
0
Create_ds/abdera/core/src/test/java/org/apache/abdera
Create_ds/abdera/core/src/test/java/org/apache/abdera/util/MimeTypeHelperTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNull; import javax.activation.MimeType; import org.apache.abdera.model.Entry; import org.apache.abdera.model.Feed; import org.apache.abdera.model.Service; import org.easymock.EasyMock; import org.junit.Test; public class MimeTypeHelperTest { @Test public void testCondense() { String[] types = MimeTypeHelper.condense("image/png", "image/gif", "image/png", "image/*"); assertEquals(1, types.length); assertEquals("image/*", types[0]); } @Test public void testGetCharset() { String charsetIso = MimeTypeHelper.getCharset("text/html; charset=utf-8"); assertEquals("utf-8", charsetIso); String charsetEmpty = MimeTypeHelper.getCharset("text/plain"); assertNull(charsetEmpty); } @Test public void testGetMimeType() { String mimeType1 = MimeTypeHelper.getMimeType(EasyMock.createMock(Feed.class)); assertEquals("application/atom+xml;type=feed", mimeType1); String mimeType2 = MimeTypeHelper.getMimeType(EasyMock.createMock(Entry.class)); assertEquals("application/atom+xml;type=entry", mimeType2); String mimeType3 = MimeTypeHelper.getMimeType(EasyMock.createMock(Service.class)); assertEquals("application/atomsvc+xml", mimeType3); } @Test public void testIsApp() { assertTrue(MimeTypeHelper.isApp("application/atomsvc+xml")); assertFalse(MimeTypeHelper.isApp("application/atomserv+xml")); } @Test public void testIsAtom() { assertTrue(MimeTypeHelper.isAtom("application/atom+xml")); assertTrue(MimeTypeHelper.isAtom("application/atom+xml;type=\"entry\"")); assertTrue(MimeTypeHelper.isAtom("application/atom+xml;type=\"feed\"")); } @Test public void testIsEntry() { assertTrue(MimeTypeHelper.isEntry("application/atom+xml;type=\"entry\"")); } @Test public void testIsFeed() { assertTrue(MimeTypeHelper.isFeed("application/atom+xml;type=\"feed\"")); } @Test public void testIsMatch() throws Exception { assertTrue(MimeTypeHelper.isMatch("application/atom+xml;type=entry", "application/atom+xml;type=feed")); assertTrue(MimeTypeHelper.isMatch("*/*", "application/atom+xml;type=feed")); assertTrue(MimeTypeHelper.isMatch("application/atom+xml;type=entry", "*/*")); assertFalse(MimeTypeHelper.isMatch(null, "application/atom+xml;type=feed")); assertFalse(MimeTypeHelper.isMatch("blafasel", "application/atom+xml;type=feed")); MimeType mimeType1 = new MimeType("application/atom+xml;type=entry"); MimeType mimeType2 = new MimeType("application/atom+xml;type=feed"); assertFalse(MimeTypeHelper.isMatch(mimeType1, mimeType2, true)); } @Test public void testIsMimeType() { assertTrue(MimeTypeHelper.isMimeType("text/html")); assertTrue(MimeTypeHelper.isMimeType("*/*")); assertTrue(MimeTypeHelper.isMimeType("blafasel/pdf")); assertFalse(MimeTypeHelper.isMimeType("text")); } @Test public void testIsMultipart() { assertTrue(MimeTypeHelper.isMultipart("multipart/related")); } @Test public void testIsText() { assertTrue(MimeTypeHelper.isText("text/plain")); } @Test public void testIsXml() { assertTrue(MimeTypeHelper.isXml("application/xml")); } }
7,132
0
Create_ds/abdera/core/src/test/java/org/apache/abdera
Create_ds/abdera/core/src/test/java/org/apache/abdera/util/XmlRestrictedCharReaderTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import static org.junit.Assert.assertEquals; import java.io.StringReader; import org.junit.Test; public class XmlRestrictedCharReaderTest { @Test public void testXmlRestrictedCharReader() throws Exception { String s = "\u0001abcdefghijklmnop\u0002"; StringReader r = new StringReader(s); XmlRestrictedCharReader x = new XmlRestrictedCharReader(r); char[] chars = new char[s.length() + 1]; int n = x.read(chars); // the first and last characters should never show up assertEquals(s.length() - 2, n); assertEquals("abcdefghijklmnop", new String(chars, 0, n)); } }
7,133
0
Create_ds/abdera/core/src/test/java/org/apache/abdera
Create_ds/abdera/core/src/test/java/org/apache/abdera/util/ConfigurationTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import static org.junit.Assert.assertEquals; import org.junit.Test; public class ConfigurationTest { @Test public void testDefaultConfigurationProperties() { Configuration config1 = new AbderaConfiguration(); assertEquals("org.apache.abdera.parser.stax.FOMFactory", config1 .getConfigurationOption(Constants.CONFIG_FACTORY, Constants.DEFAULT_FACTORY)); assertEquals("org.apache.abdera.parser.stax.FOMParser", config1 .getConfigurationOption(Constants.CONFIG_PARSER, Constants.DEFAULT_PARSER)); assertEquals("org.apache.abdera.parser.stax.FOMXPath", config1.getConfigurationOption(Constants.CONFIG_XPATH, Constants.DEFAULT_XPATH)); Configuration config2 = AbderaConfiguration.getDefault(); assertEquals("org.apache.abdera.parser.stax.FOMFactory", config2 .getConfigurationOption(Constants.CONFIG_FACTORY, Constants.DEFAULT_FACTORY)); assertEquals("org.apache.abdera.parser.stax.FOMParser", config2 .getConfigurationOption(Constants.CONFIG_PARSER, Constants.DEFAULT_PARSER)); assertEquals("org.apache.abdera.parser.stax.FOMXPath", config2.getConfigurationOption(Constants.CONFIG_XPATH, Constants.DEFAULT_XPATH)); } }
7,134
0
Create_ds/abdera/core/src/test/java/org/apache/abdera
Create_ds/abdera/core/src/test/java/org/apache/abdera/util/AbstractParserOptionsTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import static org.junit.Assert.assertEquals; import org.apache.abdera.factory.Factory; import org.junit.Test; public class AbstractParserOptionsTest { private static final class TestParserOptions extends AbstractParserOptions { @Override protected void checkFactory(Factory factory) { } @Override protected void initFactory() { } } @Test public void checkAllEntities() throws Exception { TestParserOptions fomParserOptions = new TestParserOptions(); assertEquals("00A1", getHexValue("iexcl", fomParserOptions)); assertEquals("00A2", getHexValue("cent", fomParserOptions)); assertEquals("00A3", getHexValue("pound", fomParserOptions)); assertEquals("00A4", getHexValue("curren", fomParserOptions)); assertEquals("00A5", getHexValue("yen", fomParserOptions)); assertEquals("00A6", getHexValue("brvbar", fomParserOptions)); assertEquals("00A7", getHexValue("sect", fomParserOptions)); assertEquals("00A8", getHexValue("uml", fomParserOptions)); assertEquals("00A9", getHexValue("copy", fomParserOptions)); assertEquals("00AA", getHexValue("ordf", fomParserOptions)); assertEquals("00AB", getHexValue("laquo", fomParserOptions)); assertEquals("00AC", getHexValue("not", fomParserOptions)); assertEquals("00AD", getHexValue("shy", fomParserOptions)); assertEquals("00AE", getHexValue("reg", fomParserOptions)); assertEquals("00AF", getHexValue("macr", fomParserOptions)); assertEquals("00B0", getHexValue("deg", fomParserOptions)); assertEquals("00B1", getHexValue("plusmn", fomParserOptions)); assertEquals("00B2", getHexValue("sup2", fomParserOptions)); assertEquals("00B3", getHexValue("sup3", fomParserOptions)); assertEquals("00B4", getHexValue("acute", fomParserOptions)); assertEquals("00B5", getHexValue("micro", fomParserOptions)); assertEquals("00B6", getHexValue("para", fomParserOptions)); assertEquals("00B7", getHexValue("middot", fomParserOptions)); assertEquals("00B8", getHexValue("cedil", fomParserOptions)); assertEquals("00B9", getHexValue("sup1", fomParserOptions)); assertEquals("00BA", getHexValue("ordm", fomParserOptions)); assertEquals("00BB", getHexValue("raquo", fomParserOptions)); assertEquals("00BC", getHexValue("frac14", fomParserOptions)); assertEquals("00BD", getHexValue("frac12", fomParserOptions)); assertEquals("00BE", getHexValue("frac34", fomParserOptions)); assertEquals("00BF", getHexValue("iquest", fomParserOptions)); assertEquals("00C0", getHexValue("Agrave", fomParserOptions)); assertEquals("00C1", getHexValue("Aacute", fomParserOptions)); assertEquals("00C2", getHexValue("Acirc", fomParserOptions)); assertEquals("00C3", getHexValue("Atilde", fomParserOptions)); assertEquals("00C4", getHexValue("Auml", fomParserOptions)); assertEquals("00C5", getHexValue("Aring", fomParserOptions)); assertEquals("00C6", getHexValue("AElig", fomParserOptions)); assertEquals("00C7", getHexValue("Ccedil", fomParserOptions)); assertEquals("00C8", getHexValue("Egrave", fomParserOptions)); assertEquals("00C9", getHexValue("Eacute", fomParserOptions)); assertEquals("00CA", getHexValue("Ecirc", fomParserOptions)); assertEquals("00CB", getHexValue("Euml", fomParserOptions)); assertEquals("00CC", getHexValue("Igrave", fomParserOptions)); assertEquals("00CD", getHexValue("Iacute", fomParserOptions)); assertEquals("00CE", getHexValue("Icirc", fomParserOptions)); assertEquals("00CF", getHexValue("Iuml", fomParserOptions)); assertEquals("00D0", getHexValue("ETH", fomParserOptions)); assertEquals("00D1", getHexValue("Ntilde", fomParserOptions)); assertEquals("00D2", getHexValue("Ograve", fomParserOptions)); assertEquals("00D3", getHexValue("Oacute", fomParserOptions)); assertEquals("00D4", getHexValue("Ocirc", fomParserOptions)); assertEquals("00D5", getHexValue("Otilde", fomParserOptions)); assertEquals("00D6", getHexValue("Ouml", fomParserOptions)); assertEquals("00D7", getHexValue("times", fomParserOptions)); assertEquals("00D8", getHexValue("Oslash", fomParserOptions)); assertEquals("00D9", getHexValue("Ugrave", fomParserOptions)); assertEquals("00DA", getHexValue("Uacute", fomParserOptions)); assertEquals("00DB", getHexValue("Ucirc", fomParserOptions)); assertEquals("00DC", getHexValue("Uuml", fomParserOptions)); assertEquals("00DD", getHexValue("Yacute", fomParserOptions)); assertEquals("00DE", getHexValue("THORN", fomParserOptions)); assertEquals("00DF", getHexValue("szlig", fomParserOptions)); assertEquals("00E0", getHexValue("agrave", fomParserOptions)); assertEquals("00E1", getHexValue("aacute", fomParserOptions)); assertEquals("00E2", getHexValue("acirc", fomParserOptions)); assertEquals("00E3", getHexValue("atilde", fomParserOptions)); assertEquals("00E4", getHexValue("auml", fomParserOptions)); assertEquals("00E5", getHexValue("aring", fomParserOptions)); assertEquals("00E6", getHexValue("aelig", fomParserOptions)); assertEquals("00E7", getHexValue("ccedil", fomParserOptions)); assertEquals("00E8", getHexValue("egrave", fomParserOptions)); assertEquals("00E9", getHexValue("eacute", fomParserOptions)); assertEquals("00EA", getHexValue("ecirc", fomParserOptions)); assertEquals("00EB", getHexValue("euml", fomParserOptions)); assertEquals("00EC", getHexValue("igrave", fomParserOptions)); assertEquals("00ED", getHexValue("iacute", fomParserOptions)); assertEquals("00EE", getHexValue("icirc", fomParserOptions)); assertEquals("00EF", getHexValue("iuml", fomParserOptions)); assertEquals("00F0", getHexValue("eth", fomParserOptions)); assertEquals("00F1", getHexValue("ntilde", fomParserOptions)); assertEquals("00F2", getHexValue("ograve", fomParserOptions)); assertEquals("00F3", getHexValue("oacute", fomParserOptions)); assertEquals("00F4", getHexValue("ocirc", fomParserOptions)); assertEquals("00F5", getHexValue("otilde", fomParserOptions)); assertEquals("00F6", getHexValue("ouml", fomParserOptions)); assertEquals("00F7", getHexValue("divide", fomParserOptions)); assertEquals("00F8", getHexValue("oslash", fomParserOptions)); assertEquals("00F9", getHexValue("ugrave", fomParserOptions)); assertEquals("00FA", getHexValue("uacute", fomParserOptions)); assertEquals("00FB", getHexValue("ucirc", fomParserOptions)); assertEquals("00FC", getHexValue("uuml", fomParserOptions)); assertEquals("00FD", getHexValue("yacute", fomParserOptions)); assertEquals("00FE", getHexValue("thorn", fomParserOptions)); assertEquals("00FF", getHexValue("yuml", fomParserOptions)); assertEquals("0192", getHexValue("fnof", fomParserOptions)); assertEquals("0391", getHexValue("Alpha", fomParserOptions)); assertEquals("0392", getHexValue("Beta", fomParserOptions)); assertEquals("0393", getHexValue("Gamma", fomParserOptions)); assertEquals("0394", getHexValue("Delta", fomParserOptions)); assertEquals("0395", getHexValue("Epsilon", fomParserOptions)); assertEquals("0396", getHexValue("Zeta", fomParserOptions)); assertEquals("0397", getHexValue("Eta", fomParserOptions)); assertEquals("0398", getHexValue("Theta", fomParserOptions)); assertEquals("0399", getHexValue("Iota", fomParserOptions)); assertEquals("039A", getHexValue("Kappa", fomParserOptions)); assertEquals("039B", getHexValue("Lambda", fomParserOptions)); assertEquals("039C", getHexValue("Mu", fomParserOptions)); assertEquals("039D", getHexValue("Nu", fomParserOptions)); assertEquals("039E", getHexValue("Xi", fomParserOptions)); assertEquals("039F", getHexValue("Omicron", fomParserOptions)); assertEquals("03A0", getHexValue("Pi", fomParserOptions)); assertEquals("03A1", getHexValue("Rho", fomParserOptions)); assertEquals("03A3", getHexValue("Sigma", fomParserOptions)); assertEquals("03A4", getHexValue("Tau", fomParserOptions)); assertEquals("03A5", getHexValue("Upsilon", fomParserOptions)); assertEquals("03A6", getHexValue("Phi", fomParserOptions)); assertEquals("03A7", getHexValue("Chi", fomParserOptions)); assertEquals("03A8", getHexValue("Psi", fomParserOptions)); assertEquals("03A9", getHexValue("Omega", fomParserOptions)); assertEquals("03B1", getHexValue("alpha", fomParserOptions)); assertEquals("03B2", getHexValue("beta", fomParserOptions)); assertEquals("03B3", getHexValue("gamma", fomParserOptions)); assertEquals("03B4", getHexValue("delta", fomParserOptions)); assertEquals("03B5", getHexValue("epsilon", fomParserOptions)); assertEquals("03B6", getHexValue("zeta", fomParserOptions)); assertEquals("03B7", getHexValue("eta", fomParserOptions)); assertEquals("03B8", getHexValue("theta", fomParserOptions)); assertEquals("03B9", getHexValue("iota", fomParserOptions)); assertEquals("03BA", getHexValue("kappa", fomParserOptions)); assertEquals("03BB", getHexValue("lambda", fomParserOptions)); assertEquals("03BC", getHexValue("mu", fomParserOptions)); assertEquals("03BD", getHexValue("nu", fomParserOptions)); assertEquals("03BE", getHexValue("xi", fomParserOptions)); assertEquals("03BF", getHexValue("omicron", fomParserOptions)); assertEquals("03C0", getHexValue("pi", fomParserOptions)); assertEquals("03C1", getHexValue("rho", fomParserOptions)); assertEquals("03C2", getHexValue("sigmaf", fomParserOptions)); assertEquals("03C3", getHexValue("sigma", fomParserOptions)); assertEquals("03C4", getHexValue("tau", fomParserOptions)); assertEquals("03C5", getHexValue("upsilon", fomParserOptions)); assertEquals("03C6", getHexValue("phi", fomParserOptions)); assertEquals("03C7", getHexValue("chi", fomParserOptions)); assertEquals("03C8", getHexValue("psi", fomParserOptions)); assertEquals("03C9", getHexValue("omega", fomParserOptions)); assertEquals("03D1", getHexValue("thetasym", fomParserOptions)); assertEquals("03D2", getHexValue("upsih", fomParserOptions)); assertEquals("03D6", getHexValue("piv", fomParserOptions)); assertEquals("2022", getHexValue("bull", fomParserOptions)); assertEquals("2026", getHexValue("hellip", fomParserOptions)); assertEquals("2032", getHexValue("prime", fomParserOptions)); assertEquals("2033", getHexValue("Prime", fomParserOptions)); assertEquals("203E", getHexValue("oline", fomParserOptions)); assertEquals("2044", getHexValue("frasl", fomParserOptions)); assertEquals("2118", getHexValue("weierp", fomParserOptions)); assertEquals("2111", getHexValue("image", fomParserOptions)); assertEquals("211C", getHexValue("real", fomParserOptions)); assertEquals("2122", getHexValue("trade", fomParserOptions)); assertEquals("2135", getHexValue("alefsym", fomParserOptions)); assertEquals("2190", getHexValue("larr", fomParserOptions)); assertEquals("2191", getHexValue("uarr", fomParserOptions)); assertEquals("2192", getHexValue("rarr", fomParserOptions)); assertEquals("2193", getHexValue("darr", fomParserOptions)); assertEquals("2194", getHexValue("harr", fomParserOptions)); assertEquals("21B5", getHexValue("crarr", fomParserOptions)); assertEquals("21D0", getHexValue("lArr", fomParserOptions)); assertEquals("21D1", getHexValue("uArr", fomParserOptions)); assertEquals("21D2", getHexValue("rArr", fomParserOptions)); assertEquals("21D3", getHexValue("dArr", fomParserOptions)); assertEquals("21D4", getHexValue("hArr", fomParserOptions)); assertEquals("2200", getHexValue("forall", fomParserOptions)); assertEquals("2202", getHexValue("part", fomParserOptions)); assertEquals("2203", getHexValue("exist", fomParserOptions)); assertEquals("2205", getHexValue("empty", fomParserOptions)); assertEquals("2207", getHexValue("nabla", fomParserOptions)); assertEquals("2208", getHexValue("isin", fomParserOptions)); assertEquals("2209", getHexValue("notin", fomParserOptions)); assertEquals("220B", getHexValue("ni", fomParserOptions)); assertEquals("220F", getHexValue("prod", fomParserOptions)); assertEquals("2211", getHexValue("sum", fomParserOptions)); assertEquals("2212", getHexValue("minus", fomParserOptions)); assertEquals("2217", getHexValue("lowast", fomParserOptions)); assertEquals("221A", getHexValue("radic", fomParserOptions)); assertEquals("221D", getHexValue("prop", fomParserOptions)); assertEquals("221E", getHexValue("infin", fomParserOptions)); assertEquals("2220", getHexValue("ang", fomParserOptions)); assertEquals("2227", getHexValue("and", fomParserOptions)); assertEquals("2228", getHexValue("or", fomParserOptions)); assertEquals("2229", getHexValue("cap", fomParserOptions)); assertEquals("222A", getHexValue("cup", fomParserOptions)); assertEquals("222B", getHexValue("int", fomParserOptions)); assertEquals("2234", getHexValue("there4", fomParserOptions)); assertEquals("223C", getHexValue("sim", fomParserOptions)); assertEquals("2245", getHexValue("cong", fomParserOptions)); assertEquals("2248", getHexValue("asymp", fomParserOptions)); assertEquals("2260", getHexValue("ne", fomParserOptions)); assertEquals("2261", getHexValue("equiv", fomParserOptions)); assertEquals("2264", getHexValue("le", fomParserOptions)); assertEquals("2265", getHexValue("ge", fomParserOptions)); assertEquals("2282", getHexValue("sub", fomParserOptions)); assertEquals("2283", getHexValue("sup", fomParserOptions)); assertEquals("2284", getHexValue("nsub", fomParserOptions)); assertEquals("2286", getHexValue("sube", fomParserOptions)); assertEquals("2287", getHexValue("supe", fomParserOptions)); assertEquals("2295", getHexValue("oplus", fomParserOptions)); assertEquals("2297", getHexValue("otimes", fomParserOptions)); assertEquals("22A5", getHexValue("perp", fomParserOptions)); assertEquals("22C5", getHexValue("sdot", fomParserOptions)); assertEquals("2308", getHexValue("lceil", fomParserOptions)); assertEquals("2309", getHexValue("rceil", fomParserOptions)); assertEquals("230A", getHexValue("lfloor", fomParserOptions)); assertEquals("230B", getHexValue("rfloor", fomParserOptions)); assertEquals("2329", getHexValue("lang", fomParserOptions)); assertEquals("232A", getHexValue("rang", fomParserOptions)); assertEquals("25CA", getHexValue("loz", fomParserOptions)); assertEquals("2660", getHexValue("spades", fomParserOptions)); assertEquals("2663", getHexValue("clubs", fomParserOptions)); assertEquals("2665", getHexValue("hearts", fomParserOptions)); assertEquals("2666", getHexValue("diams", fomParserOptions)); assertEquals("0022", getHexValue("quot", fomParserOptions)); assertEquals("0026", getHexValue("amp", fomParserOptions)); assertEquals("003C", getHexValue("lt", fomParserOptions)); assertEquals("003E", getHexValue("gt", fomParserOptions)); assertEquals("0152", getHexValue("OElig", fomParserOptions)); assertEquals("0153", getHexValue("oelig", fomParserOptions)); assertEquals("0160", getHexValue("Scaron", fomParserOptions)); assertEquals("0161", getHexValue("scaron", fomParserOptions)); assertEquals("0178", getHexValue("Yuml", fomParserOptions)); assertEquals("02C6", getHexValue("circ", fomParserOptions)); assertEquals("02DC", getHexValue("tilde", fomParserOptions)); assertEquals("2002", getHexValue("ensp", fomParserOptions)); assertEquals("2003", getHexValue("emsp", fomParserOptions)); assertEquals("2009", getHexValue("thinsp", fomParserOptions)); assertEquals("200C", getHexValue("zwnj", fomParserOptions)); assertEquals("200D", getHexValue("zwj", fomParserOptions)); assertEquals("200E", getHexValue("lrm", fomParserOptions)); assertEquals("200F", getHexValue("rlm", fomParserOptions)); assertEquals("2013", getHexValue("ndash", fomParserOptions)); assertEquals("2014", getHexValue("mdash", fomParserOptions)); assertEquals("2018", getHexValue("lsquo", fomParserOptions)); assertEquals("2019", getHexValue("rsquo", fomParserOptions)); assertEquals("201A", getHexValue("sbquo", fomParserOptions)); assertEquals("201C", getHexValue("ldquo", fomParserOptions)); assertEquals("201D", getHexValue("rdquo", fomParserOptions)); assertEquals("201E", getHexValue("bdquo", fomParserOptions)); assertEquals("2020", getHexValue("dagger", fomParserOptions)); assertEquals("2021", getHexValue("Dagger", fomParserOptions)); assertEquals("2030", getHexValue("permil", fomParserOptions)); assertEquals("20AC", getHexValue("euro", fomParserOptions)); } private String getHexValue(String entity, AbstractParserOptions fomParserOptions) { String hexValue = fomParserOptions.resolveEntity(entity); char hexChar = hexValue.charAt(0); StringBuilder result = new StringBuilder(Integer.toHexString(hexChar)); if (result.length() == 2) { result.insert(0, "00"); } else if (result.length() == 3) { result.insert(0, "0"); } return result.toString().toUpperCase(); } }
7,135
0
Create_ds/abdera/core/src/test/java/org/apache/abdera
Create_ds/abdera/core/src/test/java/org/apache/abdera/util/EntityTagTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.apache.abdera.util.EntityTag; import org.junit.Test; public class EntityTagTest { @Test public void testEntityTag() throws Exception { String[] tags = {"hello", "\"hello\"", "W/\"hello\"", "*"}; EntityTag[] etags = new EntityTag[tags.length]; for (int n = 0; n < tags.length; n++) { etags[n] = new EntityTag(tags[n]); } assertFalse(etags[0].isWeak()); assertFalse(etags[0].isWild()); assertFalse(etags[1].isWeak()); assertFalse(etags[1].isWild()); assertTrue(etags[2].isWeak()); assertFalse(etags[2].isWild()); assertFalse(etags[3].isWeak()); assertTrue(etags[3].isWild()); assertEquals("hello", etags[0].getTag()); assertEquals("hello", etags[1].getTag()); assertEquals("hello", etags[2].getTag()); assertEquals("*", etags[3].getTag()); assertEquals(tags[1], etags[0].toString()); assertEquals(tags[1], etags[1].toString()); assertEquals(tags[2], etags[2].toString()); assertEquals(tags[3], etags[3].toString()); assertTrue(EntityTag.matches(etags[3], etags[0])); assertTrue(EntityTag.matches(etags[3], etags[1])); assertTrue(EntityTag.matches(etags[3], etags[2])); assertTrue(EntityTag.matches(etags[3], etags[3])); assertTrue(EntityTag.matches(etags[0], etags[1])); assertFalse(EntityTag.matches(etags[0], etags[2])); assertTrue(EntityTag.matchesAny(etags[3], new EntityTag[] {etags[0], etags[1], etags[2]})); assertTrue(EntityTag.matchesAny(etags[0], new EntityTag[] {etags[3], etags[1], etags[2]})); assertTrue(EntityTag.matchesAny(etags[1], new EntityTag[] {etags[0], etags[3], etags[2]})); assertTrue(EntityTag.matchesAny(etags[2], new EntityTag[] {etags[0], etags[1], etags[3]})); java.util.Arrays.sort(etags); assertEquals(tags[3], etags[0].toString()); assertEquals(tags[1], etags[1].toString()); assertEquals(tags[1], etags[2].toString()); assertEquals(tags[2], etags[3].toString()); EntityTag etag = EntityTag.generate("a", "b", "c", "d"); assertEquals("\"e2fc714c4727ee9395f324cd2e7f331f\"", etag.toString()); } }
7,136
0
Create_ds/abdera/core/src/test/java/org/apache/abdera/util
Create_ds/abdera/core/src/test/java/org/apache/abdera/util/filter/AbstractListParseFilterTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import javax.xml.namespace.QName; import org.junit.Test; public class AbstractListParseFilterTest { private static final class SerializedImpl extends AbstractListParseFilter { private static final long serialVersionUID = -1695184231548373283L; @Override public boolean acceptable(QName qname, QName attribute) { return true; } @Override public boolean acceptable(QName qname) { return true; } } @Test public void testSerialization() throws Exception { SerializedImpl si = new SerializedImpl(); si.add(new QName("lp0")); si.add(new QName("parentLp0"), new QName("lp1")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(si); oos.flush(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); si = (SerializedImpl)ois.readObject(); assertTrue(si.contains(new QName("lp0"))); assertTrue(si.contains(new QName("parentLp0"), new QName("lp1"))); } }
7,137
0
Create_ds/abdera/core/src/test/java/org/apache/abdera
Create_ds/abdera/core/src/test/java/org/apache/abdera/model/AtomDateTest.java
package org.apache.abdera.model; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import java.util.Calendar; import java.util.Date; import org.junit.Test; public class AtomDateTest { @Test public void testHashCode() { long time = System.currentTimeMillis(); AtomDate ad1 = new AtomDate(time); assertTrue(ad1.hashCode() == ad1.hashCode()); AtomDate ad2 = new AtomDate(time + 10); assertFalse(ad1.hashCode() == ad2.hashCode()); } @Test public void testAtomDateDate() { Date now = new Date(); AtomDate adNow = new AtomDate(now); assertEquals(now, adNow.getDate()); // mutate 'now', to assert AtomDate cloned value now.setTime(now.getTime() + 10); assertFalse(now.getTime() == adNow.getTime()); } @Test public void testGetDate() { Date now = new Date(); AtomDate adNow = new AtomDate(now); assertEquals(now, adNow.getDate()); // getDate, then mutate to assert it was cloned Date now2 = adNow.getDate(); now2.setTime(now2.getTime() + 10); assertFalse(now2.equals(adNow.getDate())); } @Test public void testSetValueDate() { Date now = new Date(); AtomDate adNow = new AtomDate(now); assertEquals(now, adNow.getDate()); // set time, then mutate 'now' to assert cloning now.setTime(now.getTime() + 10); adNow.setValue(now); now.setTime(now.getTime() + 10); assertFalse(now.equals(adNow.getDate())); } @Test public void testClone() { AtomDate ad = new AtomDate(); AtomDate adClone = (AtomDate)ad.clone(); assertEquals(ad, adClone); assertNotSame(ad, adClone); } @Test public void testAtomDate() { Date now = new Date(); AtomDate atomNow = AtomDate.valueOf(now); String rfc3339 = atomNow.getValue(); atomNow = AtomDate.valueOf(rfc3339); Date parsed = atomNow.getDate(); assertEquals(now, parsed); } @Test public void testAtomDate2() { String date = "2007-12-13T14:15:16.123Z"; AtomDate atomDate = new AtomDate(date); Calendar calendar = atomDate.getCalendar(); atomDate = new AtomDate(calendar); assertEquals(date, atomDate.toString()); } @Test public void testAtomDate3() { long date = System.currentTimeMillis(); AtomDate atomDate = new AtomDate(date); Calendar calendar = atomDate.getCalendar(); atomDate = new AtomDate(calendar); assertEquals(date, atomDate.getTime()); } @Test(expected = IllegalArgumentException.class) public void testIllegalDateFormat() { String date = ""; AtomDate atomDate = new AtomDate(date); } }
7,138
0
Create_ds/abdera/core/src/main/java/org/apache
Create_ds/abdera/core/src/main/java/org/apache/abdera/Abdera.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera; import org.apache.abdera.factory.Factory; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.model.Categories; import org.apache.abdera.model.Entry; import org.apache.abdera.model.Feed; import org.apache.abdera.model.Service; import org.apache.abdera.parser.Parser; import org.apache.abdera.parser.ParserFactory; import org.apache.abdera.util.AbderaConfiguration; import org.apache.abdera.util.Configuration; import org.apache.abdera.writer.StreamWriter; import org.apache.abdera.writer.Writer; import org.apache.abdera.writer.WriterFactory; import org.apache.abdera.xpath.XPath; /** * The top level entry point for Abdera that provides access to various subcomponents. Upon creation, this class will * attempt to create singleton instances of each of the various subcomponents components. These instances may be * retrieved using the appropriate get___ methods. Alternatively, new instances may be created using the appropriate * new___ methods. Instances of the Abdera object, and it's direct children (Parser, Factory, XPath, etc) are * Threadsafe. Because of the dynamic configuration model Abdera uses, creating a new instance of the Abdera object can * be time consuming. It is, therefore, a good idea for applications to create only a single static instance of the * Abdera object (see the Abdera.getInstance() method). Abdera's configuration model depends heavily on the context * classloader. Extension Factories, custom writers, custom parsers, etc are all discovered automatically by searching * the classpath. This means that care needs to be taken when using Abdera in environments that utilize multiple * classloaders (such as Web application servers). */ public class Abdera { /** A static instance of Abdera **/ private static Abdera instance; /** * Get a static instance of the Abdera object. */ public static synchronized Abdera getInstance() { if (instance == null) instance = new Abdera(); return instance; } private final Configuration config; private Factory factory; private Parser parser; private XPath xpath; private ParserFactory parserFactory; private WriterFactory writerFactory; private Writer writer; /** * Initialize using the default Abdera Configuration */ public Abdera() { this(AbderaConfiguration.getDefault()); } /** * Initialize using the specified Abdera Configuration * * @param config The Abdera Configuration to use */ public Abdera(Configuration config) { this.config = config; IRI.preinit(); // initializes the IRI stuff to improve performance later } /** * Create a new Feed instance. This is a convenience shortcut for <code>abdera.getFactory().newFeed()</code> * * @return A newly created feed element */ public Feed newFeed() { return getFactory().newFeed(); } /** * Create a new Entry instance. This is a convenience shortcut for <code>abdera.getFactory().newEntry()</code> * * @return A newly created entry element */ public Entry newEntry() { return getFactory().newEntry(); } /** * Create a new Service instance. This is a convenience shortcut for <code>abdera.getFactory().newService()</code> * * @return A newly created service element */ public Service newService() { return getFactory().newService(); } /** * Create a new Categories instance. This is a convenience shortcut for * <code>abdera.getFactory().newCategories()</code> * * @return A newly created categories element */ public Categories newCategories() { return getFactory().newCategories(); } /** * Return the Abdera Configuration used to initialize this instance * * @return The Abdera configuration */ public Configuration getConfiguration() { return config; } /** * Return the singleton instance of org.apache.abdera.factory.Factory * * @return The factory instance */ public synchronized Factory getFactory() { if (factory == null) factory = newFactory(); return factory; } /** * Return the singleton instance of org.apache.abdera.parser.Parser * * @return The parser instance */ public synchronized Parser getParser() { if (parser == null) parser = newParser(); return parser; } /** * Return the singleton instance of org.apache.abdera.xpath.XPath * * @return The XPath instance */ public synchronized XPath getXPath() { if (xpath == null) xpath = newXPath(); return xpath; } /** * Return the singleton instance of org.apache.abdera.parser.ParserFactory. The Parser Factory is used to acquire * alternative parser implementation instances. * * @return The ParserFactory instance */ public synchronized ParserFactory getParserFactory() { if (parserFactory == null) parserFactory = newParserFactory(); return parserFactory; } /** * Return the singleton instance of org.apache.abdera.writer.WriterFactory. The Writer Factory is used to acquire * alternative writer implementation instances. * * @return The WriterFactory instance */ public synchronized WriterFactory getWriterFactory() { if (writerFactory == null) writerFactory = newWriterFactory(); return writerFactory; } /** * Return the singleton instance of the default org.apache.abdera.writer.Writer implementation. * * @return The default writer implementation */ public synchronized Writer getWriter() { if (writer == null) writer = newWriter(); return writer; } /** * Return a new instance of org.apache.abdera.factory.Factory * * @return A new factory instance */ private Factory newFactory() { return config.newFactoryInstance(this); } /** * Return a new instance of org.apache.abdera.parser.Parser * * @return A new parser instance */ private Parser newParser() { return config.newParserInstance(this); } /** * Return a new instance of org.apache.abdera.xpath.XPath * * @return A new XPath instance */ private XPath newXPath() { return config.newXPathInstance(this); } /** * Return a new instance of org.apache.abdera.parser.ParserFactory * * @return A new ParserFactory instance */ private ParserFactory newParserFactory() { return config.newParserFactoryInstance(this); } /** * Return a new instance of org.apache.abdera.writer.WriterFactory * * @return A new WriterFactory instance */ private WriterFactory newWriterFactory() { return config.newWriterFactoryInstance(this); } /** * Return a new instance of the default org.apache.abdera.writer.Writer * * @return A new default writer implementation instance */ private Writer newWriter() { return config.newWriterInstance(this); } /** * Return a new instance of the default org.apache.abdera.writer.Writer * * @return A new default writer implementation instance */ public StreamWriter newStreamWriter() { return config.newStreamWriterInstance(this); } // Static convenience methods // /** * Return a new Factory instance using a non-shared Abdera object * * @return A new factory instance */ public static Factory getNewFactory() { return (new Abdera()).newFactory(); } /** * Return a new Parser instance using a non-shared Abdera object * * @return A new parser instance */ public static Parser getNewParser() { return (new Abdera()).newParser(); } /** * Return a new XPath instance using a non-shared Abdera object * * @return A new XPath instance */ public static XPath getNewXPath() { return (new Abdera()).newXPath(); } /** * Return a new ParserFactory instance using a non-shared Abdera object * * @return A new ParserFactory instance */ public static ParserFactory getNewParserFactory() { return (new Abdera()).newParserFactory(); } /** * Return a new WriterFactory instance using a non-shared Abdera object * * @return A new WriterFactory instance */ public static WriterFactory getNewWriterFactory() { return (new Abdera()).newWriterFactory(); } /** * Return a new instance of the default Writer using a non-shared Abdera object * * @return A new default writer implementation instance */ public static Writer getNewWriter() { return (new Abdera()).newWriter(); } /** * Return a new instance of the default StreamWriter using a non-shared Abdera object * * @return A new default stream writer implementation instance */ public static StreamWriter getNewStreamWriter() { return (new Abdera()).newStreamWriter(); } }
7,139
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/xpath/XPath.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.xpath; import java.util.List; import java.util.Map; import org.apache.abdera.model.Base; /** * Used to execute XPath queries over Feed Object Model instances. */ @SuppressWarnings("unchecked") public interface XPath { /** * Return the default mapping of Prefixes to XML Namespaces */ Map<String, String> getDefaultNamespaces(); /** * Return a listing of nodes matching the specified Path */ List selectNodes(String path, Base base) throws XPathException; /** * Return the first node matching the specified Path */ Object selectSingleNode(String path, Base base) throws XPathException; /** * Evaluate the specified XPath and return it's value */ Object evaluate(String path, Base base) throws XPathException; /** * Return the text value of the specified Path */ String valueOf(String path, Base base) throws XPathException; /** * Return a boolean representation of the specified Path */ boolean booleanValueOf(String path, Base base) throws XPathException; /** * Return a numeric representation of the specified Path */ Number numericValueOf(String path, Base base) throws XPathException; /** * Return a listing of nodes matching the specified Path using the specified Namespaces mapping */ List selectNodes(String path, Base base, Map<String, String> namespaces) throws XPathException; /** * Return a the first node matching the specified Path using the specified Namespaces mapping */ Object selectSingleNode(String path, Base base, Map<String, String> namespaces) throws XPathException; /** * Evaluate the specified XPath and return it's value using the specified Namespaces mapping */ Object evaluate(String path, Base base, Map<String, String> namespaces) throws XPathException; /** * Return the text value of the specified Path using the specified Namespaces mapping */ String valueOf(String path, Base base, Map<String, String> namespaces) throws XPathException; /** * Return a boolean representation of the specified Path using the specified Namespaces mapping */ boolean booleanValueOf(String path, Base base, Map<String, String> namespaces) throws XPathException; /** * Return a numeric representation of the specified Path using the specified Namespaces mapping */ Number numericValueOf(String path, Base base, Map<String, String> namespaces) throws XPathException; }
7,140
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/xpath/XPathException.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.xpath; public class XPathException extends RuntimeException { private static final long serialVersionUID = 7373747391262088925L; public XPathException() { super(); } public XPathException(String message, Throwable cause) { super(message, cause); } public XPathException(String message) { super(message); } public XPathException(Throwable cause) { super(cause); } }
7,141
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.apache.abdera.factory.Factory; import org.apache.abdera.filter.ParseFilter; import org.apache.abdera.i18n.text.io.CompressionUtil.CompressionCodec; import org.apache.abdera.parser.ParserOptions; /** * Non thread-safe abstract implementation of ParserOptions */ public abstract class AbstractParserOptions implements ParserOptions, Cloneable { protected Factory factory = null; protected String charset = null; protected ParseFilter parseFilter = null; protected boolean detect = false; protected boolean preserve = true; protected boolean filterreserved = false; protected char replacement = 0; protected CompressionCodec[] codecs = null; protected boolean resolveentities = true; protected Map<String, String> entities = new HashMap<String, String>(); protected boolean qnamealiasing = false; protected Map<QName, QName> aliases = null; protected abstract void initFactory(); protected abstract void checkFactory(Factory factory); protected AbstractParserOptions() { initDefaultEntities(); } public Object clone() throws CloneNotSupportedException { AbstractParserOptions copy = (AbstractParserOptions)super.clone(); // Object's clone implementation takes care of the rest, we just need // deep copies of the two filters, in case they're carrying around some // state with them. if (parseFilter != null) copy.parseFilter = (ParseFilter)parseFilter.clone(); return copy; } public Factory getFactory() { if (factory == null) initFactory(); return factory; } public ParserOptions setFactory(Factory factory) { checkFactory(factory); this.factory = factory; return this; } public String getCharset() { return charset; } public ParserOptions setCharset(String charset) { this.charset = charset; return this; } public ParseFilter getParseFilter() { return parseFilter; } public ParserOptions setParseFilter(ParseFilter parseFilter) { this.parseFilter = parseFilter; return this; } public boolean getAutodetectCharset() { return this.detect; } public ParserOptions setAutodetectCharset(boolean detect) { this.detect = detect; return this; } public boolean getMustPreserveWhitespace() { return preserve; } public ParserOptions setMustPreserveWhitespace(boolean preserve) { this.preserve = preserve; return this; } public boolean getFilterRestrictedCharacters() { return filterreserved; } public ParserOptions setFilterRestrictedCharacters(boolean filter) { this.filterreserved = filter; return this; } public char getFilterRestrictedCharacterReplacement() { return replacement; } public ParserOptions setFilterRestrictedCharacterReplacement(char replacement) { this.replacement = replacement; return this; } public CompressionCodec[] getCompressionCodecs() { return codecs; } public ParserOptions setCompressionCodecs(CompressionCodec... codecs) { this.codecs = codecs; return this; } public ParserOptions registerEntity(String name, String value) { entities.put(name, value); return this; } private void initDefaultEntities() { registerEntity("quot", "\""); registerEntity("amp", "\u0026"); registerEntity("lt", "\u003C"); registerEntity("gt", "\u003E"); registerEntity("nbsp", " "); registerEntity("iexcl", "\u00A1"); registerEntity("cent", "\u00A2"); registerEntity("pound", "\u00A3"); registerEntity("curren", "\u00A4"); registerEntity("yen", "\u00A5"); registerEntity("brvbar", "\u00A6"); registerEntity("sect", "\u00A7"); registerEntity("uml", "\u00A8"); registerEntity("copy", "\u00A9"); registerEntity("ordf", "\u00AA"); registerEntity("laquo", "\u00AB"); registerEntity("not", "\u00AC"); registerEntity("shy", "\u00AD"); registerEntity("reg", "\u00AE"); registerEntity("macr", "\u00AF"); registerEntity("deg", "\u00B0"); registerEntity("plusmn", "\u00B1"); registerEntity("sup2", "\u00B2"); registerEntity("sup3", "\u00B3"); registerEntity("acute", "\u00B4"); registerEntity("micro", "\u00B5"); registerEntity("para", "\u00B6"); registerEntity("middot", "\u00B7"); registerEntity("cedil", "\u00B8"); registerEntity("sup1", "\u00B9"); registerEntity("ordm", "\u00BA"); registerEntity("raquo", "\u00BB"); registerEntity("frac14", "\u00BC"); registerEntity("frac12", "\u00BD"); registerEntity("frac34", "\u00BE"); registerEntity("iquest", "\u00BF"); registerEntity("Agrave", "\u00C0"); registerEntity("Aacute", "\u00C1"); registerEntity("Acirc", "\u00C2"); registerEntity("Atilde", "\u00C3"); registerEntity("Auml", "\u00C4"); registerEntity("Aring", "\u00C5"); registerEntity("AElig", "\u00C6"); registerEntity("Ccedil", "\u00C7"); registerEntity("Egrave", "\u00C8"); registerEntity("Eacute", "\u00C9"); registerEntity("Ecirc", "\u00CA"); registerEntity("Euml", "\u00CB"); registerEntity("Igrave", "\u00CC"); registerEntity("Iacute", "\u00CD"); registerEntity("Icirc", "\u00CE"); registerEntity("Iuml", "\u00CF"); registerEntity("ETH", "\u00D0"); registerEntity("Ntilde", "\u00D1"); registerEntity("Ograve", "\u00D2"); registerEntity("Oacute", "\u00D3"); registerEntity("Ocirc", "\u00D4"); registerEntity("Otilde", "\u00D5"); registerEntity("Ouml", "\u00D6"); registerEntity("times", "\u00D7"); registerEntity("Oslash", "\u00D8"); registerEntity("Ugrave", "\u00D9"); registerEntity("Uacute", "\u00DA"); registerEntity("Ucirc", "\u00DB"); registerEntity("Uuml", "\u00DC"); registerEntity("Yacute", "\u00DD"); registerEntity("THORN", "\u00DE"); registerEntity("szlig", "\u00DF"); registerEntity("agrave", "\u00E0"); registerEntity("aacute", "\u00E1"); registerEntity("acirc", "\u00E2"); registerEntity("atilde", "\u00E3"); registerEntity("auml", "\u00E4"); registerEntity("aring", "\u00E5"); registerEntity("aelig", "\u00E6"); registerEntity("ccedil", "\u00E7"); registerEntity("egrave", "\u00E8"); registerEntity("eacute", "\u00E9"); registerEntity("ecirc", "\u00EA"); registerEntity("euml", "\u00EB"); registerEntity("igrave", "\u00EC"); registerEntity("iacute", "\u00ED"); registerEntity("icirc", "\u00EE"); registerEntity("iuml", "\u00EF"); registerEntity("eth", "\u00F0"); registerEntity("ntilde", "\u00F1"); registerEntity("ograve", "\u00F2"); registerEntity("oacute", "\u00F3"); registerEntity("ocirc", "\u00F4"); registerEntity("otilde", "\u00F5"); registerEntity("ouml", "\u00F6"); registerEntity("divide", "\u00F7"); registerEntity("oslash", "\u00F8"); registerEntity("ugrave", "\u00F9"); registerEntity("uacute", "\u00FA"); registerEntity("ucirc", "\u00FB"); registerEntity("uuml", "\u00FC"); registerEntity("yacute", "\u00FD"); registerEntity("thorn", "\u00FE"); registerEntity("yuml", "\u00FF"); registerEntity("OElig", "\u0152"); registerEntity("oelig", "\u0153"); registerEntity("Scaron", "\u0160"); registerEntity("scaron", "\u0161"); registerEntity("Yuml", "\u0178"); registerEntity("fnof", "\u0192"); registerEntity("circ", "\u02C6"); registerEntity("tilde", "\u02DC"); registerEntity("Alpha", "\u0391"); registerEntity("Beta", "\u0392"); registerEntity("Gamma", "\u0393"); registerEntity("Delta", "\u0394"); registerEntity("Epsilon", "\u0395"); registerEntity("Zeta", "\u0396"); registerEntity("Eta", "\u0397"); registerEntity("Theta", "\u0398"); registerEntity("Iota", "\u0399"); registerEntity("Kappa", "\u039A"); registerEntity("Lambda", "\u039B"); registerEntity("Mu", "\u039C"); registerEntity("Nu", "\u039D"); registerEntity("Xi", "\u039E"); registerEntity("Omicron", "\u039F"); registerEntity("Pi", "\u03A0"); registerEntity("Rho", "\u03A1"); registerEntity("Sigma", "\u03A3"); registerEntity("Tau", "\u03A4"); registerEntity("Upsilon", "\u03A5"); registerEntity("Phi", "\u03A6"); registerEntity("Chi", "\u03A7"); registerEntity("Psi", "\u03A8"); registerEntity("Omega", "\u03A9"); registerEntity("alpha", "\u03B1"); registerEntity("beta", "\u03B2"); registerEntity("gamma", "\u03B3"); registerEntity("delta", "\u03B4"); registerEntity("epsilon", "\u03B5"); registerEntity("zeta", "\u03B6"); registerEntity("eta", "\u03B7"); registerEntity("theta", "\u03B8"); registerEntity("iota", "\u03B9"); registerEntity("kappa", "\u03BA"); registerEntity("lambda", "\u03BB"); registerEntity("mu", "\u03BC"); registerEntity("nu", "\u03BD"); registerEntity("xi", "\u03BE"); registerEntity("omicron", "\u03BF"); registerEntity("pi", "\u03C0"); registerEntity("rho", "\u03C1"); registerEntity("sigmaf", "\u03C2"); registerEntity("sigma", "\u03C3"); registerEntity("tau", "\u03C4"); registerEntity("upsilon", "\u03C5"); registerEntity("phi", "\u03C6"); registerEntity("chi", "\u03C7"); registerEntity("psi", "\u03C8"); registerEntity("omega", "\u03C9"); registerEntity("thetasym", "\u03D1"); registerEntity("upsih", "\u03D2"); registerEntity("piv", "\u03D6"); registerEntity("ensp", "\u2002"); registerEntity("emsp", "\u2003"); registerEntity("thinsp", "\u2009"); registerEntity("zwnj", "\u200C"); registerEntity("zwj", "\u200D"); registerEntity("lrm", "\u200E"); registerEntity("rlm", "\u200F"); registerEntity("ndash", "\u2013"); registerEntity("mdash", "\u2014"); registerEntity("lsquo", "\u2018"); registerEntity("rsquo", "\u2019"); registerEntity("sbquo", "\u201A"); registerEntity("ldquo", "\u201C"); registerEntity("rdquo", "\u201D"); registerEntity("bdquo", "\u201E"); registerEntity("dagger", "\u2020"); registerEntity("Dagger", "\u2021"); registerEntity("bull", "\u2022"); registerEntity("hellip", "\u2026"); registerEntity("permil", "\u2030"); registerEntity("prime", "\u2032"); registerEntity("Prime", "\u2033"); registerEntity("lsaquo", "\u2039"); registerEntity("rsaquo", "\u203A"); registerEntity("oline", "\u203E"); registerEntity("frasl", "\u2044"); registerEntity("euro", "\u20AC"); registerEntity("image", "\u2111"); registerEntity("weierp", "\u2118"); registerEntity("real", "\u211C"); registerEntity("trade", "\u2122"); registerEntity("alefsym", "\u2135"); registerEntity("larr", "\u2190"); registerEntity("uarr", "\u2191"); registerEntity("rarr", "\u2192"); registerEntity("darr", "\u2193"); registerEntity("harr", "\u2194"); registerEntity("crarr", "\u21B5"); registerEntity("lArr", "\u21D0"); registerEntity("uArr", "\u21D1"); registerEntity("rArr", "\u21D2"); registerEntity("dArr", "\u21D3"); registerEntity("hArr", "\u21D4"); registerEntity("forall", "\u2200"); registerEntity("part", "\u2202"); registerEntity("exist", "\u2203"); registerEntity("empty", "\u2205"); registerEntity("nabla", "\u2207"); registerEntity("isin", "\u2208"); registerEntity("notin", "\u2209"); registerEntity("ni", "\u220B"); registerEntity("prod", "\u220F"); registerEntity("sum", "\u2211"); registerEntity("minus", "\u2212"); registerEntity("lowast", "\u2217"); registerEntity("radic", "\u221A"); registerEntity("prop", "\u221D"); registerEntity("infin", "\u221E"); registerEntity("ang", "\u2220"); registerEntity("and", "\u2227"); registerEntity("or", "\u2228"); registerEntity("cap", "\u2229"); registerEntity("cup", "\u222A"); registerEntity("int", "\u222B"); registerEntity("there4", "\u2234"); registerEntity("sim", "\u223C"); registerEntity("cong", "\u2245"); registerEntity("asymp", "\u2248"); registerEntity("ne", "\u2260"); registerEntity("equiv", "\u2261"); registerEntity("le", "\u2264"); registerEntity("ge", "\u2265"); registerEntity("sub", "\u2282"); registerEntity("sup", "\u2283"); registerEntity("nsub", "\u2284"); registerEntity("sube", "\u2286"); registerEntity("supe", "\u2287"); registerEntity("oplus", "\u2295"); registerEntity("otimes", "\u2297"); registerEntity("perp", "\u22A5"); registerEntity("sdot", "\u22C5"); registerEntity("lceil", "\u2308"); registerEntity("rceil", "\u2309"); registerEntity("lfloor", "\u230A"); registerEntity("rfloor", "\u230B"); registerEntity("lang", "\u2329"); registerEntity("rang", "\u232A"); registerEntity("loz", "\u25CA"); registerEntity("spades", "\u2660"); registerEntity("clubs", "\u2663"); registerEntity("hearts", "\u2665"); registerEntity("diams", "\u2666"); } public String resolveEntity(String name) { return resolveentities ? entities.get(name) : null; } public ParserOptions setResolveEntities(boolean resolve) { this.resolveentities = resolve; return this; } public boolean getResolveEntities() { return this.resolveentities; } public Map<QName, QName> getQNameAliasMap() { return aliases; } public ParserOptions setQNameAliasMap(Map<QName, QName> map) { this.aliases = map; return this; } public boolean isQNameAliasMappingEnabled() { return qnamealiasing; } public ParserOptions setQNameAliasMappingEnabled(boolean enabled) { this.qnamealiasing = enabled; return this; } }
7,142
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/NamedItem.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; public interface NamedItem { String getName(); }
7,143
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbderaDataSource.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataSource; import org.apache.abdera.model.Base; /** * Utility implementation of javax.activation.DataSource that wraps Abdera Base */ public final class AbderaDataSource implements DataSource { private final byte[] data; private final String mimetype; private final String name; public AbderaDataSource(Base base) { this.data = read(base); this.mimetype = MimeTypeHelper.getMimeType(base); this.name = base.getClass().getName(); } private byte[] read(Base base) { byte[] data = null; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); base.writeTo(out); data = out.toByteArray(); } catch (IOException e) { } return data; } public String getContentType() { return mimetype; } public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(data); } public String getName() { return "Abdera Data Source::" + name; } public OutputStream getOutputStream() throws IOException { throw new UnsupportedOperationException(); } }
7,144
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbderaConfiguration.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; import org.apache.abdera.Abdera; import org.apache.abdera.factory.ExtensionFactory; import org.apache.abdera.factory.Factory; import org.apache.abdera.factory.StreamBuilder; import org.apache.abdera.i18n.text.Localizer; import org.apache.abdera.parser.NamedParser; import org.apache.abdera.parser.Parser; import org.apache.abdera.parser.ParserFactory; import org.apache.abdera.writer.NamedWriter; import org.apache.abdera.writer.StreamWriter; import org.apache.abdera.writer.Writer; import org.apache.abdera.writer.WriterFactory; import org.apache.abdera.xpath.XPath; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Provides the basic configuration for the Abdera default implementation. This class should not be accessed by * applications directly without very good reason. */ public final class AbderaConfiguration implements Constants, Configuration { private static final long serialVersionUID = 7460203853824337559L; private final static Log log = LogFactory.getLog(AbderaConfiguration.class); /** * Returns the default configuration. Every call to this method returns a new AbderaConfiguration instance using * abdera.properties */ public static synchronized Configuration getDefault() { Configuration instance = null; try { ResourceBundle bundle = ResourceBundle.getBundle("abdera"); instance = new AbderaConfiguration(bundle); } catch (Exception e) { instance = new AbderaConfiguration(); } return instance; } private static ResourceBundle getBundle(Locale locale) { ResourceBundle bundle = null; try { bundle = ResourceBundle.getBundle("abdera", locale, Thread.currentThread().getContextClassLoader()); } catch (Exception e) { // Do nothing } return bundle; } private final ResourceBundle bundle; private final List<ExtensionFactory> factories; private final Map<String, NamedWriter> writers; private final Map<String, Class<? extends StreamWriter>> streamwriters; private final Map<String, NamedParser> parsers; public AbderaConfiguration() { this(null); } protected AbderaConfiguration(ResourceBundle bundle) { this.bundle = (bundle != null) ? bundle : AbderaConfiguration.getBundle(Locale.getDefault()); factories = loadExtensionFactories(); writers = initNamedWriters(); parsers = initNamedParsers(); streamwriters = initStreamWriters(); } private static synchronized List<ExtensionFactory> loadExtensionFactories() { List<ExtensionFactory> list = new ArrayList<ExtensionFactory>(); Iterable<ExtensionFactory> factories = Discover.locate("org.apache.abdera.factory.ExtensionFactory"); for (ExtensionFactory factory : factories) list.add(factory); return list; } private ResourceBundle getBundle() { return bundle; } /** * Retrieve the value of the specified configuration option * * @return The configuration option value or null */ public String getConfigurationOption(String id) { String option = System.getProperty(id); if (option == null) { try { ResourceBundle bundle = getBundle(); if (bundle != null) option = bundle.getString(id); } catch (Exception e) { // Do Nothing } } return option; } /** * Retrieve the value of the specified configuration option or _default if the value is null * * @return The configuration option value of _default */ public String getConfigurationOption(String id, String _default) { String value = getConfigurationOption(id); return (value != null) ? value : _default; } /** * Registers an ExtensionFactory implementation. */ public AbderaConfiguration addExtensionFactory(ExtensionFactory factory) { List<ExtensionFactory> factories = getExtensionFactories(); if (!factories.contains(factory)) { factories.add(factory); } else { log.warn("These extensions are already registered: " + factory.getNamespaces()); } return this; } /** * Returns the listing of registered ExtensionFactory implementations */ public List<ExtensionFactory> getExtensionFactories() { return factories; } /** * Registers a NamedWriter implementation */ public AbderaConfiguration addNamedWriter(NamedWriter writer) { Map<String, NamedWriter> writers = getNamedWriters(); if (!writers.containsKey(writer.getName())) { writers.put(writer.getName(), writer); } else { log.warn("The NamedWriter is already registered: " + writer.getName()); } return this; } /** * Registers NamedWriter implementations using the /META-INF/services/org.apache.abdera.writer.NamedWriter file */ private Map<String, NamedWriter> initNamedWriters() { Map<String, NamedWriter> writers = null; Iterable<NamedWriter> _writers = Discover.locate(NAMED_WRITER); writers = Collections.synchronizedMap(new HashMap<String, NamedWriter>()); for (NamedWriter writer : _writers) { writers.put(writer.getName().toLowerCase(), writer); } return writers; } /** * Registers StreamWriter implementations using the /META-INF/services/org.apache.abdera.writer.StreamWriter file */ private Map<String, Class<? extends StreamWriter>> initStreamWriters() { Map<String, Class<? extends StreamWriter>> writers = null; Iterable<Class<? extends StreamWriter>> _writers = Discover.locate(STREAM_WRITER, true); writers = Collections.synchronizedMap(new HashMap<String, Class<? extends StreamWriter>>()); for (Class<? extends StreamWriter> writer : _writers) { String name = getName(writer); if (name != null) writers.put(name.toLowerCase(), writer); } writers.put("fom", StreamBuilder.class); return writers; } private static String getName(Class<? extends StreamWriter> sw) { String name = null; try { Field field = sw.getField("NAME"); if (Modifier.isStatic(field.getModifiers())) { name = (String)field.get(null); } } catch (Exception e) { } return name; } /** * Returns the collection of NamedWriters */ public Map<String, NamedWriter> getNamedWriters() { return writers; } /** * Returns the collection of NamedWriters */ public Map<String, Class<? extends StreamWriter>> getStreamWriters() { return streamwriters; } /** * Registers a NamedParser implementation */ public AbderaConfiguration addNamedParser(NamedParser parser) { Map<String, NamedParser> parsers = getNamedParsers(); if (!parsers.containsKey(parser.getName())) { parsers.put(parser.getName(), parser); } else { log.warn("The NamedParser is already registered: " + parser.getName()); } return this; } /** * Registers a StreamWriter implementation */ public AbderaConfiguration addStreamWriter(Class<? extends StreamWriter> sw) { Map<String, Class<? extends StreamWriter>> streamWriters = getStreamWriters(); String swName = getName(sw); if (!streamWriters.containsKey(swName)) { streamWriters.put(swName, sw); } else { log.warn("The StreamWriter is already registered: " + swName); } return this; } /** * Registers NamedParser implementations using the /META-INF/services/org.apache.abdera.writer.NamedParser file */ private Map<String, NamedParser> initNamedParsers() { Map<String, NamedParser> parsers = null; Iterable<NamedParser> _parsers = Discover.locate(NAMED_PARSER); parsers = Collections.synchronizedMap(new HashMap<String, NamedParser>()); for (NamedParser parser : _parsers) { parsers.put(parser.getName().toLowerCase(), parser); } return parsers; } /** * Returns the collection of Named Parsers */ public Map<String, NamedParser> getNamedParsers() { return parsers; } public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } /** * Return a new instance of org.apache.abdera.factory.Factory * * @return A new factory instance */ public Factory newFactoryInstance(Abdera abdera) { return (Factory)Discover.locate(CONFIG_FACTORY, abdera.getConfiguration() .getConfigurationOption(CONFIG_FACTORY, DEFAULT_FACTORY), abdera); } /** * Return a new instance of org.apache.abdera.parser.Parser * * @return A new parser instance */ public Parser newParserInstance(Abdera abdera) { return (Parser)Discover.locate(CONFIG_PARSER, abdera.getConfiguration().getConfigurationOption(CONFIG_PARSER, DEFAULT_PARSER), abdera); } /** * Return a new instance of org.apache.abdera.xpath.XPath * * @return A new XPath instance */ public XPath newXPathInstance(Abdera abdera) { try { return (XPath)Discover .locate(CONFIG_XPATH, abdera.getConfiguration().getConfigurationOption(CONFIG_XPATH, DEFAULT_XPATH), abdera); } catch (Throwable n) { throw throwex("IMPLEMENTATION.NOT.AVAILABLE", "XPath", n); } } /** * Return a new instance of org.apache.abdera.parser.ParserFactory * * @return A new ParserFactory instance */ public ParserFactory newParserFactoryInstance(Abdera abdera) { try { return (ParserFactory)Discover.locate(CONFIG_PARSERFACTORY, abdera.getConfiguration() .getConfigurationOption(CONFIG_PARSERFACTORY, DEFAULT_PARSERFACTORY), abdera); } catch (Throwable n) { throw throwex("IMPLEMENTATION.NOT.AVAILABLE", "Parser", n); } } /** * Return a new instance of org.apache.abdera.writer.WriterFactory * * @return A new WriterFactory instance */ public WriterFactory newWriterFactoryInstance(Abdera abdera) { try { return (WriterFactory)Discover.locate(CONFIG_WRITERFACTORY, abdera.getConfiguration() .getConfigurationOption(CONFIG_WRITERFACTORY, DEFAULT_WRITERFACTORY), abdera); } catch (Throwable n) { throw throwex("IMPLEMENTATION.NOT.AVAILABLE", "WriterFactory", n); } } /** * Return a new instance of the default org.apache.abdera.writer.Writer * * @return A new default writer implementation instance */ public Writer newWriterInstance(Abdera abdera) { try { return (Writer)Discover.locate(CONFIG_WRITER, abdera.getConfiguration() .getConfigurationOption(CONFIG_WRITER, DEFAULT_WRITER), abdera); } catch (Throwable n) { throw throwex("IMPLEMENTATION.NOT.AVAILABLE", "Writer", n); } } /** * Return a new instance of the default org.apache.abdera.writer.Writer * * @return A new default writer implementation instance */ public StreamWriter newStreamWriterInstance(Abdera abdera) { try { return (StreamWriter)Discover.locate(CONFIG_STREAMWRITER, abdera.getConfiguration() .getConfigurationOption(CONFIG_STREAMWRITER, DEFAULT_STREAMWRITER), abdera); } catch (Throwable n) { throw throwex("IMPLEMENTATION.NOT.AVAILABLE", "StreamWriter", n); } } private RuntimeException throwex(String id, String arg, Throwable t) { return new RuntimeException(Localizer.sprintf(id, arg), t); } }
7,145
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Enumeration; import java.util.List; import javax.activation.MimeType; import javax.activation.MimeTypeParameterList; import org.apache.abdera.model.Base; import org.apache.abdera.model.Categories; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; import org.apache.abdera.model.Entry; import org.apache.abdera.model.Feed; import org.apache.abdera.model.Service; /** * Utilities for working with MIME Media Types */ public class MimeTypeHelper { private static final MimeType WILDCARD = createWildcard(); public static String getCharset(String mediatype) { try { MimeType mt = new MimeType(mediatype); return mt.getParameter("charset"); } catch (Exception e) { return null; } } private static MimeType createWildcard() { try { return new MimeType("*/*"); } catch (Exception e) { return null; // Won't happen } } /** * Returns true if media type a matches media type b */ public static boolean isMatch(String a, String b) { if ((a == null || a.length() == 0) && (b == null || b.length() == 0)) return true; boolean answer = false; try { MimeType mta = new MimeType(a.toLowerCase()); MimeType mtb = new MimeType(b.toLowerCase()); return isMatch(mta, mtb); } catch (Exception e) { } return answer; } public static boolean isMatch(MimeType a, MimeType b) { return isMatch(a, b, false); } /** * Returns true if media type a matches media type b */ @SuppressWarnings("unchecked") public static boolean isMatch(MimeType a, MimeType b, boolean includeparams) { try { if (a == null || b == null) return true; if (a.match(b)) { if (includeparams) { MimeTypeParameterList aparams = a.getParameters(); MimeTypeParameterList bparams = b.getParameters(); if (aparams.isEmpty() && bparams.isEmpty()) return true; if (aparams.isEmpty() && !bparams.isEmpty()) return false; if (!aparams.isEmpty() && bparams.isEmpty()) return false; boolean answer = true; for (Enumeration e = aparams.getNames(); e.hasMoreElements();) { String aname = (String)e.nextElement(); String avalue = aparams.get(aname); String bvalue = bparams.get(aname); if (avalue.equals(bvalue)) answer = true; else { answer = false; break; } } return answer; } else return true; } if (a.equals(WILDCARD)) return true; if (a.getPrimaryType().equals("*")) { MimeType c = new MimeType(b.getPrimaryType(), a.getSubType()); return isMatch(c, b); } if (b.getPrimaryType().equals("*")) { MimeType c = new MimeType(a.getPrimaryType(), b.getSubType()); return isMatch(a, c); } } catch (Exception e) { } return false; } private static boolean isMatchType(String actual, String expected) { return (actual != null && actual.equalsIgnoreCase(expected) || true); } /** * Returns true if media type a matches application/atomsrv+xml */ public static boolean isApp(String a) { return isMatch(Constants.APP_MEDIA_TYPE, a); } /** * Returns true if media type a matches application/atom+xml */ public static boolean isAtom(String a) { if (isEntry(a) || isFeed(a)) return true; return isMatch(Constants.ATOM_MEDIA_TYPE, a); } /** * Returns true if media type a specifically identifies an Atom entry document */ public static boolean isEntry(String a) { try { MimeType mta = new MimeType(a.toLowerCase()); MimeType mtb = new MimeType(Constants.ATOM_MEDIA_TYPE); MimeType mtc = new MimeType(Constants.ENTRY_MEDIA_TYPE); return isMatch(mta, mtc) || (isMatch(mta, mtb) && isMatchType(mta.getParameter("type"), "entry")); } catch (Exception e) { } return false; } /** * Returns true if media type a explicitly identifies an Atom feed document */ public static boolean isFeed(String a) { try { MimeType mta = new MimeType(a.toLowerCase()); MimeType mtb = new MimeType(Constants.ATOM_MEDIA_TYPE); MimeType mtc = new MimeType(Constants.FEED_MEDIA_TYPE); return isMatch(mta, mtc) || (isMatch(mta, mtb) && isMatchType(mta.getParameter("type"), "feed")); } catch (Exception e) { } return false; } /** * Returns true if media type a matches application/xml, text/xml or application/*+xml */ public static boolean isXml(String a) { boolean answer = isMatch(Constants.XML_MEDIA_TYPE, a) || isMatch("text/xml", a); if (!answer) { try { MimeType mta = new MimeType(a); answer = (("application".equalsIgnoreCase(mta.getPrimaryType()) || "text".equalsIgnoreCase(mta .getPrimaryType())) && mta.getSubType().equals("xml") || mta.getSubType().endsWith("+xml")); } catch (Exception e) { } } return answer; } /** * Returns true if media type a matches text/* */ public static boolean isText(String a) { return isMatch("text/*", a); } /** * Returns true if this is a valid media type */ public static boolean isMimeType(String a) { boolean answer = false; try { new MimeType(a); answer = true; } catch (javax.activation.MimeTypeParseException e) { answer = false; } return answer; } /** * Returns the appropriate media type for the given Abdera base */ @SuppressWarnings("unchecked") public static <T extends Base> String getMimeType(T base) { String type = null; if (base instanceof Document) { Document doc = (Document)base; MimeType mt = doc.getContentType(); type = (mt != null) ? mt.toString() : getMimeType(doc.getRoot()); } else if (base instanceof Element) { Element el = (Element)base; if (el.getDocument() != null) { MimeType mt = el.getDocument().getContentType(); type = (mt != null) ? mt.toString() : null; } if (type == null) { if (el instanceof Feed) type = Constants.FEED_MEDIA_TYPE; else if (el instanceof Entry) type = Constants.ENTRY_MEDIA_TYPE; else if (el instanceof Service) type = Constants.APP_MEDIA_TYPE; else if (el instanceof Categories) type = Constants.CAT_MEDIA_TYPE; } } if (type == null) type = base.getFactory().getMimeType(base); return (type != null) ? type : Constants.XML_MEDIA_TYPE; } /** * This will take an array of media types and will condense them based on wildcards, etc. For instance, * condense("image/png", "image/jpg", "image/*") condenses to [image/*] condense("application/atom", * "application/*", "image/png", "image/*") condenses to [application/*, image/*] */ public static String[] condense(String... types) { if (types.length <= 1) return types; List<String> res = new ArrayList<String>(); Arrays.sort(types, getComparator()); for (String t : types) { if (!contains(t, res, true)) res.add(t); } for (int n = 0; n < res.size(); n++) { String t = res.get(n); if (contains(t, res, false)) res.remove(t); } return res.toArray(new String[res.size()]); } private static boolean contains(String t1, List<String> t, boolean self) { if (self && t.contains(t1)) return true; for (String t2 : t) { int c = compare(t1, t2); if (c == 1) return true; } return false; } /** * Returns a Comparator that can be used to compare and sort MIME media types according to their level of * specificity (e.g. text/* is less specific than text/plain and would appear first in a sorted list) */ public static Comparator<String> getComparator() { return new Comparator<String>() { public int compare(String o1, String o2) { return MimeTypeHelper.compare(o1, o2); } }; } /** * Compare two media types according to their relative level of specificity */ public static int compare(MimeType mt1, MimeType mt2) { String st1 = mt1.getSubType(); String st2 = mt2.getSubType(); if (MimeTypeHelper.isMatch(mt1, mt2)) { if (st1.equals("*")) return -1; if (st2.equals("*")) return 1; } return 0; } /** * Compare two media types according to their relative level of specificity */ public static int compare(String t1, String t2) { try { MimeType mt1 = new MimeType(t1); MimeType mt2 = new MimeType(t2); return compare(mt1, mt2); } catch (Exception e) { } return 0; } /** * Returns true if media type is a multiparted file. */ public static boolean isMultipart(String a) { return isMatch(Constants.MULTIPART_RELATED_TYPE, a); } }
7,146
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractExtensionFactory.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.abdera.factory.ExtensionFactory; import org.apache.abdera.model.Base; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; import org.apache.abdera.model.ElementWrapper; /** * <p> * Provides a base implementation for ExtensionFactory instances. By extending this, specific extension factories need * only to associate a QName with an implementation class, e.g., * </p> * * <pre> * public class MyExtensionFactory * extends AbstractExtensionFactory { * * private String NS = "http://example.org/foo/ns"; * private QName FOO = new QName(NS, "foo"); * * public MyExtensionFactory() { * super(NS); * addImpl(FOO, Foo.class); * } * } * * public class Foo extends ElementWrapper { ... } * * </pre> */ public abstract class AbstractExtensionFactory implements ExtensionFactory { private final List<String> namespaces = new ArrayList<String>(); private final Map<QName, String> mimetypes = new HashMap<QName, String>(); private final Map<QName, Class<? extends ElementWrapper>> impls = new HashMap<QName, Class<? extends ElementWrapper>>(); protected AbstractExtensionFactory(String... namespaces) { for (String ns : namespaces) this.namespaces.add(ns); } @SuppressWarnings("unchecked") public <T extends Element> T getElementWrapper(Element internal) { T t = null; QName qname = internal.getQName(); Class<? extends ElementWrapper> impl = impls.get(qname); if (impl != null) { try { t = (T)impl.getConstructor(new Class[] {Element.class}).newInstance(new Object[] {internal}); } catch (Exception e) { } } return t != null ? t : (T)internal; } /** * Associate a MIME media type for the specific QName */ protected AbstractExtensionFactory addMimeType(QName qname, String mimetype) { mimetypes.put(qname, mimetype); return this; } /** * Associate a QName with an implementation class */ protected AbstractExtensionFactory addImpl(QName qname, Class<? extends ElementWrapper> impl) { impls.put(qname, impl); return this; } @SuppressWarnings("unchecked") public <T extends Base> String getMimeType(T base) { Element element = base instanceof Element ? (Element)base : base instanceof Document ? ((Document)base).getRoot() : null; QName qname = element != null ? element.getQName() : null; return element != null && qname != null ? mimetypes.get(qname) : null; } public String[] getNamespaces() { return namespaces.toArray(new String[namespaces.size()]); } public boolean handlesNamespace(String namespace) { return namespaces.contains(namespace); } }
7,147
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractWriter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.IOException; import java.io.OutputStream; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.util.zip.DeflaterOutputStream; import org.apache.abdera.i18n.text.io.CompressionUtil; import org.apache.abdera.model.Base; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; import org.apache.abdera.writer.Writer; import org.apache.abdera.writer.WriterOptions; @SuppressWarnings("unchecked") public abstract class AbstractWriter implements Writer { protected WriterOptions options; public WriterOptions getDefaultWriterOptions() { if (options == null) options = initDefaultWriterOptions(); // Make a copy of the options, so that changes to it don't result in // changes to the Parser's defaults. Also, this allows us to remain // thread safe without having to make ParseOptions implementations // synchronized. try { return (WriterOptions)options.clone(); } catch (CloneNotSupportedException cnse) { // This shouldn't actually happen throw new RuntimeException(cnse); } } protected abstract WriterOptions initDefaultWriterOptions(); public synchronized Writer setDefaultWriterOptions(WriterOptions options) { // Ok, we need to make a defensive copy of the options, since otherwise // the caller still has access to the object, which means our access to // it isn't certain to be thread safe. try { this.options = (options != null) ? (WriterOptions)options.clone() : initDefaultWriterOptions(); } catch (CloneNotSupportedException cnse) { // This shouldn't actually happen throw new RuntimeException(cnse); } return this; } public Object write(Base base) throws IOException { return write(base, getDefaultWriterOptions()); } public void writeTo(Base base, OutputStream out) throws IOException { writeTo(base, out, getDefaultWriterOptions()); } public void writeTo(Base base, java.io.Writer out) throws IOException { writeTo(base, out, getDefaultWriterOptions()); } protected OutputStream getCompressedOutputStream(OutputStream out, WriterOptions options) throws IOException { if (options.getCompressionCodecs() != null) { out = CompressionUtil.getEncodedOutputStream(out, options.getCompressionCodecs()); } return out; } protected void finishCompressedOutputStream(OutputStream out, WriterOptions options) throws IOException { if (options.getCompressionCodecs() != null) { ((DeflaterOutputStream)out).finish(); } } public void writeTo(Base base, WritableByteChannel out, WriterOptions options) throws IOException { String charset = options.getCharset(); if (charset == null) { Document doc = null; if (base instanceof Document) doc = (Document)base; else if (base instanceof Element) { doc = ((Element)base).getDocument(); } charset = doc != null ? doc.getCharset() : null; } writeTo(base, Channels.newWriter(out, charset != null ? charset : "utf-8"), options); } public void writeTo(Base base, WritableByteChannel out) throws IOException { writeTo(base, out, getDefaultWriterOptions()); } }
7,148
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbderaResult.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.io.Writer; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; import org.apache.abdera.Abdera; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; /** * Provides a simple (and likely somewhat inefficient) implementation of javax.xml.transform.Result that allows Abdera * objects to be used with the javax.xml.transform API's Only use this once per transform!!! */ public final class AbderaResult extends StreamResult implements Result { private final Abdera abdera; private PipedOutputStream pipeout; private PipedInputStream pipein; private Document<?> doc; public AbderaResult() { this(new Abdera()); } public AbderaResult(Abdera abdera) { this.abdera = abdera; } @SuppressWarnings("unchecked") public <T extends Element> Document<T> getDocument() { if (doc == null) { if (pipein == null) return null; doc = abdera.getParser().parse(pipein); } return (Document<T>)doc; } @Override public OutputStream getOutputStream() { if (pipein == null && pipeout == null) { try { pipeout = new PipedOutputStream(); pipein = new PipedInputStream(pipeout); } catch (IOException e) { } } return pipeout; } @Override public Writer getWriter() { return new OutputStreamWriter(getOutputStream()); } @Override public void setOutputStream(OutputStream out) { throw new UnsupportedOperationException(); } @Override public void setWriter(Writer out) { throw new UnsupportedOperationException(); } }
7,149
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/EntityTag.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You under the * Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law * or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. For additional * information regarding copyright in this work, please see the NOTICE file in * the top level directory of this distribution. */ package org.apache.abdera.util; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.abdera.i18n.text.Localizer; import org.apache.commons.codec.binary.Hex; /** * Implements an EntityTag. */ public class EntityTag implements Cloneable, Serializable, Comparable<EntityTag> { private static final long serialVersionUID = 1559972888659121461L; private static final Pattern PATTERN = Pattern.compile("(\\*)|([wW]/)?\"([^\"]*)\""); private static final String INVALID_ENTITY_TAG = Localizer.get("INVALID.ENTITY.TAG"); public static final EntityTag WILD = new EntityTag("*"); public static EntityTag parse(String entity_tag) { if (entity_tag == null || entity_tag.length() == 0) throw new IllegalArgumentException(INVALID_ENTITY_TAG); Matcher m = PATTERN.matcher(entity_tag); if (m.find()) { boolean wild = m.group(1) != null; boolean weak = m.group(2) != null; String tag = wild ? "*" : m.group(3); return new EntityTag(tag, weak, wild); } else { throw new IllegalArgumentException(INVALID_ENTITY_TAG); } } public static EntityTag[] parseTags(String entity_tags) { if (entity_tags == null || entity_tags.length() == 0) return new EntityTag[0]; String[] tags = entity_tags.split("((?<=\")\\s*,\\s*(?=([wW]/)?\"|\\*))"); List<EntityTag> etags = new ArrayList<EntityTag>(); for (String tag : tags) { etags.add(EntityTag.parse(tag.trim())); } return etags.toArray(new EntityTag[etags.size()]); } public static boolean matchesAny(EntityTag tag1, String tags) { return matchesAny(tag1, parseTags(tags), false); } public static boolean matchesAny(EntityTag tag1, String tags, boolean weak) { return matchesAny(tag1, parseTags(tags), weak); } public static boolean matchesAny(String tag1, String tags) { return matchesAny(parse(tag1), parseTags(tags), false); } public static boolean matchesAny(String tag1, String tags, boolean weak) { return matchesAny(parse(tag1), parseTags(tags), weak); } public static boolean matchesAny(EntityTag tag1, EntityTag[] tags) { return matchesAny(tag1, tags, false); } public static boolean matchesAny(EntityTag tag1, EntityTag[] tags, boolean weak) { if (tags == null) return (tag1 == null) ? true : false; if (tag1.isWild() && tags != null && tags.length > 0) return true; for (EntityTag tag : tags) { if (tag1.equals(tag) || tag.isWild()) return true; } return false; } public static boolean matches(EntityTag tag1, EntityTag tag2) { return tag1.equals(tag2); } public static boolean matches(String tag1, String tag2) { EntityTag etag1 = parse(tag1); EntityTag etag2 = parse(tag2); return etag1.equals(etag2); } public static boolean matches(EntityTag tag1, String tag2) { return tag1.equals(parse(tag2)); } private final String tag; private final boolean weak; private final boolean wild; public EntityTag(String tag) { this(tag, false); } public EntityTag(String tag, boolean weak) { EntityTag etag = attemptParse(tag); if (etag == null) { if (tag.indexOf('"') > -1) throw new IllegalArgumentException(INVALID_ENTITY_TAG); this.tag = tag; this.weak = weak; this.wild = tag.equals("*"); } else { this.tag = etag.tag; this.weak = etag.weak; this.wild = etag.wild; } } private EntityTag(String tag, boolean weak, boolean wild) { this.tag = tag; this.weak = weak; this.wild = wild; } private EntityTag attemptParse(String tag) { try { return parse(tag); } catch (Exception e) { return null; } } public boolean isWild() { return wild; } public String getTag() { return tag; } public boolean isWeak() { return weak; } public String toString() { StringBuilder buf = new StringBuilder(); if (wild) { buf.append("*"); } else { if (weak) buf.append("W/"); buf.append('"'); buf.append(tag); buf.append('"'); } return buf.toString(); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((tag == null) ? 0 : tag.hashCode()); result = prime * result + (weak ? 1231 : 1237); result = prime * result + (wild ? 1231 : 1237); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final EntityTag other = (EntityTag)obj; if (isWild() || other.isWild()) return true; if (tag == null) { if (other.tag != null) return false; } else if (!tag.equals(other.tag)) return false; if (weak != other.weak) return false; if (wild != other.wild) return false; return true; } @Override protected EntityTag clone() { try { return (EntityTag)super.clone(); } catch (CloneNotSupportedException e) { return new EntityTag(tag, weak, wild); // not going to happen } } /** * Utility method for generating ETags. Works by concatenating the UTF-8 bytes of the provided strings then * generating an MD5 hash of the result. */ public static EntityTag generate(String... material) { String etag = null; try { MessageDigest md = MessageDigest.getInstance("md5"); for (String s : material) { if (s != null) md.update(s.getBytes("utf-8")); } byte[] digest = md.digest(); etag = new String(Hex.encodeHex(digest)); } catch (NoSuchAlgorithmException e) { throw new UnsupportedOperationException(Localizer.get("HASHING.NOT.AVAILABLE")); } catch (UnsupportedEncodingException e) { // should not happen throw new RuntimeException(Localizer.get("UTF8.NOT.SUPPORTED"), e); } return new EntityTag(etag); } /** * Checks that the passed in ETag matches the ETag generated by the generate method */ public static boolean matches(EntityTag etag, String... material) { EntityTag etag2 = generate(material); return EntityTag.matches(etag, etag2); } public static String toString(EntityTag... tags) { StringBuilder buf = new StringBuilder(); for (EntityTag tag : tags) { if (buf.length() > 0) buf.append(", "); buf.append(tag.toString()); } return buf.toString(); } public static String toString(String... tags) { StringBuilder buf = new StringBuilder(); for (String tag : tags) { if (buf.length() > 0) buf.append(", "); EntityTag etag = new EntityTag(tag); buf.append(etag.toString()); } return buf.toString(); } public int compareTo(EntityTag o) { if (o.isWild() && !isWild()) return 1; if (isWild() && !o.isWild()) return -1; if (o.isWeak() && !isWeak()) return -1; if (isWeak() && !o.isWeak()) return 1; return tag.compareTo(o.tag); } }
7,150
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbderaSource.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.io.Reader; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import org.apache.abdera.model.Base; /** * Provides a simple (and likely somewhat inefficient) implementation of javax.xml.transform.Source that allows Abdera * objects to be used with the javax.xml.transform API's */ public final class AbderaSource extends StreamSource implements Source { private final Base base; public AbderaSource(Base base) { this.base = base; } @Override public InputStream getInputStream() { try { PipedOutputStream pipeout = new PipedOutputStream(); PipedInputStream pipein = new PipedInputStream(pipeout); base.writeTo(pipeout); pipeout.flush(); pipeout.close(); return pipein; } catch (IOException e) { return null; } } @Override public Reader getReader() { return new InputStreamReader(getInputStream()); } @Override public void setInputStream(InputStream in) { throw new UnsupportedOperationException(); } @Override public void setReader(Reader reader) { throw new UnsupportedOperationException(); } }
7,151
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractParser.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import javax.xml.stream.XMLStreamReader; import org.apache.abdera.Abdera; import org.apache.abdera.factory.Factory; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; import org.apache.abdera.parser.ParseException; import org.apache.abdera.parser.Parser; import org.apache.abdera.parser.ParserOptions; /** * Abstract base implementation of Abdera Parser. */ public abstract class AbstractParser implements Parser { protected Abdera abdera; protected ParserOptions options; protected AbstractParser() { this(new Abdera()); } protected AbstractParser(Abdera abdera) { this.abdera = abdera; } public Abdera getAbdera() { return abdera; } public void setAbdera(Abdera abdera) { this.abdera = abdera; } public Factory getFactory() { return getAbdera().getFactory(); } public <T extends Element> Document<T> parse(InputStream in) throws ParseException { return parse(in, null, getDefaultParserOptions()); } public <T extends Element> Document<T> parse(XMLStreamReader reader) throws ParseException { return parse(reader, null, getDefaultParserOptions()); } public <T extends Element> Document<T> parse(InputStream in, String base) throws ParseException { return parse(in, base, getDefaultParserOptions()); } public <T extends Element> Document<T> parse(InputStream in, ParserOptions options) throws ParseException { return parse(in, null, options); } public <T extends Element> Document<T> parse(InputStream in, String base, ParserOptions options) throws ParseException { return parse(new InputStreamReader(in), base, options); } public <T extends Element> Document<T> parse(Reader in) throws ParseException { return parse(in, null, getDefaultParserOptions()); } public <T extends Element> Document<T> parse(Reader in, String base) throws ParseException { return parse(in, base, getDefaultParserOptions()); } public <T extends Element> Document<T> parse(Reader in, ParserOptions options) throws ParseException { return parse(in, null, options); } public <T extends Element> Document<T> parse(ReadableByteChannel buf, ParserOptions options) throws ParseException { return parse(buf, null, options); } public <T extends Element> Document<T> parse(ReadableByteChannel buf, String base, ParserOptions options) throws ParseException { String charset = options.getCharset(); return parse(Channels.newReader(buf, charset != null ? charset : "utf-8"), base, options); } public <T extends Element> Document<T> parse(ReadableByteChannel buf, String base) throws ParseException { return parse(buf, base, getDefaultParserOptions()); } public <T extends Element> Document<T> parse(ReadableByteChannel buf) throws ParseException { return parse(buf, null, getDefaultParserOptions()); } public synchronized ParserOptions getDefaultParserOptions() { if (options == null) options = initDefaultParserOptions(); // Make a copy of the options, so that changes to it don't result in // changes to the Parser's defaults. Also, this allows us to remain // thread safe without having to make ParseOptions implementations // synchronized. try { return (ParserOptions)options.clone(); } catch (CloneNotSupportedException cnse) { // This shouldn't actually happen throw new RuntimeException(cnse); } } protected abstract ParserOptions initDefaultParserOptions(); public synchronized Parser setDefaultParserOptions(ParserOptions options) { // Ok, we need to make a defensive copy of the options, since otherwise // the caller still has access to the object, which means our access to // it isn't certain to be thread safe. try { this.options = (options != null) ? (ParserOptions)options.clone() : initDefaultParserOptions(); return this; } catch (CloneNotSupportedException cnse) { // This shouldn't actually happen throw new RuntimeException(cnse); } } }
7,152
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/Configuration.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.Serializable; import java.util.List; import java.util.Map; import org.apache.abdera.Abdera; import org.apache.abdera.factory.ExtensionFactory; import org.apache.abdera.factory.Factory; import org.apache.abdera.parser.NamedParser; import org.apache.abdera.parser.Parser; import org.apache.abdera.parser.ParserFactory; import org.apache.abdera.writer.NamedWriter; import org.apache.abdera.writer.StreamWriter; import org.apache.abdera.writer.Writer; import org.apache.abdera.writer.WriterFactory; import org.apache.abdera.xpath.XPath; public interface Configuration extends Cloneable, Serializable { /** * Retrieve the value of the specified configuration option * * @return The configuration option value or null */ public abstract String getConfigurationOption(String id); /** * Retrieve the value of the specified configuration option or _default if the value is null * * @return The configuration option value of _default */ public abstract String getConfigurationOption(String id, String _default); /** * Get a new instance of the default Factory impl */ public Factory newFactoryInstance(Abdera abdera); /** * Get a new instance of the default Parser impl */ public Parser newParserInstance(Abdera abdera); /** * Get a new instance of the default XPath impl */ public XPath newXPathInstance(Abdera abdera); /** * Get a new instance of the default ParserFactory impl */ public ParserFactory newParserFactoryInstance(Abdera abdera); /** * Get a new instance of the default WriterFactory impl */ public WriterFactory newWriterFactoryInstance(Abdera abdera); /** * Get a new instance of the default Writer impl */ public Writer newWriterInstance(Abdera abdera); /** * Get a new instance of the default StreamWriter impl */ public StreamWriter newStreamWriterInstance(Abdera abdera); /** * Get the collection of NamedParsers; */ public Map<String, NamedParser> getNamedParsers(); /** * Get the collection of NamedWriters */ public Map<String, NamedWriter> getNamedWriters(); /** * Get the collection of Named StreamWriters */ public Map<String, Class<? extends StreamWriter>> getStreamWriters(); /** * Get the collection of ExtensionFactory impls */ public List<ExtensionFactory> getExtensionFactories(); public abstract Object clone(); /** * Registers a new NamedParser, this method doesn't override a parser if already exists. * * @param parser is the new NamedParser to add * @return the instance of the configuration class */ public Configuration addNamedParser(NamedParser parser); /** * Registers a new NamedWriter, this method doesn't override a writer if already exists. * * @param writer is the new NamedWriter to add * @return the instance of the configuration class */ public Configuration addNamedWriter(NamedWriter writer); /** * Registers a new ExtensionFactory, this method doesn't override an extensionFactory if already exists. * * @param factory is the new ExtensionFactory to add * @return the instance of the configuration class */ public Configuration addExtensionFactory(ExtensionFactory factory); /** * Registers a new StreamWriter, this method doesn't override a streamWriter if already exists. * * @param sw is the new StreamWriter to add * @return the instance of the configuration class */ public Configuration addStreamWriter(Class<? extends StreamWriter> sw); }
7,153
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/XmlUtil.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import org.apache.abdera.i18n.text.CharUtils; import org.apache.abdera.i18n.text.Filter; public class XmlUtil { public enum XMLVersion { XML10, XML11; private final Filter filter; XMLVersion() { this.filter = new XmlFilter(this); } public Filter filter() { return filter; } }; private static class XmlFilter implements Filter { private final XMLVersion version; XmlFilter(XMLVersion version) { this.version = version; } public boolean accept(int c) { return !restricted(version, c); } } // inversion set private static int[] RESTRICTED_SET_v1 = {0, 9, 11, 13, 14, 32, 55296, 57344, 65534, 65536}; // inversion set private static int[] RESTRICTED_SET_v11 = {11, 13, 14, 32, 127, 160, 55296, 57344, 65534, 65536}; public static boolean restricted(XMLVersion version, char c) { return restricted(version, (int)c); } public static boolean restricted(XMLVersion version, int c) { return CharUtils.invset_contains(version == XMLVersion.XML10 ? RESTRICTED_SET_v1 : RESTRICTED_SET_v11, c); } public static XMLVersion getVersion(String version) { return version == null ? XMLVersion.XML10 : version.equals("1.0") ? XMLVersion.XML10 : version.equals("1.1") ? XMLVersion.XML11 : XMLVersion.XML10; } }
7,154
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractWriterOptions.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import org.apache.abdera.i18n.text.io.CompressionUtil.CompressionCodec; import org.apache.abdera.writer.WriterOptions; public abstract class AbstractWriterOptions implements WriterOptions { protected String charset = "UTF-8"; protected CompressionCodec[] codecs = null; protected boolean autoclose = false; public Object clone() throws CloneNotSupportedException { AbstractWriterOptions copy = (AbstractWriterOptions)super.clone(); return copy; } public CompressionCodec[] getCompressionCodecs() { return codecs; } public WriterOptions setCompressionCodecs(CompressionCodec... codecs) { this.codecs = codecs; return this; } public String getCharset() { return charset; } public WriterOptions setCharset(String charset) { this.charset = charset; return this; } public boolean getAutoClose() { return autoclose; } public WriterOptions setAutoClose(boolean autoclose) { this.autoclose = autoclose; return this; } }
7,155
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractStreamWriter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.util.Date; import java.util.Formatter; import java.util.Locale; import javax.activation.DataHandler; import javax.xml.namespace.QName; import org.apache.abdera.Abdera; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.i18n.rfc4646.Lang; import org.apache.abdera.model.AtomDate; import org.apache.abdera.model.Content; import org.apache.abdera.model.Text; import org.apache.abdera.model.Text.Type; import org.apache.abdera.writer.StreamWriter; import org.apache.commons.codec.binary.Base64; public abstract class AbstractStreamWriter implements StreamWriter { protected final Abdera abdera; protected final String name; protected boolean autoflush = false; protected boolean autoclose = false; protected boolean autoindent = false; protected AbstractStreamWriter(Abdera abdera, String name) { this.abdera = abdera; this.name = name; } public StreamWriter setAutoflush(boolean auto) { this.autoflush = auto; return this; } public StreamWriter setAutoclose(boolean auto) { this.autoclose = auto; return this; } public StreamWriter setChannel(WritableByteChannel channel) { return setOutputStream(Channels.newOutputStream(channel)); } public StreamWriter setChannel(WritableByteChannel channel, String charset) { return setWriter(Channels.newWriter(channel, charset)); } public String getName() { return name; } public StreamWriter startDocument() { return startDocument("1.0"); } public StreamWriter endDocument() { return this; } public StreamWriter startFeed() { return startElement(Constants.FEED); } public StreamWriter endFeed() { return endElement(); } public StreamWriter startEntry() { return startElement(Constants.ENTRY); } public StreamWriter endEntry() { return endElement(); } public StreamWriter endCategory() { return endElement(); } public StreamWriter endContent() { return endElement(); } public StreamWriter endLink() { return endElement(); } public StreamWriter endPerson() { return endElement(); } public StreamWriter endSource() { return endElement(); } public StreamWriter endText() { return endElement(); } public StreamWriter startLink(String iri, String rel, String type, String title, String hreflang, long length) { return startElement(Constants.LINK).writeAttribute("href", iri).writeAttribute("rel", rel) .writeAttribute("type", type).writeAttribute("title", title).writeAttribute("hreflang", hreflang) .writeAttribute("length", length > -1 ? String.valueOf(length) : null); } public StreamWriter startPerson(QName qname) { return startElement(qname); } public StreamWriter startSource() { return startElement(Constants.SOURCE); } public StreamWriter startText(QName qname, Text.Type type) { return startElement(qname).writeAttribute("type", type != null ? type.name().toLowerCase() : "text"); } public StreamWriter writeDate(QName qname, String date) { return startElement(qname).writeElementText(date).endElement(); } public StreamWriter writeIRIElement(QName qname, String iri) { return startElement(qname).writeElementText(iri).endElement(); } public StreamWriter writePersonEmail(String email) { if (email == null) return this; return startElement(Constants.EMAIL).writeElementText(email).endElement(); } public StreamWriter writePersonName(String name) { if (name == null) return this; return startElement(Constants.NAME).writeElementText(name).endElement(); } public StreamWriter writePersonUri(String uri) { if (uri == null) return this; return startElement(Constants.URI).writeElementText(uri).endElement(); } public StreamWriter startContent(Content.Type type, String src) { return startContent(type.name().toLowerCase(), src); } public StreamWriter startContent(String type, String src) { return startElement(Constants.CONTENT).writeAttribute("type", type).writeAttribute("src", src); } public StreamWriter startContent(Content.Type type) { return startContent(type, null); } public StreamWriter startContent(String type) { return startContent(type, null); } public StreamWriter startLink(String iri) { return startLink(iri, null, null, null, null, -1); } public StreamWriter startLink(String iri, String rel) { return startLink(iri, rel, null, null, null, -1); } public StreamWriter startLink(String iri, String rel, String type) { return startLink(iri, rel, type, null, null, -1); } public StreamWriter writeCategory(String term) { return writeCategory(term, null, null); } public StreamWriter writeCategory(String term, String scheme) { return writeCategory(term, scheme, null); } public StreamWriter writeCategory(String term, String scheme, String label) { return startElement(Constants.CATEGORY).writeAttribute("term", term).writeAttribute("scheme", scheme) .writeAttribute("label", label).endElement(); } public StreamWriter writeContent(Content.Type type, String value) { return startContent(type).writeElementText(value).endContent(); } public StreamWriter writeContent(Content.Type type, InputStream value) throws IOException { return startContent(type).writeElementText(value).endContent(); } public StreamWriter writeContent(Content.Type type, DataHandler value) throws IOException { return startContent(type).writeElementText(value).endContent(); } public StreamWriter writeContent(String type, String value) { return startContent(type).writeElementText(value).endContent(); } public StreamWriter writeEdited(Date date) { writeDate(Constants.EDITED, date); return this; } public StreamWriter writeId(String iri) { return writeIRIElement(Constants.ID, iri); } public StreamWriter writeIcon(String iri) { return writeIRIElement(Constants.ICON, iri); } public StreamWriter writeLogo(String iri) { return writeIRIElement(Constants.LOGO, iri); } public StreamWriter writeLink(String iri) { return writeLink(iri, null, null, null, null, -1); } public StreamWriter writeLink(String iri, String rel) { return writeLink(iri, rel, null, null, null, -1); } public StreamWriter writeLink(String iri, String rel, String type) { return writeLink(iri, rel, type, null, null, -1); } public StreamWriter writeLink(String iri, String rel, String type, String title, String hreflang, long length) { return startLink(iri, rel, type, title, hreflang, length).endLink(); } public StreamWriter writePerson(QName qname, String name, String email, String uri) { return startPerson(qname).writePersonName(name).writePersonEmail(email).writePersonUri(uri).endPerson(); } public StreamWriter writePublished(Date date) { return writeDate(Constants.PUBLISHED, date); } public StreamWriter writeText(QName qname, Text.Type type, String value) { return startText(qname, type).writeElementText(value).endElement(); } public StreamWriter writeUpdated(Date date) { return writeDate(Constants.UPDATED, date); } public StreamWriter writeUpdated(String date) { return writeDate(Constants.UPDATED, date); } public StreamWriter writePublished(String date) { return writeDate(Constants.PUBLISHED, date); } public StreamWriter writeEdited(String date) { return writeDate(Constants.EDITED, date); } public StreamWriter writeDate(QName qname, Date date) { return writeDate(qname, AtomDate.format(date)); } public StreamWriter writeId(IRI iri) { return writeIRIElement(Constants.ID, iri); } public StreamWriter writeIcon(IRI iri) { return writeIRIElement(Constants.ICON, iri); } public StreamWriter writeLogo(IRI iri) { return writeIRIElement(Constants.LOGO, iri); } public StreamWriter writeIRIElement(QName qname, IRI iri) { return writeIRIElement(qname, iri.toString()); } public StreamWriter writeElementText(InputStream value) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int r = -1; while ((r = value.read(buf)) != -1) out.write(buf, 0, r); byte[] data = out.toByteArray(); writeElementText(new String(Base64.encodeBase64(data), "UTF-8")); return this; } public StreamWriter writeElementText(DataHandler value) throws IOException { writeElementText(value.getInputStream()); return this; } public StreamWriter writeTitle(String value) { return writeText(Constants.TITLE, Text.Type.TEXT, value); } public StreamWriter writeTitle(Text.Type type, String value) { return writeText(Constants.TITLE, type, value); } public StreamWriter writeSubtitle(String value) { return writeText(Constants.SUBTITLE, Text.Type.TEXT, value); } public StreamWriter writeSubtitle(Text.Type type, String value) { return writeText(Constants.SUBTITLE, type, value); } public StreamWriter writeSummary(String value) { return writeText(Constants.SUMMARY, Text.Type.TEXT, value); } public StreamWriter writeSummary(Text.Type type, String value) { return writeText(Constants.SUMMARY, type, value); } public StreamWriter writeRights(String value) { return writeText(Constants.RIGHTS, Text.Type.TEXT, value); } public StreamWriter writeRights(Text.Type type, String value) { return writeText(Constants.RIGHTS, type, value); } public StreamWriter writeAuthor(String name, String email, String uri) { return writePerson(Constants.AUTHOR, name, email, uri); } public StreamWriter writeAuthor(String name) { return writeAuthor(name, null, null); } public StreamWriter startAuthor() { return startElement(Constants.AUTHOR); } public StreamWriter endAuthor() { return endElement(); } public StreamWriter writeContributor(String name, String email, String uri) { return writePerson(Constants.CONTRIBUTOR, name, email, uri); } public StreamWriter writeContributor(String name) { return writeContributor(name, null, null); } public StreamWriter startContributor() { return startElement(Constants.CONTRIBUTOR); } public StreamWriter endContributor() { return endElement(); } public StreamWriter writeGenerator(String version, String uri, String value) { return startElement(Constants.GENERATOR).writeAttribute("version", version).writeAttribute("uri", uri) .writeElementText(value).endElement(); } public StreamWriter startGenerator(String version, String uri) { return startElement(Constants.GENERATOR).writeAttribute("version", version).writeAttribute("uri", uri); } public StreamWriter endGenerator() { return endElement(); } public StreamWriter startCategory(String term) { return startCategory(term, null, null); } public StreamWriter startCategory(String term, String scheme) { return startCategory(term, scheme, null); } public StreamWriter startCategory(String term, String scheme, String label) { return startElement(Constants.CATEGORY).writeAttribute("term", term).writeAttribute("scheme", scheme) .writeAttribute("label", label); } public StreamWriter startService() { return startElement(Constants.SERVICE); } public StreamWriter endService() { return endElement(); } public StreamWriter startWorkspace() { return startElement(Constants.WORKSPACE); } public StreamWriter endWorkspace() { return endElement(); } public StreamWriter startCollection(String href) { return startElement(Constants.COLLECTION).writeAttribute("href", href); } public StreamWriter endCollection() { endElement(); return this; } public StreamWriter writeAccepts(String... accepts) { for (String accept : accepts) { startElement(Constants.ACCEPT).writeElementText(accept).endElement(); } return this; } public StreamWriter writeAcceptsEntry() { return writeAccepts("application/atom+xml;type=entry"); } public StreamWriter writeAcceptsNothing() { return writeAccepts(""); } public StreamWriter startCategories() { return startCategories(false, null); } public StreamWriter startCategories(boolean fixed) { return startCategories(fixed, null); } public StreamWriter startCategories(boolean fixed, String scheme) { startElement(Constants.CATEGORIES); if (fixed) { writeAttribute("fixed", "yes"); } if (scheme != null && scheme.length() > 0) { writeAttribute("scheme", scheme); } return this; } public StreamWriter endCategories() { return endElement(); } public StreamWriter startControl() { return startElement(Constants.CONTROL); } public StreamWriter endControl() { return endElement(); } public StreamWriter writeDraft(boolean draft) { return startElement(Constants.DRAFT).writeElementText(draft ? "yes" : "no").endElement(); } public StreamWriter writeAttribute(String name, String value) { if (value == null) return this; return writeAttribute(name, null, null, value); } public StreamWriter writeAttribute(String name, String namespace, String value) { if (value == null) return this; return writeAttribute(name, namespace, null, value); } public StreamWriter writeAttribute(QName qname, String value) { if (value == null) return this; return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value); } public StreamWriter startElement(QName qname) { return startElement(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix()); } public StreamWriter startElement(String name) { return startElement(name, null, null); } public StreamWriter startElement(String name, String namespace) { return startElement(name, namespace, null); } public StreamWriter setAutoIndent(boolean indent) { this.autoindent = indent; return this; } public StreamWriter writeAttribute(QName qname, Date value) { return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value); } public StreamWriter writeAttribute(String name, Date value) { return writeAttribute(name, null, null, value); } public StreamWriter writeAttribute(String name, String namespace, Date value) { return writeAttribute(name, namespace, null, value); } public StreamWriter writeAttribute(String name, String namespace, String prefix, Date value) { return writeAttribute(name, namespace, prefix, AtomDate.format(value)); } public StreamWriter writeAttribute(QName qname, int value) { return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value); } public StreamWriter writeAttribute(String name, int value) { return writeAttribute(name, null, null, value); } public StreamWriter writeAttribute(String name, String namespace, int value) { return writeAttribute(name, namespace, null, value); } public StreamWriter writeAttribute(String name, String namespace, String prefix, int value) { return writeAttribute(name, namespace, prefix, Integer.toString(value)); } public StreamWriter writeAttribute(QName qname, long value) { return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value); } public StreamWriter writeAttribute(String name, long value) { return writeAttribute(name, null, null, value); } public StreamWriter writeAttribute(String name, String namespace, long value) { return writeAttribute(name, namespace, null, value); } public StreamWriter writeAttribute(String name, String namespace, String prefix, long value) { return writeAttribute(name, namespace, prefix, Long.toString(value)); } public StreamWriter writeAttribute(QName qname, double value) { return writeAttribute(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix(), value); } public StreamWriter writeAttribute(String name, double value) { return writeAttribute(name, null, null, value); } public StreamWriter writeAttribute(String name, String namespace, double value) { return writeAttribute(name, namespace, null, value); } public StreamWriter writeAttribute(String name, String namespace, String prefix, double value) { return writeAttribute(name, namespace, prefix, Double.toString(value)); } public StreamWriter writeElementText(Date value) { return writeElementText(AtomDate.format(value)); } public StreamWriter writeElementText(int value) { return writeElementText(Integer.toString(value)); } public StreamWriter writeElementText(long value) { return writeElementText(Long.toString(value)); } public StreamWriter writeElementText(double value) { return writeElementText(Double.toString(value)); } public StreamWriter writeBase(String iri) { return writeAttribute(Constants.BASE, iri); } public StreamWriter writeBase(IRI iri) { return writeBase(iri.toString()); } public StreamWriter writeLanguage(String lang) { return writeAttribute(Constants.LANG, lang); } public StreamWriter writeLanguage(Lang lang) { return writeLanguage(lang.toString()); } public StreamWriter writeLanguage(Locale locale) { return writeLanguage(new Lang(locale)); } public StreamWriter writeIRIElement(String name, IRI iri) { return startElement(name).writeElementText(iri.toString()).endElement(); } public StreamWriter writeIRIElement(String name, String namespace, IRI iri) { return startElement(name, namespace).writeElementText(iri.toString()).endElement(); } public StreamWriter writeIRIElement(String name, String namespace, String prefix, IRI iri) { return startElement(name, namespace, prefix).writeElementText(iri.toString()).endElement(); } public StreamWriter writeIRIElement(String name, String namespace, String prefix, String iri) { return startElement(name, namespace, prefix).writeElementText(iri).endElement(); } public StreamWriter writeIRIElement(String name, String namespace, String iri) { return startElement(name, namespace).writeElementText(iri).endElement(); } public StreamWriter writeIRIElement(String name, String iri) { return startElement(name).writeElementText(iri).endElement(); } public StreamWriter writeDate(String name, Date date) { return startElement(name).writeElementText(date).endElement(); } public StreamWriter writeDate(String name, String namespace, Date date) { return startElement(name, namespace).writeElementText(date).endElement(); } public StreamWriter writeDate(String name, String namespace, String prefix, Date date) { return startElement(name, namespace, prefix).writeElementText(date).endElement(); } public StreamWriter writeDate(String name, String date) { return startElement(name).writeElementText(date).endElement(); } public StreamWriter writeDate(String name, String namespace, String date) { return startElement(name, namespace).writeElementText(date).endElement(); } public StreamWriter writeDate(String name, String namespace, String prefix, String date) { return startElement(name, namespace, prefix).writeElementText(date).endElement(); } public StreamWriter startText(String name, String namespace, String prefix, Type type) { return startElement(name, namespace, prefix).writeAttribute("type", type != null ? type.name().toLowerCase() : "text"); } public StreamWriter startText(String name, String namespace, Type type) { return startElement(name, namespace).writeAttribute("type", type != null ? type.name().toLowerCase() : "text"); } public StreamWriter startText(String name, Type type) { return startElement(name).writeAttribute("type", type != null ? type.name().toLowerCase() : "text"); } public StreamWriter writeText(String name, String namespace, String prefix, Type type, String value) { return startText(name, namespace, prefix, type).writeElementText(value).endElement(); } public StreamWriter writeText(String name, String namespace, Type type, String value) { return startText(name, namespace, type).writeElementText(value).endElement(); } public StreamWriter writeText(String name, Type type, String value) { return startText(name, type).writeElementText(value).endElement(); } public StreamWriter startPerson(String name, String namespace, String prefix) { return startElement(name, namespace, prefix); } public StreamWriter startPerson(String name, String namespace) { return startElement(name, namespace); } public StreamWriter startPerson(String name) { return startElement(name); } public StreamWriter writePerson(String localname, String namespace, String prefix, String name, String email, String uri) { return startPerson(localname, namespace, prefix).writePersonName(name).writePersonEmail(email) .writePersonUri(uri).endPerson(); } public StreamWriter writePerson(String localname, String namespace, String name, String email, String uri) { return startPerson(localname, namespace).writePersonName(name).writePersonEmail(email).writePersonUri(uri) .endPerson(); } public StreamWriter writePerson(String localname, String name, String email, String uri) { return startPerson(localname).writePersonName(name).writePersonEmail(email).writePersonUri(uri).endPerson(); } public Appendable append(char c) throws IOException { return writeElementText(String.valueOf(c)); } public Appendable append(CharSequence csq, int start, int end) throws IOException { return append(csq.subSequence(start, end)); } public Appendable append(CharSequence csq) throws IOException { return writeElementText(csq.toString()); } public StreamWriter writeElementText(String format, Object... args) { new Formatter(this).format(format, args); return this; } }
7,156
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/Discover.java
package org.apache.abdera.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.Iterator; import java.util.List; @SuppressWarnings("unchecked") public final class Discover { private Discover() { } public static <T> T locate(String id, String defaultImpl, Object... args) { return (T)locate(id, defaultImpl, getLoader(), args); } public static <T> T locate(String id, String defaultImpl, ClassLoader loader, Object... args) { try { T instance = null; Iterable<T> items = locate(id, loader, args); for (T i : items) { instance = i; break; } if (instance == null) { instance = (T)load(loader, defaultImpl, false, args); } return instance; } catch (Throwable t) { throw new RuntimeException(t); } } private static ClassLoader getLoader() { return Thread.currentThread().getContextClassLoader(); } public static <T> Iterable<T> locate(String id, ClassLoader cl, Object... args) { return locate(id, false, cl, args); } public static <T> Iterable<T> locate(String id, boolean classesonly, ClassLoader cl, Object... args) { return locate(id, new DefaultLoader<T>(id, classesonly, args, cl)); } public static <T> Iterable<T> locate(String id, Object... args) { return locate(id, false, args); } public static <T> Iterable<T> locate(String id, boolean classesonly) { return locate(id, new DefaultLoader<T>(id, classesonly, null)); } public static <T> Iterable<T> locate(String id, boolean classesonly, Object... args) { return locate(id, new DefaultLoader<T>(id, classesonly, args)); } public static <T> Iterable<T> locate(String id, Iterable<T> loader) { List<T> impls = Collections.synchronizedList(new ArrayList<T>()); try { for (T instance : loader) { if (instance != null) impls.add(instance); } } catch (Throwable t) { t.printStackTrace(); } return impls; } public static class DefaultLoader<T> implements Iterable<T> { protected final ClassLoader loader; protected final String id; protected final Iterator<T> iterator; protected final Object[] args; public DefaultLoader(String id, boolean classesonly, Object[] args) { this(id, classesonly, args, getLoader()); } public DefaultLoader(String id, boolean classesonly, Object[] args, ClassLoader loader) { this.loader = loader != null ? loader : getLoader(); this.id = id; this.iterator = init(classesonly); this.args = args; } private Iterator<T> init(boolean classesonly) { try { List<Iterator<T>> list = new ArrayList<Iterator<T>>(); Enumeration<URL> e = locateResources("META-INF/services/" + id, //$NON-NLS-1$ loader, Discover.class); while (e.hasMoreElements()) { Iterator<T> i = new DefaultLoaderIterator<T>(loader, e.nextElement().openStream(), classesonly, args); list.add(i); } return new MultiIterator<T>(list); } catch (Throwable t) { throw new RuntimeException(t); } } public Iterator<T> iterator() { return iterator; } } public static class DefaultLoaderIterator<T> extends LineReaderLoaderIterator<T> { public DefaultLoaderIterator(ClassLoader cl, InputStream in, boolean classesonly, Object[] args) { super(cl, in, classesonly, args); } public T next() { try { if (!hasNext()) return null; return create(read(), args); } catch (Throwable t) { return null; } } protected T create(String spec, Object[] args) { try { return (T)load(cl, spec, classesonly, args); } catch (RuntimeException e) { throw e; } catch (Throwable t) { throw new RuntimeException(t); } } } private static <T> T load(ClassLoader loader, String spec, boolean classesonly, Object[] args) throws Exception { if (classesonly) { return (T)getClass(loader, spec); } else { Class<T> _class = getClass(loader, spec); Class<?>[] types = new Class<?>[args != null ? args.length : 0]; if (args != null) { for (int n = 0; n < args.length; n++) { types[n] = args[n].getClass(); } return _class.getConstructor(types).newInstance(args); } else { return _class.newInstance(); } } } private static <T> Class<T> getClass(ClassLoader loader, String spec) { Class<T> c = null; try { c = (Class<T>)loader.loadClass(spec); } catch (ClassNotFoundException e) { try { // try loading the class from the Discover class loader // if the loader failed. c = (Class<T>)Discover.class.getClassLoader().loadClass(spec); } catch (ClassNotFoundException e1) { // throw the original exception throw new RuntimeException(e); } } return c; } public static abstract class LineReaderLoaderIterator<T> extends LoaderIterator<T> { private BufferedReader buf = null; private String line = null; protected final Object[] args; protected final boolean classesonly; protected LineReaderLoaderIterator(ClassLoader cl, InputStream in, boolean classesonly, Object[] args) { super(cl); this.args = args; this.classesonly = classesonly; try { InputStreamReader reader = new InputStreamReader(in, "UTF-8"); buf = new BufferedReader(reader); line = readNext(); } catch (Throwable t) { throw new RuntimeException(t); } } public boolean hasNext() { return line != null; } protected String readNext() { try { String line = null; while ((line = buf.readLine()) != null) { line = line.trim(); if (!line.startsWith("#"))break; //$NON-NLS-1$ } return line; } catch (Throwable t) { throw new RuntimeException(t); } } protected String read() { String val = line; line = readNext(); return val; } } public static abstract class LoaderIterator<T> implements Iterator<T> { protected final ClassLoader cl; protected LoaderIterator(ClassLoader cl) { this.cl = cl; } public void remove() { } } public static URL locateResource(String id, ClassLoader loader, Class<?> callingClass) { URL url = loader.getResource(id); if (url == null && id.startsWith("/")) url = loader.getResource(id.substring(1)); if (url == null) url = locateResource(id, Discover.class.getClassLoader(), callingClass); if (url == null && callingClass != null) url = locateResource(id, callingClass.getClassLoader(), null); if (url == null) { url = callingClass.getResource(id); } if ((url == null) && id.startsWith("/")) { url = callingClass.getResource(id.substring(1)); } return url; } public static Enumeration<URL> locateResources(String id, ClassLoader loader, Class<?> callingClass) throws IOException { Enumeration<URL> urls = loader.getResources(id); if (urls == null && id.startsWith("/")) urls = loader.getResources(id.substring(1)); if (urls == null) urls = locateResources(id, Discover.class.getClassLoader(), callingClass); if (urls == null) urls = locateResources(id, callingClass.getClassLoader(), callingClass); return urls; } public static InputStream locateResourceAsStream(String resourceName, ClassLoader loader, Class<?> callingClass) { URL url = locateResource(resourceName, loader, callingClass); try { return (url != null) ? url.openStream() : null; } catch (IOException e) { return null; } } }
7,157
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/MultiIterator.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.util.Arrays; import java.util.Iterator; /** * Iterator implementation that wraps multiple iterators and invokes them in sequence. */ public final class MultiIterator<T> implements Iterator<T> { private Iterator<Iterator<T>> iterators; private Iterator<T> current; public MultiIterator(Iterable<Iterator<T>> i) { this(i.iterator()); } public MultiIterator(Iterator<T>... iterators) { this(Arrays.asList(iterators).iterator()); } public MultiIterator(Iterator<Iterator<T>> iterators) { this.iterators = iterators; current = selectCurrent(); } private Iterator<T> selectCurrent() { if (current == null) { if (iterators.hasNext()) current = iterators.next(); } else if (!current.hasNext() && iterators.hasNext()) { current = iterators.next(); } return current; } public boolean hasNext() { Iterator<T> c = selectCurrent(); return c != null ? c.hasNext() : false; } public T next() { if (hasNext()) return selectCurrent().next(); else return null; } public void remove() { throw new UnsupportedOperationException(); } }
7,158
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractNamedParser.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import org.apache.abdera.Abdera; import org.apache.abdera.parser.NamedParser; /** * Base abstract implementation of NamedParser */ public abstract class AbstractNamedParser extends AbstractParser implements NamedParser { protected final String name; protected final String[] formats; protected AbstractNamedParser(Abdera abdera, String name, String... formats) { super(abdera); this.name = name; this.formats = formats; } public String getName() { return name; } public String[] getInputFormats() { return formats; } public boolean parsesFormat(String mediatype) { for (String format : formats) { if (MimeTypeHelper.isMatch(format, mediatype)) return true; } return false; } }
7,159
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/ServiceUtil.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.util.ArrayList; import java.util.List; import org.apache.abdera.Abdera; import org.apache.abdera.factory.ExtensionFactory; import org.apache.abdera.factory.Factory; import org.apache.abdera.parser.Parser; import org.apache.abdera.parser.ParserFactory; import org.apache.abdera.writer.StreamWriter; import org.apache.abdera.writer.Writer; import org.apache.abdera.writer.WriterFactory; import org.apache.abdera.xpath.XPath; /** * Core utility methods that support Abdera's internal operation * * @deprecated */ public final class ServiceUtil implements Constants { ServiceUtil() { } /** * Utility method for returning an instance of the default Abdera XPath instance * * @deprecated */ public static XPath newXPathInstance(Abdera abdera) { return (XPath)Discover.locate(CONFIG_XPATH, abdera.getConfiguration().getConfigurationOption(CONFIG_XPATH, DEFAULT_XPATH), abdera); } /** * Utility method for returning an instance of the default Abdera Parser instance * * @deprecated */ public static Parser newParserInstance(Abdera abdera) { return (Parser)Discover.locate(CONFIG_PARSER, abdera.getConfiguration().getConfigurationOption(CONFIG_PARSER, DEFAULT_PARSER), abdera); } /** * Utility method for returning an instance of the defaul Abdera Factory instance * * @deprecated */ public static Factory newFactoryInstance(Abdera abdera) { return (Factory)Discover.locate(CONFIG_FACTORY, abdera.getConfiguration() .getConfigurationOption(CONFIG_FACTORY, DEFAULT_FACTORY), abdera); } /** * @deprecated */ public static ParserFactory newParserFactoryInstance(Abdera abdera) { return (ParserFactory)Discover.locate(CONFIG_PARSERFACTORY, abdera.getConfiguration() .getConfigurationOption(CONFIG_PARSERFACTORY, DEFAULT_PARSERFACTORY), abdera); } /** * @deprecated */ public static WriterFactory newWriterFactoryInstance(Abdera abdera) { return (WriterFactory)Discover.locate(CONFIG_WRITERFACTORY, abdera.getConfiguration() .getConfigurationOption(CONFIG_WRITERFACTORY, DEFAULT_WRITERFACTORY), abdera); } /** * @deprecated */ public static Writer newWriterInstance(Abdera abdera) { return (Writer)Discover.locate(CONFIG_WRITER, abdera.getConfiguration().getConfigurationOption(CONFIG_WRITER, DEFAULT_WRITER), abdera); } /** * @deprecated */ public static StreamWriter newStreamWriterInstance(Abdera abdera) { return (StreamWriter)Discover.locate(CONFIG_STREAMWRITER, abdera.getConfiguration() .getConfigurationOption(CONFIG_STREAMWRITER, DEFAULT_STREAMWRITER), abdera); } /** * @deprecated */ protected static synchronized List<ExtensionFactory> loadExtensionFactories() { List<ExtensionFactory> list = new ArrayList<ExtensionFactory>(); Iterable<ExtensionFactory> factories = Discover.locate("org.apache.abdera.factory.ExtensionFactory"); for (ExtensionFactory factory : factories) list.add(factory); return list; } /** * @deprecated */ public static synchronized <T> Iterable<T> loadimpls(String sid) { return Discover.locate(sid); } /** * @deprecated */ public static synchronized <T> Iterable<T> loadimpls(String sid, boolean classesonly) { return Discover.locate(sid, classesonly); } /** * Returns a new instance of the identified object class. This will use the Abdera configuration mechanism to look * up the implementation class for the specified id. Several places will be checked: the abdera.properties file, the * /META-INF/services directory, and the System properties. If no instance is configured, the default class name * will be used. Returns null if no instance can be created. * * @deprecated */ public static Object newInstance(String id, String _default, Abdera abdera) { return Discover.locate(id, _default, abdera); } /** * Returns a new instance of the identified object class. This will use the Abdera configuration mechanism to look * up the implementation class for the specified id. Several places will be checked: the abdera.properties file, the * /META-INF/services directory, and the System properties. If no instance is configured, the default class name * will be used. Returns null if no instance can be created. * * @deprecated */ public static Object newInstance(String id, String _default, Object... args) { return Discover.locate(id, _default, args); } }
7,160
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/MimeTypeParseException.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; /** * An alternative to JAF's MimeTypeParseException that extends RuntimeException so we don't have to explicitly catch it * everywhere. */ public class MimeTypeParseException extends RuntimeException { private static final long serialVersionUID = -8706972350332367299L; public MimeTypeParseException(javax.activation.MimeTypeParseException cause) { super(cause); } }
7,161
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractXPath.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.abdera.model.Base; import org.apache.abdera.xpath.XPath; import org.apache.abdera.xpath.XPathException; /** * Abstract base implementation of XPath */ public abstract class AbstractXPath implements XPath { private final Map<String, String> namespaces; protected AbstractXPath() { this(null); } protected AbstractXPath(Map<String, String> defaultNamespaces) { namespaces = (defaultNamespaces != null) ? defaultNamespaces : initDefaultNamespaces(); } protected Map<String, String> initDefaultNamespaces() { Map<String, String> namespaces = new HashMap<String, String>(); namespaces.put("a", Constants.ATOM_NS); namespaces.put("app", Constants.APP_NS); namespaces.put("xhtml", Constants.XHTML_NS); return namespaces; } public Map<String, String> getDefaultNamespaces() { return new HashMap<String, String>(namespaces); } @SuppressWarnings("unchecked") public List selectNodes(String path, Base base) throws XPathException { return selectNodes(path, base, getDefaultNamespaces()); } public Object selectSingleNode(String path, Base base) throws XPathException { return selectSingleNode(path, base, getDefaultNamespaces()); } public Object evaluate(String path, Base base) throws XPathException { return evaluate(path, base, getDefaultNamespaces()); } public String valueOf(String path, Base base) throws XPathException { return valueOf(path, base, getDefaultNamespaces()); } public boolean booleanValueOf(String path, Base base) throws XPathException { return booleanValueOf(path, base, getDefaultNamespaces()); } public Number numericValueOf(String path, Base base) throws XPathException { return numericValueOf(path, base, getDefaultNamespaces()); } }
7,162
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/AbstractNamedWriter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import org.apache.abdera.writer.NamedWriter; /** * Base abstract implementation of NamedWriter */ public abstract class AbstractNamedWriter extends AbstractWriter implements NamedWriter { protected final String name; protected final String[] formats; protected AbstractNamedWriter(String name, String... formats) { this.name = name; this.formats = formats; } public String getName() { return name; } public String[] getOutputFormats() { return formats; } public boolean outputsFormat(String mediatype) { for (String format : formats) { if (MimeTypeHelper.isMatch(format, mediatype)) return true; } return false; } }
7,163
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/Version.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; public abstract interface Version { public static final String APP_NAME = "Abdera"; public static final String VERSION = "v1.0-SNAPSHOT"; public static final String URI = "http://abdera.apache.org"; }
7,164
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/XmlRestrictedCharReader.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; import org.apache.abdera.i18n.text.io.FilteredCharReader; import org.apache.abdera.util.XmlUtil.XMLVersion; /** * A reader implementation that filters out characters that are not allowed in XML 1.0 or XML 1.1 documents. The default * xMLVersion is to assume XML 1.0. By default, invalid characters are simply removed from the stream. Alternatively, a * replacement character can be provided so long as it is a valid XML character itself. */ public class XmlRestrictedCharReader extends FilteredCharReader { /** * The XMLVersion determines which set of restrictions to apply depending on the XML version being parsed */ public XmlRestrictedCharReader(InputStream in) { this(new InputStreamReader(in)); } public XmlRestrictedCharReader(InputStream in, String charset) throws UnsupportedEncodingException { this(new InputStreamReader(in, charset)); } public XmlRestrictedCharReader(InputStream in, XMLVersion version) { this(new InputStreamReader(in), version); } public XmlRestrictedCharReader(InputStream in, String charset, XMLVersion version) throws UnsupportedEncodingException { this(new InputStreamReader(in, charset), version); } public XmlRestrictedCharReader(InputStream in, char replacement) { this(new InputStreamReader(in), replacement); } public XmlRestrictedCharReader(InputStream in, String charset, char replacement) throws UnsupportedEncodingException { this(new InputStreamReader(in, charset), replacement); } public XmlRestrictedCharReader(InputStream in, XMLVersion version, char replacement) { this(new InputStreamReader(in), version, replacement); } public XmlRestrictedCharReader(InputStream in, String charset, XMLVersion version, char replacement) throws UnsupportedEncodingException { this(new InputStreamReader(in, charset), version, replacement); } public XmlRestrictedCharReader(Reader in) { this(in, XMLVersion.XML10, (char)0); } public XmlRestrictedCharReader(Reader in, XMLVersion version) { this(in, version, (char)0); } public XmlRestrictedCharReader(Reader in, char replacement) { this(in, XMLVersion.XML10, replacement); } public XmlRestrictedCharReader(Reader in, XMLVersion version, char replacement) { super(in, version.filter(), replacement); } }
7,165
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/Constants.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util; import javax.xml.namespace.QName; public interface Constants { public static final String CONFIG_PARSER = "org.apache.abdera.parser.Parser"; public static final String CONFIG_FACTORY = "org.apache.abdera.factory.Factory"; public static final String CONFIG_XPATH = "org.apache.abdera.xpath.XPath"; public static final String CONFIG_PARSERFACTORY = "org.apache.abdera.parser.ParserFactory"; public static final String CONFIG_WRITERFACTORY = "org.apache.abdera.writer.WriterFactory"; public static final String CONFIG_WRITER = "org.apache.abdera.writer.Writer"; public static final String CONFIG_STREAMWRITER = "org.apache.abdera.writer.StreamWriter"; public static final String DEFAULT_PARSER = "org.apache.abdera.parser.stax.FOMParser"; public static final String DEFAULT_FACTORY = "org.apache.abdera.parser.stax.FOMFactory"; public static final String DEFAULT_XPATH = "org.apache.abdera.parser.stax.FOMXPath"; public static final String DEFAULT_PARSERFACTORY = "org.apache.abdera.parser.stax.FOMParserFactory"; public static final String DEFAULT_WRITERFACTORY = "org.apache.abdera.parser.stax.FOMWriterFactory"; public static final String DEFAULT_WRITER = "org.apache.abdera.parser.stax.FOMWriter"; public static final String DEFAULT_STREAMWRITER = "org.apache.abdera.parser.stax.StaxStreamWriter"; public static final String NAMED_WRITER = "org.apache.abdera.writer.NamedWriter"; public static final String NAMED_PARSER = "org.apache.abdera.parser.NamedParser"; public static final String STREAM_WRITER = "org.apache.abdera.writer.StreamWriter"; public static final String PREFIX = ""; public static final String APP_PREFIX = ""; public static final String CONTROL_PREFIX = ""; public static final String ATOM_MEDIA_TYPE = "application/atom+xml"; public static final String FEED_MEDIA_TYPE = ATOM_MEDIA_TYPE + ";type=feed"; public static final String ENTRY_MEDIA_TYPE = ATOM_MEDIA_TYPE + ";type=entry"; public static final String APP_MEDIA_TYPE = "application/atomsvc+xml"; public static final String XML_MEDIA_TYPE = "application/xml"; public static final String CAT_MEDIA_TYPE = "application/atomcat+xml"; public static final String MULTIPART_RELATED_TYPE = "Multipart/Related"; public static final String ATOM_NS = "http://www.w3.org/2005/Atom"; public static final String APP_NS = "http://www.w3.org/2007/app"; /** @deprecated Use Constants.APP_NS instead **/ public static final String APP_NS_PRE_RFC = "http://purl.org/atom/app#"; /** @deprecated **/ public static final String CONTROL_NS = "http://example.net/appns/"; public static final String XML_NS = "http://www.w3.org/XML/1998/namespace"; public static final String XHTML_NS = "http://www.w3.org/1999/xhtml"; public static final String LN_ACCEPT = "accept"; public static final String LN_CLASS = "class"; public static final String LN_DIV = "div"; public static final String LN_FEED = "feed"; public static final String LN_ENTRY = "entry"; public static final String LN_SERVICE = "service"; public static final String LN_AUTHOR = "author"; public static final String LN_CATEGORY = "category"; public static final String LN_CONTENT = "content"; public static final String LN_CONTRIBUTOR = "contributor"; public static final String LN_GENERATOR = "generator"; public static final String LN_ICON = "icon"; public static final String LN_ID = "id"; public static final String LN_LOGO = "logo"; public static final String LN_LINK = "link"; public static final String LN_PUBLISHED = "published"; public static final String LN_RIGHTS = "rights"; public static final String LN_SOURCE = "source"; public static final String LN_SUBTITLE = "subtitle"; public static final String LN_SUMMARY = "summary"; public static final String LN_TITLE = "title"; public static final String LN_UPDATED = "updated"; public static final String LN_EDITED = "edited"; public static final String LN_TERM = "term"; public static final String LN_SCHEME = "scheme"; public static final String LN_LABEL = "label"; public static final String LN_HREF = "href"; public static final String LN_LANG = "lang"; public static final String LN_BASE = "base"; public static final String LN_SPACE = "space"; public static final String LN_URI = "uri"; public static final String LN_VERSION = "version"; public static final String LN_REL = "rel"; public static final String LN_TYPE = "type"; public static final String LN_HREFLANG = "hreflang"; public static final String LN_LENGTH = "length"; public static final String LN_NAME = "name"; public static final String LN_EMAIL = "email"; public static final String LN_WORKSPACE = "workspace"; public static final String LN_SRC = "src"; public static final String LN_COLLECTION = "collection"; public static final String LN_CONTROL = "control"; public static final String LN_DRAFT = "draft"; public static final String LN_CATEGORIES = "categories"; public static final String LN_FIXED = "fixed"; public static final String LN_ALTERNATE = "alternate"; public static final String LN_ALTERNATE_MULTIPART_RELATED = "multipart-related"; public static final QName DIV = new QName(XHTML_NS, LN_DIV, ""); public static final QName CONTROL = new QName(APP_NS, LN_CONTROL, "app"); public static final QName DRAFT = new QName(APP_NS, LN_DRAFT, "app"); public static final QName CATEGORIES = new QName(APP_NS, LN_CATEGORIES, APP_PREFIX); public static final QName SERVICE = new QName(APP_NS, LN_SERVICE, APP_PREFIX); public static final QName EDITED = new QName(APP_NS, LN_EDITED, "app"); public static final QName ACCEPT = new QName(APP_NS, LN_ACCEPT, APP_PREFIX); public static final QName WORKSPACE = new QName(APP_NS, LN_WORKSPACE, APP_PREFIX); public static final QName COLLECTION = new QName(APP_NS, LN_COLLECTION, APP_PREFIX); /** @deprecated **/ public static final QName PRE_RFC_CONTROL = new QName(APP_NS_PRE_RFC, LN_CONTROL, "app"); /** @deprecated **/ public static final QName PRE_RFC_DRAFT = new QName(APP_NS_PRE_RFC, LN_DRAFT, "app"); /** @deprecated **/ public static final QName PRE_RFC_CATEGORIES = new QName(APP_NS_PRE_RFC, LN_CATEGORIES, APP_PREFIX); /** @deprecated **/ public static final QName PRE_RFC_SERVICE = new QName(APP_NS_PRE_RFC, LN_SERVICE, APP_PREFIX); /** @deprecated **/ public static final QName PRE_RFC_EDITED = new QName(APP_NS_PRE_RFC, LN_EDITED, "app"); /** @deprecated **/ public static final QName PRE_RFC_ACCEPT = new QName(APP_NS_PRE_RFC, LN_ACCEPT, APP_PREFIX); /** @deprecated **/ public static final QName PRE_RFC_WORKSPACE = new QName(APP_NS_PRE_RFC, LN_WORKSPACE, APP_PREFIX); /** @deprecated **/ public static final QName PRE_RFC_COLLECTION = new QName(APP_NS_PRE_RFC, LN_COLLECTION, APP_PREFIX); public static final QName FEED = new QName(ATOM_NS, LN_FEED, PREFIX); public static final QName AUTHOR = new QName(ATOM_NS, LN_AUTHOR, PREFIX); public static final QName CATEGORY = new QName(ATOM_NS, LN_CATEGORY, PREFIX); public static final QName CONTENT = new QName(ATOM_NS, LN_CONTENT, PREFIX); public static final QName CONTRIBUTOR = new QName(ATOM_NS, LN_CONTRIBUTOR, PREFIX); public static final QName GENERATOR = new QName(ATOM_NS, LN_GENERATOR, PREFIX); public static final QName ICON = new QName(ATOM_NS, LN_ICON, PREFIX); public static final QName ID = new QName(ATOM_NS, LN_ID, PREFIX); public static final QName LOGO = new QName(ATOM_NS, LN_LOGO, PREFIX); public static final QName LINK = new QName(ATOM_NS, LN_LINK, PREFIX); public static final QName PUBLISHED = new QName(ATOM_NS, LN_PUBLISHED, PREFIX); public static final QName RIGHTS = new QName(ATOM_NS, LN_RIGHTS, PREFIX); public static final QName SOURCE = new QName(ATOM_NS, LN_SOURCE, PREFIX); public static final QName SUBTITLE = new QName(ATOM_NS, LN_SUBTITLE, PREFIX); public static final QName SUMMARY = new QName(ATOM_NS, LN_SUMMARY, PREFIX); public static final QName TITLE = new QName(ATOM_NS, LN_TITLE, PREFIX); public static final QName PREFIXED_TITLE = new QName(ATOM_NS, LN_TITLE, "atom"); public static final QName UPDATED = new QName(ATOM_NS, LN_UPDATED, PREFIX); public static final QName ENTRY = new QName(ATOM_NS, LN_ENTRY, PREFIX); public static final QName TERM = new QName(LN_TERM); public static final QName SCHEME = new QName(LN_SCHEME); public static final QName FIXED = new QName(LN_FIXED); public static final QName LABEL = new QName(LN_LABEL); public static final QName ATITLE = new QName(LN_TITLE); public static final QName HREF = new QName(LN_HREF); public static final QName LANG = new QName(XML_NS, LN_LANG, "xml"); public static final QName BASE = new QName(XML_NS, LN_BASE, "xml"); public static final QName SPACE = new QName(XML_NS, LN_SPACE, "xml"); public static final QName AURI = new QName(LN_URI); public static final QName VERSION = new QName(LN_VERSION); public static final QName REL = new QName(LN_REL); public static final QName TYPE = new QName(LN_TYPE); public static final QName HREFLANG = new QName(LN_HREFLANG); public static final QName LENGTH = new QName(LN_LENGTH); public static final QName NAME = new QName(ATOM_NS, LN_NAME, PREFIX); public static final QName EMAIL = new QName(ATOM_NS, LN_EMAIL, PREFIX); public static final QName URI = new QName(ATOM_NS, LN_URI, PREFIX); public static final QName SRC = new QName(LN_SRC); public static final QName AID = new QName(LN_ID); public static final QName CLASS = new QName(LN_CLASS); public static final QName ALTERNATE = new QName(LN_ALTERNATE); public static final String TEXT = "text"; public static final String HTML = "html"; public static final String XHTML = "xhtml"; public static final String XML = "xml"; public static final String YES = "yes"; public static final String NO = "no"; }
7,166
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/NonOpParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import javax.xml.namespace.QName; public class NonOpParseFilter extends AbstractParseFilter { private static final long serialVersionUID = -1895875728388522456L; public boolean acceptable(QName qname) { return true; } public boolean acceptable(QName qname, QName attribute) { return true; } }
7,167
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/WhiteListParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import javax.xml.namespace.QName; /** * WhiteList Implementation of ParseFilter. Only the QNames listed will be considered acceptable */ public class WhiteListParseFilter extends AbstractListParseFilter { private static final long serialVersionUID = -2126524829459798481L; private final boolean listAttributesExplicitly; public WhiteListParseFilter() { this(false); } /** * If listAttributesExplicity == true, attributes MUST be whitelisted independently of the elements on which they * appear, otherwise, all attributes will automatically be considered acceptable if the containing element is * considered acceptable. */ public WhiteListParseFilter(boolean listAttributesExplicitly) { this.listAttributesExplicitly = listAttributesExplicitly; } public boolean acceptable(QName qname) { return contains(qname); } public boolean acceptable(QName qname, QName attribute) { return (listAttributesExplicitly) ? contains(qname, attribute) && acceptable(qname) : acceptable(qname); } }
7,168
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/AbstractListParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.abdera.filter.ListParseFilter; /** * ParseFilter's determine which elements and attributes are acceptable within a parsed document. They are set via the * ParserOptions.setParseFilter method. */ public abstract class AbstractListParseFilter extends AbstractParseFilter implements Cloneable, ListParseFilter { private static final long serialVersionUID = -758691949740569208L; private transient List<QName> qnames = new ArrayList<QName>(); private transient Map<QName, List<QName>> attributes = new HashMap<QName, List<QName>>(); public Object clone() throws CloneNotSupportedException { return super.clone(); } public ListParseFilter add(QName qname) { synchronized (qnames) { if (!contains(qname)) qnames.add(qname); } return this; } public boolean contains(QName qname) { synchronized (qnames) { return qnames.contains(qname); } } public ListParseFilter add(QName parent, QName attribute) { synchronized (attributes) { if (attributes.containsKey(parent)) { List<QName> attrs = attributes.get(parent); if (!attrs.contains(attribute)) attrs.add(attribute); } else { List<QName> attrs = new ArrayList<QName>(); attrs.add(attribute); attributes.put(parent, attrs); } } return this; } public boolean contains(QName qname, QName attribute) { synchronized (attributes) { if (attributes.containsKey(qname)) { List<QName> attrs = attributes.get(qname); return attrs.contains(attribute); } else { return false; } } } public abstract boolean acceptable(QName qname); public abstract boolean acceptable(QName qname, QName attribute); private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); // qnames field assert qnames != null; out.writeInt(qnames.size()); for (QName q : qnames) { out.writeObject(q); } // attributes field assert attributes != null; out.writeInt(attributes.size()); for (Map.Entry<QName, List<QName>> e : attributes.entrySet()) { out.writeObject(e.getKey()); final List<QName> v = e.getValue(); assert v != null; out.writeInt(v.size()); for (QName q : v) { out.writeObject(q); } } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // qnames field final int qnamesSize = in.readInt(); qnames = new ArrayList<QName>(qnamesSize); for (int i = 0; i < qnamesSize; i++) { qnames.add((QName)in.readObject()); } // attributes field final int attributesSize = in.readInt(); attributes = new HashMap<QName, List<QName>>(attributesSize); for (int i = 0; i < attributesSize; i++) { final QName k = (QName)in.readObject(); final int vSize = in.readInt(); final List<QName> v = new ArrayList<QName>(vSize); for (int j = 0; j < vSize; j++) { v.add((QName)in.readObject()); } attributes.put(k, v); } } }
7,169
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/AbstractParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import org.apache.abdera.filter.ParseFilter; public abstract class AbstractParseFilter implements ParseFilter { private static final long serialVersionUID = -1866308276050148524L; private static final byte COMMENTS = 1; private static final byte WHITESPACE = 2; private static final byte PI = 4; protected byte flags = 0; private void toggle(boolean s, byte flag) { if (s) flags |= flag; else flags &= ~flag; } private boolean check(byte flag) { return (flags & flag) == flag; } public ParseFilter setIgnoreComments(boolean ignore) { toggle(ignore, COMMENTS); return this; } public ParseFilter setIgnoreWhitespace(boolean ignore) { toggle(ignore, (byte)WHITESPACE); return this; } public ParseFilter setIgnoreProcessingInstructions(boolean ignore) { toggle(ignore, (byte)PI); return this; } public boolean getIgnoreComments() { return check(COMMENTS); } public boolean getIgnoreProcessingInstructions() { return check(PI); } public boolean getIgnoreWhitespace() { return check(WHITESPACE); } public Object clone() throws CloneNotSupportedException { return super.clone(); } }
7,170
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/CompoundParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import javax.xml.namespace.QName; import org.apache.abdera.filter.ParseFilter; /** * <p> * A simple compound parse filter that allows us to apply multiple parse filters to a single parse operation. * </p> * * <pre> * CompoundParseFilter filter = * new CompoundParseFilter(CompoundParseFilter.Condition.ACCEPTABLE_TO_ALL, new SafeContentWhiteListParseFilter(), * new MyWhiteListParseFilter(), new MySomeOtherKindOfParseFilter()); * options.setParseFilter(filter); * </pre> */ public class CompoundParseFilter extends AbstractParseFilter implements ParseFilter { private static final long serialVersionUID = -7871289035422204698L; public enum Condition { ACCEPTABLE_TO_ALL, ACCEPTABLE_TO_ANY, UNACCEPTABLE_TO_ALL, UNACCEPTABLE_TO_ANY; byte evaluate(boolean b) { if (b) { switch (this) { case ACCEPTABLE_TO_ANY: return 1; case UNACCEPTABLE_TO_ALL: return -1; } } else { switch (this) { case ACCEPTABLE_TO_ALL: return -1; case UNACCEPTABLE_TO_ANY: return 1; } } return 0; } }; protected final Condition condition; protected final ParseFilter[] filters; public CompoundParseFilter(Condition condition, ParseFilter... filters) { this.filters = filters; this.condition = condition; } public CompoundParseFilter(ParseFilter... filters) { this(Condition.ACCEPTABLE_TO_ANY, filters); } private ParseFilter[] getFilters() { return filters; } public boolean acceptable(QName qname) { for (ParseFilter filter : getFilters()) { switch (condition.evaluate(filter.acceptable(qname))) { case 1: return true; case -1: return false; } } return true; } public boolean acceptable(QName qname, QName attribute) { for (ParseFilter filter : getFilters()) { switch (condition.evaluate(filter.acceptable(qname, attribute))) { case 1: return true; case -1: return false; } } return true; } public Object clone() throws CloneNotSupportedException { return super.clone(); } }
7,171
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/SafeContentWhiteListParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import javax.xml.namespace.QName; import org.apache.abdera.filter.ParseFilter; import org.apache.abdera.util.Constants; public class SafeContentWhiteListParseFilter extends AbstractParseFilter implements ParseFilter { private static final long serialVersionUID = -4802312485715572721L; private static enum xhtml_elements { a, abbr, acronym, address, area, b, bdo, big, blockquote, br, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd, label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var }; private static enum xhtml_attributes { abbr, accept, accept_charset, accesskey, action, align, alt, axis, border, cellpadding, cellspacing, CHAR, charoff, charset, checked, cite, CLASS, clear, cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, FOR, frame, headers, height, href, hreflang, hspace, id, ismap, label, lang, longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap, prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape, size, span, src, start, summary, tabindex, target, title, type, usemap, valign, value, vspace, width; static String fix(String v) { if (v.equalsIgnoreCase("char")) return "CHAR"; if (v.equalsIgnoreCase("for")) return "FOR"; if (v.equalsIgnoreCase("class")) return "CLASS"; return v.toLowerCase(); } }; public boolean acceptable(QName qname) { if (qname.getNamespaceURI().equals(Constants.XHTML_NS)) { try { xhtml_elements.valueOf(qname.getLocalPart().toLowerCase()); return true; } catch (Exception e) { } return false; } else { return true; } } public boolean acceptable(QName qname, QName attribute) { if (qname.getNamespaceURI().equals(Constants.XHTML_NS)) { try { xhtml_attributes.valueOf(xhtml_attributes.fix(attribute.getLocalPart().toLowerCase())); return true; } catch (Exception e) { } return false; } else { return true; } } public Object clone() throws CloneNotSupportedException { return super.clone(); } }
7,172
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/util
Create_ds/abdera/core/src/main/java/org/apache/abdera/util/filter/BlackListParseFilter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.util.filter; import javax.xml.namespace.QName; /** * BlackList Implementation of ParseFilter. The QNames listed will be considered unacceptable. In general, black list * based filtering is problematic, at best, due largely to the fact that it's easier to define safe subsets of elements * than it is to define unsafe subsets. */ public class BlackListParseFilter extends AbstractListParseFilter { private static final long serialVersionUID = -8428373486568649179L; public boolean acceptable(QName qname) { return !contains(qname); } public boolean acceptable(QName qname, QName attribute) { return !contains(qname, attribute); } }
7,173
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/Message.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol; import java.util.Date; import javax.activation.MimeType; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.protocol.util.ProtocolConstants; /** * A protocol message. This is used as the basis for both request and response objects in order to provide a consistent * interface. */ public interface Message extends ProtocolConstants { /** * Get the value of the specified header */ String getHeader(String name); /** * Get the decoded value of a RFC 2047 header */ String getDecodedHeader(String name); /** * Return multiple values for the specified header */ Object[] getHeaders(String name); /** * Return multiple decoded values for the specified header */ String[] getDecodedHeaders(String name); /** * Return a listing of header names */ String[] getHeaderNames(); /** * Return the value of the Cache-Control header */ String getCacheControl(); /** * Return the value of the Slug header */ String getSlug(); /** * Return the value of the Content-Type header */ MimeType getContentType(); /** * Return the value of the Content-Location header */ IRI getContentLocation(); /** * Return the value of the Content-Language header */ String getContentLanguage(); /** * Return the value of a Date header */ Date getDateHeader(String name); /** * Return the maximum-age as specified by the Cache-Control header */ long getMaxAge(); /** * Return true if the Cache-Control header contains no-cache */ boolean isNoCache(); /** * Return true if the Cache-Control header contains no-store */ boolean isNoStore(); /** * Return true if the Cache-Control header contains no-transform */ boolean isNoTransform(); }
7,174
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/Response.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol; import java.util.Date; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.util.EntityTag; /** * Base interface for an Atompub protocol response message */ public interface Response extends Message { /** * High level classifications of response types */ public static enum ResponseType { SUCCESS, REDIRECTION, CLIENT_ERROR, SERVER_ERROR, UNKNOWN; public static ResponseType select(int status) { if (status >= 200 && status < 300) return SUCCESS; if (status >= 300 && status < 400) return REDIRECTION; if (status >= 400 && status < 500) return CLIENT_ERROR; if (status >= 500 && status < 600) return SERVER_ERROR; return UNKNOWN; } } /** * Get the Entity Tag returned by the server */ EntityTag getEntityTag(); /** * Get the response type classification */ ResponseType getType(); /** * Get the specific response status code */ int getStatus(); /** * Get the response status text */ String getStatusText(); /** * Get the value of the Last-Modified response header */ Date getLastModified(); /** * Get the value of the Content-Length response header */ long getContentLength(); /** * Get the value of the Allow response header */ String getAllow(); /** * Get the value of the Location response header */ IRI getLocation(); /** * True if the Cache-Control header specifies the private directive */ boolean isPrivate(); /** * True if the Cache-Control header specified the public directive */ boolean isPublic(); /** * True if the Cache-Control header specifies the must-revalidate directive */ boolean isMustRevalidate(); /** * True if the Cache-Control header specifies the proxy-revalidate directive */ boolean isProxyRevalidate(); long getSMaxAge(); /** * Get the age of this response as specified by the server */ long getAge(); /** * Get the date/time this response expires */ Date getExpires(); String[] getNoCacheHeaders(); String[] getPrivateHeaders(); }
7,175
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/Resolver.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol; /** * The Resolver interface is a utility class used to resolve objects based on a request. It is used internally by Abdera * as the basis for Target and Subject resolvers. */ public interface Resolver<T> { T resolve(Request request); }
7,176
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/ItemManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol; /** * ItemManager is an internal utility class that provides a simple get/release interface. It is used primarily to * control access to pooled resources. */ public interface ItemManager<T> { /** * Get an item based on the specified request */ T get(Request request); /** * Release an item */ void release(T item); }
7,177
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/EntityProvider.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol; import java.util.Date; import org.apache.abdera.util.EntityTag; import org.apache.abdera.writer.StreamWriter; /** * An EntityProvider is used to serialize entities using the StreamWriter interface. The EntityProvider interface can be * implemented by applications to provide an efficient means of serializing non-FOM objects to Atom/XML. */ public interface EntityProvider { /** * Write to the specified StreamWriter */ void writeTo(StreamWriter sw); /** * True if the serialization is repeatable. */ boolean isRepeatable(); /** * Return the mime content type of the serialized entity */ String getContentType(); /** * Return the EntityTag of the entity, */ EntityTag getEntityTag(); /** * Return the Last-Modified date of the entity */ Date getLastModified(); }
7,178
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/Request.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol; import java.util.Date; import org.apache.abdera.util.EntityTag; /** * A protocol request. This is used as a base for both server and client requests */ public interface Request extends Message { /** * Get the value of the Accept header */ String getAccept(); /** * Get the value of the Accept-Charset header */ String getAcceptCharset(); /** * Get the value of the Accept-Encoding header */ String getAcceptEncoding(); /** * Get the value of the Accept-Language header */ String getAcceptLanguage(); /** * Get the value of the Authorization header */ String getAuthorization(); /** * Get a listing of Etags from the If-Match header */ EntityTag[] getIfMatch(); /** * Get the value of the If-Modified-Since header */ Date getIfModifiedSince(); /** * Get a listing of ETags from the If-None-Match header */ EntityTag[] getIfNoneMatch(); /** * Get the value of the If-Unmodified-Since header */ Date getIfUnmodifiedSince(); /** * Get the max-stale value from the Cache-Control header */ long getMaxStale(); /** * Get the min-fresh value from the Cache-Control header */ long getMinFresh(); /** * True if the only-if-cached directive is set in the Cache-Control header */ boolean isOnlyIfCached(); }
7,179
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/AbstractEntityProvider.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import java.util.Date; import org.apache.abdera.protocol.EntityProvider; import org.apache.abdera.util.EntityTag; public abstract class AbstractEntityProvider implements EntityProvider { public String getContentType() { return "application/xml"; } public EntityTag getEntityTag() { return null; } public Date getLastModified() { return null; } }
7,180
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import javax.activation.MimeType; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.i18n.text.Rfc2047Helper; import org.apache.abdera.i18n.text.UrlEncoding; import org.apache.abdera.protocol.Message; /** * Root impl for Message interface impls. This is provided solely as a way of keeping the interface and impl's * consistent across the Request and Response objects. */ public abstract class AbstractMessage implements Message { protected int flags = 0; protected long max_age = -1; public String getCacheControl() { return getHeader("Cache-Control"); } public String getContentLanguage() { return getHeader("Content-Language"); } public IRI getContentLocation() { String value = getHeader("Content-Location"); return (value != null) ? new IRI(value) : null; } public MimeType getContentType() { try { String value = getHeader("Content-Type"); return (value != null) ? new MimeType(value) : null; } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } } public String getDecodedHeader(String header) { return UrlEncoding.decode(Rfc2047Helper.decode(getHeader(header))); } public String[] getDecodedHeaders(String header) { Object[] headers = getHeaders(header); for (int n = 0; n < headers.length; n++) { headers[n] = UrlEncoding.decode(Rfc2047Helper.decode(headers[n].toString())); } return (String[])headers; } public String getSlug() { return getDecodedHeader("Slug"); } protected boolean check(int flag) { return (flags & flag) == flag; } protected void toggle(boolean val, int flag) { if (val) flags |= flag; else flags &= ~flag; } public boolean isNoCache() { if (check(NOCACHE)) return true; Object[] pragma = getHeaders("Pragma"); if (pragma != null) { for (Object o : pragma) { String s = (String)o; if (s.equalsIgnoreCase("no-cache")) { return true; } } } return false; } public boolean isNoStore() { return check(NOSTORE); } public boolean isNoTransform() { return check(NOTRANSFORM); } public long getMaxAge() { return max_age; } }
7,181
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/PoolManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import java.util.Stack; import org.apache.abdera.protocol.ItemManager; /** * Implements a simple pool manager. By default, an upper limit to the pool is set at 25 entries. New items can always * be created, but if more than 25 entries are released back to the pool, the extras are discarded. Items added to the * stack should never maintain any kind of state as it is entirely possible that different threads will be grabbing * items from the pool */ public abstract class PoolManager<T> implements ItemManager<T> { private static final int DEFAULT_SIZE = 25; private final Stack<T> pool; protected PoolManager() { this(DEFAULT_SIZE); } protected PoolManager(int max) { this.pool = initStack(max); } private Stack<T> initStack(final int max) { return new Stack<T>() { private static final long serialVersionUID = -6647024253014661104L; @Override public T push(T item) { T obj = super.push(item); if (this.size() > max) this.removeElementAt(0); return obj; } }; } protected synchronized T getInstance() { return (!pool.empty()) ? pool.pop() : internalNewInstance(); } public synchronized void release(T t) { if (t == null || pool.contains(t)) return; pool.push(t); } protected abstract T internalNewInstance(); }
7,182
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.abdera.i18n.text.io.CompressionUtil; /** * Provides parsing and properly handling of the HTTP Cache-Control header. */ public class CacheControlUtil { private static enum Idempotent { GET, HEAD, OPTIONS } /** * Idempotent methods are handled differently in caches than other methods */ public static boolean isIdempotent(String method) { try { Idempotent.valueOf(method.toUpperCase()); return true; } catch (Exception e) { return false; } } private static long value(String val) { return (val != null) ? Long.parseLong(val) : -1; } private static void append(StringBuilder buf, String value) { if (buf.length() > 0) buf.append(", "); buf.append(value); } /** * Construct the Cache-Control header from info in the request object */ public static String buildCacheControl(AbstractRequest request) { StringBuilder buf = new StringBuilder(); if (request.isNoCache()) append(buf, "no-cache"); if (request.isNoStore()) append(buf, "no-store"); if (request.isNoTransform()) append(buf, "no-transform"); if (request.isOnlyIfCached()) append(buf, "only-if-cached"); if (request.getMaxAge() != -1) append(buf, "max-age=" + request.getMaxAge()); if (request.getMaxStale() != -1) append(buf, "max-stale=" + request.getMaxStale()); if (request.getMinFresh() != -1) append(buf, "min-fresh=" + request.getMinFresh()); return buf.toString(); } /** * Parse the Cache-Control header */ public static void parseCacheControl(String cc, AbstractRequest request) { if (cc == null || cc.length() == 0) return; CacheControlParser parser = new CacheControlParser(cc); request.setNoCache(false); request.setNoStore(false); request.setNoTransform(false); request.setOnlyIfCached(false); request.setMaxAge(-1); request.setMaxStale(-1); request.setMinFresh(-1); for (Directive directive : parser) { switch (directive) { case NOCACHE: request.setNoCache(true); break; case NOSTORE: request.setNoStore(true); break; case NOTRANSFORM: request.setNoTransform(true); break; case ONLYIFCACHED: request.setOnlyIfCached(true); break; case MAXAGE: request.setMaxAge(value(parser.getValue(directive))); break; case MAXSTALE: request.setMaxStale(value(parser.getValue(directive))); break; case MINFRESH: request.setMinFresh(value(parser.getValue(directive))); break; } } } /** * Parse the Cache-Control header */ public static void parseCacheControl(String cc, AbstractResponse response) { if (cc == null) return; CacheControlParser parser = new CacheControlParser(cc); response.setNoCache(false); response.setNoStore(false); response.setNoTransform(false); response.setMustRevalidate(false); response.setPrivate(false); response.setPublic(false); response.setMaxAge(-1); for (Directive directive : parser) { switch (directive) { case NOCACHE: response.setNoCache(true); response.setNoCacheHeaders(parser.getValues(directive)); break; case NOSTORE: response.setNoStore(true); break; case NOTRANSFORM: response.setNoTransform(true); break; case MUSTREVALIDATE: response.setMustRevalidate(true); break; case PUBLIC: response.setPublic(true); break; case PRIVATE: response.setPrivate(true); response.setPrivateHeaders(parser.getValues(directive)); break; case MAXAGE: response.setMaxAge(value(parser.getValue(directive))); break; } } } /** * Cache Control Directives */ public enum Directive { MAXAGE, MAXSTALE, MINFRESH, NOCACHE, NOSTORE, NOTRANSFORM, ONLYIFCACHED, MUSTREVALIDATE, PRIVATE, PROXYREVALIDATE, PUBLIC, SMAXAGE, UNKNOWN; public static Directive select(String d) { try { d = d.toUpperCase().replaceAll("-", ""); return Directive.valueOf(d); } catch (Exception e) { } return UNKNOWN; } } /** * Parser for the Cache-Control header */ public static class CacheControlParser implements Iterable<Directive> { private static final String REGEX = "\\s*([\\w\\-]+)\\s*(=)?\\s*(\\d+|\\\"([^\"\\\\]*(\\\\.[^\"\\\\]*)*)+\\\")?\\s*"; private static final Pattern pattern = Pattern.compile(REGEX); private HashMap<Directive, String> values = new HashMap<Directive, String>(); public CacheControlParser(String value) { Matcher matcher = pattern.matcher(value); while (matcher.find()) { String d = matcher.group(1); Directive directive = Directive.select(d); if (directive != Directive.UNKNOWN) { values.put(directive, matcher.group(3)); } } } public Map<Directive, String> getValues() { return values; } public String getValue(Directive directive) { return values.get(directive); } public Iterator<Directive> iterator() { return values.keySet().iterator(); } public String[] getValues(Directive directive) { String value = getValue(directive); if (value != null) { return CompressionUtil.splitAndTrim(value, ",", true); } return null; } } }
7,183
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import java.util.Date; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.protocol.Response; import org.apache.abdera.util.EntityTag; public abstract class AbstractResponse extends AbstractMessage implements Response { protected String[] nocache_headers = null; protected String[] private_headers = null; protected long smax_age = -1; public long getAge() { String value = getHeader("Age"); try { return (value != null) ? Long.parseLong(value) : -1; } catch (NumberFormatException e) { return -1; } } public String getAllow() { return getHeader("Allow"); } public long getContentLength() { String value = getHeader("Content-Length"); try { return (value != null) ? Long.parseLong(value) : -1; } catch (NumberFormatException e) { return -1; } } public EntityTag getEntityTag() { String etag = getHeader("ETag"); return (etag != null) ? EntityTag.parse(getHeader("ETag")) : null; } public Date getExpires() { return getDateHeader("Expires"); } public Date getLastModified() { return getDateHeader("Last-Modified"); } public IRI getLocation() { String l = getHeader("Location"); return l != null ? new IRI(l) : null; } public String[] getNoCacheHeaders() { return nocache_headers; } public String[] getPrivateHeaders() { return private_headers; } public long getSMaxAge() { return smax_age; } public ResponseType getType() { return ResponseType.select(getStatus()); } public boolean isMustRevalidate() { return check(REVALIDATE); } public boolean isPrivate() { return check(PRIVATE); } public boolean isProxyRevalidate() { return check(PROXYREVALIDATE); } public boolean isPublic() { return check(PUBLIC); } public AbstractResponse setMaxAge(long max_age) { this.max_age = max_age; return this; } public AbstractResponse setMustRevalidate(boolean val) { toggle(val, REVALIDATE); return this; } public AbstractResponse setProxyRevalidate(boolean val) { toggle(val, PROXYREVALIDATE); return this; } public AbstractResponse setNoCache(boolean val) { toggle(val, NOCACHE); return this; } public AbstractResponse setNoStore(boolean val) { toggle(val, NOSTORE); return this; } public AbstractResponse setNoTransform(boolean val) { toggle(val, NOTRANSFORM); return this; } public AbstractResponse setPublic(boolean val) { toggle(val, PUBLIC); return this; } public AbstractResponse setPrivate(boolean val) { if (val) flags |= PRIVATE; else if (isPrivate()) flags ^= PRIVATE; return this; } public AbstractResponse setPrivateHeaders(String... headers) { this.private_headers = headers; return this; } public AbstractResponse setNoCacheHeaders(String... headers) { this.nocache_headers = headers; return this; } }
7,184
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/ProtocolConstants.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; public interface ProtocolConstants { public final static int NOCACHE = 1; public final static int NOSTORE = 2; public final static int NOTRANSFORM = 4; public final static int PUBLIC = 8; public final static int PRIVATE = 16; public final static int REVALIDATE = 32; public final static int PROXYREVALIDATE = 64; public final static int ONLYIFCACHED = 128; }
7,185
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/AbstractItemManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import org.apache.abdera.protocol.ItemManager; import org.apache.abdera.protocol.Request; public abstract class AbstractItemManager<T> extends PoolManager<T> implements ItemManager<T> { public AbstractItemManager() { super(); } public AbstractItemManager(int max) { super(max); } public T get(Request request) { return getInstance(); } }
7,186
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.util; import java.util.Date; import org.apache.abdera.protocol.Request; import org.apache.abdera.util.EntityTag; public abstract class AbstractRequest extends AbstractMessage implements Request { protected long max_stale = -1; protected long min_fresh = -1; public String getAccept() { return getHeader("Accept"); } public String getAcceptCharset() { return getHeader("Accept-Charset"); } public String getAcceptEncoding() { return getHeader("Accept-Encoding"); } public String getAcceptLanguage() { return getHeader("Accept-Language"); } public String getAuthorization() { return getHeader("Authorization"); } public EntityTag[] getIfMatch() { return EntityTag.parseTags(getHeader("If-Match")); } public Date getIfModifiedSince() { return getDateHeader("If-Modified-Since"); } public EntityTag[] getIfNoneMatch() { return EntityTag.parseTags(getHeader("If-None-Match")); } public Date getIfUnmodifiedSince() { return getDateHeader("If-Unmodified-Since"); } public long getMaxStale() { return max_stale; } public long getMinFresh() { return min_fresh; } public boolean isOnlyIfCached() { return check(ONLYIFCACHED); } public AbstractRequest setMaxAge(long max_age) { this.max_age = max_age; return this; } public AbstractRequest setMaxStale(long max_stale) { this.max_stale = max_stale; return this; } public AbstractRequest setMinFresh(long min_fresh) { this.min_fresh = min_fresh; return this; } public AbstractRequest setNoCache(boolean val) { toggle(val, NOCACHE); return this; } public AbstractRequest setNoStore(boolean val) { toggle(val, NOSTORE); return this; } public AbstractRequest setNoTransform(boolean val) { toggle(val, NOTRANSFORM); return this; } public AbstractRequest setOnlyIfCached(boolean val) { toggle(val, ONLYIFCACHED); return this; } }
7,187
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/error/ErrorExtensionFactory.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.error; import org.apache.abdera.util.AbstractExtensionFactory; public class ErrorExtensionFactory extends AbstractExtensionFactory { public ErrorExtensionFactory() { super(Error.NS); addImpl(Error.ERROR, Error.class); } }
7,188
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/error/ProtocolException.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.error; import org.apache.abdera.Abdera; public class ProtocolException extends RuntimeException { private static final long serialVersionUID = 1017447143200419489L; private final Error error; public ProtocolException(Error error) { super(error.getCode() + "::" + error.getMessage()); this.error = error; } public ProtocolException(Abdera abdera, int code, String message) { super(code + "::" + message); this.error = Error.create(abdera, code, message); } public Error getError() { return error; } @Override public int hashCode() { final int prime = 31; int result = 1; String message = error != null ? error.getMessage() : null; int code = error != null ? error.getCode() : 0; result = prime * result + ((message == null) ? 0 : message.hashCode()); result = prime * result + code; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ProtocolException other = (ProtocolException)obj; String message = error != null ? error.getMessage() : null; int code = error != null ? error.getCode() : 0; String omessage = other.error != null ? other.error.getMessage() : null; int ocode = other.error != null ? other.error.getCode() : 0; if (message == null) { if (omessage != null) return false; } else if (!message.equals(omessage)) return false; if (code != ocode) return false; return true; } }
7,189
0
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol
Create_ds/abdera/core/src/main/java/org/apache/abdera/protocol/error/Error.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.protocol.error; import javax.xml.namespace.QName; import org.apache.abdera.Abdera; import org.apache.abdera.factory.Factory; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; import org.apache.abdera.model.ExtensibleElementWrapper; import org.apache.abdera.writer.StreamWriter; /** * Abdera protocol error element. The Abdera error document provides a simple structure for reporting errors back to * Abdera clients. */ public class Error extends ExtensibleElementWrapper { public static final String NS = "http://abdera.apache.org"; public static final QName ERROR = new QName(NS, "error"); public static final QName CODE = new QName(NS, "code"); public static final QName MESSAGE = new QName(NS, "message"); public Error(Element internal) { super(internal); } public Error(Factory factory, QName qname) { super(factory, qname); } /** * The code should typically match the HTTP status code; however, certain application scenarios may require the use * of a different code */ public int getCode() { String code = getSimpleExtension(CODE); return code != null ? Integer.parseInt(code) : -1; } /** * The code should typically match the HTTP status code; however, certain application scenarios may require the use * of a different code */ public Error setCode(int code) { if (code > -1) { Element element = getExtension(CODE); if (element != null) { element.setText(Integer.toString(code)); } else { addSimpleExtension(CODE, Integer.toString(code)); } } else { Element element = getExtension(CODE); if (element != null) element.discard(); } return this; } /** * Human-readable, language-sensitive description of the error */ public String getMessage() { return getSimpleExtension(MESSAGE); } /** * Human-readable, language-sensitive description of the error */ public Error setMessage(String message) { if (message != null) { Element element = getExtension(MESSAGE); if (element != null) { element.setText(message); } else { addSimpleExtension(MESSAGE, message); } } else { Element element = getExtension(MESSAGE); if (element != null) element.discard(); } return this; } /** * Will throw a ProtocolException that wraps this element. This is useful on the client side to surface error * responses */ public void throwException() { throw new ProtocolException(this); } /** * Create a new Error object */ public static Error create(Abdera abdera, int code, String message) { return create(abdera, code, message, null); } public static Error create(Abdera abdera, int code, String message, Throwable t) { Document<Error> doc = abdera.getFactory().newDocument(); Error error = abdera.getFactory().newElement(ERROR, doc); error.setCode(code).setMessage(message); return error; } public static void create(StreamWriter sw, int code, String message, Throwable t) { sw.startDocument().startElement(ERROR).startElement(CODE).writeElementText(code).endElement() .startElement(MESSAGE).writeElementText(message).endElement().endElement().endDocument(); } }
7,190
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/parser/NamedParser.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.parser; import org.apache.abdera.util.NamedItem; /** * Abdera's abstract parsing model allows developers to implement parsers capable of translating non-Atom formats into * Abdera objects. For instance, a developer could create an RDF, RSS, JSON or hAtom microformat parser that * automatically converted to Atom. Alternative parsers are made available via the ParserFactory interface. * * <pre> * Parser parser = abdera.getParserFactory().getParser("json"); * Document&lt;Feed> doc = parser.parse(...); * * Parser parser = abdera.getParserFactory().getParser("hatom"); * Document&lt;Feed> doc = parser.parse(...); * </pre> */ public interface NamedParser extends Parser, NamedItem { /** * Returns a listing of media type of the format consumed by this parser * * @return An array of MIME Media Types */ String[] getInputFormats(); /** * Returns true if this parser is capable of consuming the specified media type * * @param mediatype The MIME media type to check * @return True if the media type is supported */ boolean parsesFormat(String mediatype); }
7,191
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/parser/Parser.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.parser; import java.io.InputStream; import java.io.Reader; import java.nio.channels.ReadableByteChannel; import javax.xml.stream.XMLStreamReader; import org.apache.abdera.model.Document; import org.apache.abdera.model.Element; public interface Parser { /** * Parse the input stream using the default character set encoding (UTF-8) * * @param in The input stream to parse * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(InputStream in) throws ParseException; /** * Parse the input stream using the default character set encoding (UTF-8) * * @param reader The XMLStreamReader to use to parse * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(XMLStreamReader reader) throws ParseException; /** * Parse the input stream using the default character set encoding (UTF-8). The specified Base URI is used to * resolve relative references contained in the document * * @param in The input stream to parse * @param base The Base URI of the document * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(InputStream in, String base) throws ParseException; /** * Parse the input stream using the default character set encoding (UTF-8). The specified Base URI is used to * resolve relative references contained in the document * * @param in The input stream to parse * @param options The Parse options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(InputStream in, ParserOptions options) throws ParseException; /** * Parse the input stream using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param in The input stream to parse * @param base The Base URI of the document * @param options The Parse Options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(InputStream in, String base, ParserOptions options) throws ParseException; /** * Parse the reader using the default Base URI and options * * @param in The Reader to parse * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(Reader in) throws ParseException; /** * Parse the reader using the specified Base URI * * @param in The Reader to parse * @param base The Base URI * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(Reader in, String base) throws ParseException; /** * Parse the reader using the specified Base URI * * @param in The Reader to parse * @param options The Parse Options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(Reader in, ParserOptions options) throws ParseException; /** * Parse the reader using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param in The reader to parse * @param base The Base URI of the document * @param options The Parse Options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(Reader in, String base, ParserOptions options) throws ParseException; /** * Parse the channel using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param in The ReadableByteChannel to parse * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(ReadableByteChannel buf) throws ParseException; /** * Parse the channel using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param in The ReadableByteChannel to parse * @param base The Base URI of the document * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(ReadableByteChannel buf, String base) throws ParseException; /** * Parse the channel using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param in The ReadableByteChannel to parse * @param base The Base URI of the document * @param options The Parse Options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(ReadableByteChannel buf, String base, ParserOptions options) throws ParseException; /** * Parse the channel using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param reader the XMLStreamReader parser to use to parse * @param base The Base URI of the document * @param options The Parse Options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(XMLStreamReader reader, String base, ParserOptions options) throws ParseException; /** * Parse the channel using using the specified Parse options. The parse options can be used to control various * aspects of the parsing process such as the character set encoding to use and whether certain elements should be * ignored. The specified Base URI is used to resolve relative references contained in the document. * * @param in The ReadableByteChannel to parse * @param options The Parse Options * @return The parsed Abdera Document * @throws ParseException if the parse failed */ <T extends Element> Document<T> parse(ReadableByteChannel buf, ParserOptions options) throws ParseException; /** * Return the default parser options for this Parser. This method returns a copy of the default options. Changes to * this instance will not affect the defaults returned by subsequent requests. * * @return The default ParserOptions */ ParserOptions getDefaultParserOptions(); /** * Set the default parser options for this Parser. This method copies the specified options. * * @param options The Parser Options to use as the default */ Parser setDefaultParserOptions(ParserOptions options); }
7,192
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/parser/ParserFactory.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.parser; /** * The ParserFactory is used a acquire instances of alternative parsers registered with Abdera. * * @see org.apache.abdera.parser.NamedParser */ public interface ParserFactory { /** * Get the default parser. This is equivalent to calling Abdera.getParser() * * @return The default parser implementation */ <T extends Parser> T getParser(); /** * Get the named parser * * @param name The name of the parser instance to retrieve * @return The Named parser instance */ <T extends Parser> T getParser(String name); }
7,193
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/parser/ParseException.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.parser; public class ParseException extends RuntimeException { private static final long serialVersionUID = -2586758177341912116L; public ParseException() { super(); } public ParseException(String message) { super(message); } public ParseException(String message, Throwable cause) { super(message, cause); } public ParseException(Throwable cause) { super(cause); } }
7,194
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/parser/ParserOptions.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.parser; import java.util.Map; import javax.xml.namespace.QName; import org.apache.abdera.factory.Factory; import org.apache.abdera.filter.ParseFilter; import org.apache.abdera.i18n.text.io.CompressionUtil.CompressionCodec; /** * Parser options are used to modify the behavior of the parser. */ public interface ParserOptions extends Cloneable { Object clone() throws CloneNotSupportedException; /** * Returns the factory the parser should use */ Factory getFactory(); /** * Sets the factory the parser should use */ ParserOptions setFactory(Factory factory); /** * Returns the default character set to use for the parsed document */ String getCharset(); /** * Sets the character set to use for the parsed document */ ParserOptions setCharset(String charset); /** * Returns the Parse Filter. The parse filter is a set of XML QNames that the parse should watch out for. If the * filter is null, the parser will parse all elements in the document. I the filter is not null, the parser will * only pay attention to elements whose QName's appear in the filter list. */ ParseFilter getParseFilter(); /** * Sets the Parse Filter. The parse filter is a set of XML QNames that the parse should watch out for. If the filter * is null, the parser will parse all elements in the document. I the filter is not null, the parser will only pay * attention to elements whose QName's appear in the filter list. */ ParserOptions setParseFilter(ParseFilter parseFilter); /** * Returns true if the parser should attempt to automatically detect the character encoding from the stream */ boolean getAutodetectCharset(); /** * If true, the parser will attempt to automatically detect the character encoding from the stream by checking for * the byte order mark or checking the XML prolog. */ ParserOptions setAutodetectCharset(boolean detect); /** * If false, the parser will trim leading and trailing whitespace in element and attribute values unless there is an * in-scope xml:space="preserve". */ boolean getMustPreserveWhitespace(); /** * If false, the parser will trim leading and trailing whitespace in element and attribute values unless there is an * in-scope xml:space="preserve". */ ParserOptions setMustPreserveWhitespace(boolean preserve); /** * If true, the parser will attempt to silently filter out invalid XML characters appearing within the XML document. */ boolean getFilterRestrictedCharacters(); /** * If true, the parser will attempt to silently filter out invalid XML characters appearing within the XML document */ ParserOptions setFilterRestrictedCharacters(boolean filter); /** * If getFilterRestrictedCharacters is true, restricted characters will be replaced with the specified character */ char getFilterRestrictedCharacterReplacement(); /** * If getFilterRestrictedCharacters is true, restricted characters will be replaced with the specified character */ ParserOptions setFilterRestrictedCharacterReplacement(char replacement); /** * When parsing an InputStream that contains compressed data, use these codecs to decompress the stream. Only used * when parsing an InputStream. Ignored when parsing a Reader */ CompressionCodec[] getCompressionCodecs(); /** * When parsing an InputStream that contains compressed data, use these codecs to decompress the stream. Only used * when parsing an InputStream. Ignored when parsing a Reader */ ParserOptions setCompressionCodecs(CompressionCodec... codecs); /** * Register a named entity. This provides an escape clause for when feeds use entities that are not supported in XML * without a DTD decl. By default, all of the (X)HTML entities are preregistered */ ParserOptions registerEntity(String name, String value); /** * Resolves a value for a named entity. This provides an escape clause for when feeds use entities that are not * supported in XML without a DTD decl. By default, all of the (X)HTML entities are preregistered */ String resolveEntity(String name); /** * True if undeclared named entities should be resolved. */ ParserOptions setResolveEntities(boolean resolve); /** * True if undeclared named entities should be resolved. */ boolean getResolveEntities(); /** * True if QName-Alias mapping is enabled */ ParserOptions setQNameAliasMappingEnabled(boolean enabled); /** * True if QName-Alias mapping is enabled (default is false) */ boolean isQNameAliasMappingEnabled(); /** * Get the QName-Alias Mapping (default null) */ Map<QName, QName> getQNameAliasMap(); /** * Set the QName-Alias Mapping */ ParserOptions setQNameAliasMap(Map<QName, QName> map); }
7,195
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/writer/WriterFactory.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.writer; /** * The WriterFactory is used a acquire instances of alternative writers registered with Abdera. * * @see org.apache.abdera.writer.Writer */ public interface WriterFactory { /** * Get the default writer. This is equivalent to calling abdera.getWriter(); * * @return The default writer */ <T extends Writer> T getWriter(); /** * Get the named writer. * * @param name The name of the writer * @return The specified writer */ <T extends Writer> T getWriter(String name); /** * Return a writer capable of outputting the given MIME media type * * @param mediatype A MIME media type * @return A matching writer */ <T extends Writer> T getWriterByMediaType(String mediatype); /** * Get the default StreamWriter. This is equivalent to calling abdera.getStreamWriter(); * * @return The default stream writer */ <T extends StreamWriter> T newStreamWriter(); /** * Get the named StreamWriter. * * @param name The name of the StreamWriter * @return The specified StreamWriter */ <T extends StreamWriter> T newStreamWriter(String name); }
7,196
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/writer/Writer.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.writer; import java.io.IOException; import java.io.OutputStream; import java.nio.channels.WritableByteChannel; import org.apache.abdera.model.Base; /** * Writers are used to serialize Abdera objects */ public interface Writer { /** * Serialized the given Abdera Base to the given outputstream */ void writeTo(Base base, OutputStream out) throws IOException; /** * Serialized the given Abdera Base to the given writer */ void writeTo(Base base, java.io.Writer out) throws IOException; /** * Return the serialized form of the Abdera Base */ Object write(Base base) throws IOException; /** * Serialized the given Abdera Base to the given outputstream */ void writeTo(Base base, OutputStream out, WriterOptions options) throws IOException; /** * Serialized the given Abdera Base to the given writer */ void writeTo(Base base, java.io.Writer out, WriterOptions options) throws IOException; /** * Return the serialized form of the Abdera Base */ Object write(Base base, WriterOptions options) throws IOException; void writeTo(Base base, WritableByteChannel out) throws IOException; void writeTo(Base base, WritableByteChannel out, WriterOptions options) throws IOException; WriterOptions getDefaultWriterOptions(); Writer setDefaultWriterOptions(WriterOptions options); }
7,197
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/writer/NamedWriter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.writer; import org.apache.abdera.util.NamedItem; /** * Named Writers provide a means of extending Abdera's built in serialization. */ public interface NamedWriter extends Writer, NamedItem { /** * Return a listing of MIME Media formats this NamedWriter is capable of outputting. */ String[] getOutputFormats(); /** * Returns true if the format produced by this writer matches the specified media type */ boolean outputsFormat(String mediatype); }
7,198
0
Create_ds/abdera/core/src/main/java/org/apache/abdera
Create_ds/abdera/core/src/main/java/org/apache/abdera/writer/StreamWriter.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. The ASF licenses this file to You * under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. For additional information regarding * copyright in this work, please see the NOTICE file in the top level * directory of this distribution. */ package org.apache.abdera.writer; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.Locale; import javax.activation.DataHandler; import javax.xml.namespace.QName; import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.i18n.rfc4646.Lang; import org.apache.abdera.model.Content; import org.apache.abdera.model.Text; import org.apache.abdera.util.NamedItem; /** * The StreamWriter interface provides a for producing Atom documents based on a streaming api. This approach provides a * lightweight alternative to building up an object model. The StreamWriter is NOT synchronized and is NOT threadsafe */ public interface StreamWriter extends NamedItem, Appendable, Closeable { StreamWriter flush(); /** * True if the StreamWriter should autoclose the buffer after calling endDocument */ StreamWriter setAutoclose(boolean auto); /** * True if the StreamWriter should autoflush the buffer */ StreamWriter setAutoflush(boolean auto); /** * Set the target java.io.Writer */ StreamWriter setWriter(java.io.Writer writer); /** * Set the target java.io.OutputStream */ StreamWriter setOutputStream(java.io.OutputStream out); /** * Set the target java.io.OutputStream */ StreamWriter setOutputStream(java.io.OutputStream out, String charset); /** * Set the target WritableByteChannel */ StreamWriter setChannel(java.nio.channels.WritableByteChannel channel); /** * Set the target WritableByteChannel */ StreamWriter setChannel(java.nio.channels.WritableByteChannel channel, String charset); /** * Start the document * * @param xmlversion The XML version * @param charset the Character Encoding */ StreamWriter startDocument(String xmlversion, String charset); /** * Start the document * * @param xmlversion The XML version */ StreamWriter startDocument(String xmlversion); /** * Start the document */ StreamWriter startDocument(); /** * End the document */ StreamWriter endDocument(); /** * Start an atom:feed element */ StreamWriter startFeed(); /** * End the atom:feed element */ StreamWriter endFeed(); /** * Start an atom:entry element */ StreamWriter startEntry(); /** * End the atom:entry element */ StreamWriter endEntry(); /** * Write an atom:id element * * @param iri The value */ StreamWriter writeId(String iri); /** * Write an atom:icon element * * @param iri The value */ StreamWriter writeIcon(String iri); /** * Write an atom:logo element * * @param iri The value */ StreamWriter writeLogo(String iri); /** * Write an IRI element * * @param iri The value */ StreamWriter writeIRIElement(QName qname, String iri); /** * Write an IRI element * * @param name The element localname * @param namespace The element namespace * @param prefix the element prefix * @param iri the IRI to write */ StreamWriter writeIRIElement(String name, String namespace, String prefix, String iri); /** * Write an IRI element * * @param name The element localname * @param namespace The element namespace * @param iri the IRI to write */ StreamWriter writeIRIElement(String name, String namespace, String iri); /** * Write an IRI element * * @param name The element localname * @param iri the IRI to write */ StreamWriter writeIRIElement(String name, String iri); /** * Write an atom:id element * * @param iri The value */ StreamWriter writeId(IRI iri); /** * Write an atom:icon element * * @param iri The value */ StreamWriter writeIcon(IRI iri); /** * Write an atom:logo element * * @param iri The value */ StreamWriter writeLogo(IRI iri); /** * Write an IRI element * * @param iri The value */ StreamWriter writeIRIElement(QName qname, IRI iri); /** * Write an IRI element * * @param name The element localname * @param namespace The element namespace * @param prefix the element prefix * @param iri the IRI to write */ StreamWriter writeIRIElement(String name, String namespace, String prefix, IRI iri); /** * Write an IRI element * * @param name The element localname * @param namespace The element namespace * @param iri the IRI to write */ StreamWriter writeIRIElement(String name, String namespace, IRI iri); /** * Write an IRI element * * @param name The element localname * @param iri the IRI to write */ StreamWriter writeIRIElement(String name, IRI iri); /** * Write an atom:id element with a new IRI value * * @param iri The value */ StreamWriter writeId(); /** * Write an atom:updated element * * @param date The date value */ StreamWriter writeUpdated(Date date); /** * Write an atom:published element * * @param date The date value */ StreamWriter writePublished(Date date); /** * Write an atom:edited element * * @param date The date value */ StreamWriter writeEdited(Date date); /** * Write a Date element * * @param qname The element qname * @param date The date value */ StreamWriter writeDate(QName qname, Date date); /** * Write a Date element * * @param name The element localname * @param namespace The element namespace * @param prefix The element prefix * @param date The date value */ StreamWriter writeDate(String name, String namespace, String prefix, Date date); /** * Write a Date element * * @param name The element localname * @param namespace The element namespace * @param date The date value */ StreamWriter writeDate(String name, String namespace, Date date); /** * Write a Date element * * @param name The element localname * @param date The date value */ StreamWriter writeDate(String name, Date date); /** * Write an atom:updated element * * @param date The date value */ StreamWriter writeUpdated(String date); /** * Write an atom:published element * * @param date The date value */ StreamWriter writePublished(String date); /** * Write an atom:edited element * * @param date The date value */ StreamWriter writeEdited(String date); /** * Write a Date element * * @param qname The element qname * @param date The date value */ StreamWriter writeDate(QName qname, String date); /** * Write a Date element * * @param name The element localname * @param namespace The element namespace * @param prefix The element prefix * @param date The date value */ StreamWriter writeDate(String name, String namespace, String prefix, String date); /** * Write a Date element * * @param name The element localname * @param namespace The element namespace * @param date The date value */ StreamWriter writeDate(String name, String namespace, String date); /** * Write a Date element * * @param name The element localname * @param date The date value */ StreamWriter writeDate(String name, String date); /** * End the person element */ StreamWriter endPerson(); /** * End the atom:link */ StreamWriter endLink(); /** * Write an atom:link element * * @param iri The href value */ StreamWriter writeLink(String iri); /** * Write an atom:link element * * @param iri The href value * @param rel The rel value */ StreamWriter writeLink(String iri, String rel); /** * Write an atom:link element * * @param iri The href value * @param rel The rel value * @param type The type value */ StreamWriter writeLink(String iri, String rel, String type); /** * Write an atom:link element * * @param iri The href value * @param rel The rel value * @param type The type value * @param title The title value * @param hreflang The hreflang value * @param length The link length */ StreamWriter writeLink(String iri, String rel, String type, String title, String hreflang, long length); /** * Start an atom:link element * * @param iri The href value */ StreamWriter startLink(String iri); /** * Start an atom:link element * * @param iri The href value * @param rel The rel value */ StreamWriter startLink(String iri, String rel); /** * Start an atom:link element * * @param iri The href value * @param rel The rel value * @param type The type value */ StreamWriter startLink(String iri, String rel, String type); /** * Start an atom:link element * * @param iri The href value * @param rel The rel value * @param type The type value * @param title The title value * @param hreflang The hreflang value * @param length The link length */ StreamWriter startLink(String iri, String rel, String type, String title, String hreflang, long length); /** * End the atom:category */ StreamWriter endCategory(); /** * Write an atom:category element * * @param term The term value */ StreamWriter writeCategory(String term); /** * Write an atom:category element * * @param term The term value * @param scheme The term value */ StreamWriter writeCategory(String term, String scheme); /** * Write an atom:category element * * @param term The term value * @param scheme The term value * @param label The term value */ StreamWriter writeCategory(String term, String scheme, String label); /** * Start an atom:category element * * @param term The term value */ StreamWriter startCategory(String term); /** * Start an atom:category element * * @param term The term value * @param scheme The term value */ StreamWriter startCategory(String term, String scheme); /** * Start an atom:category element * * @param term The term value * @param scheme The term value * @param label The term value */ StreamWriter startCategory(String term, String scheme, String label); /** * Start an atom:source element */ StreamWriter startSource(); /** * End the atom:source */ StreamWriter endSource(); /** * Write a Text element * * @param qname The element qname * @param type The text type * @param value The text value */ StreamWriter writeText(QName qname, Text.Type type, String value); /** * Write a Text element * * @param name The element name * @param type The text type * @param value The text value */ StreamWriter writeText(String name, Text.Type type, String value); /** * Write a Text element * * @param name The element name * @param namespace The element namespace * @param type The text type * @param value The text value */ StreamWriter writeText(String name, String namespace, Text.Type type, String value); /** * Write a Text element * * @param name The element name * @param namespace The element namespace * @param prefix The element prefix * @param type The text type * @param value The text value */ StreamWriter writeText(String name, String namespace, String prefix, Text.Type type, String value); /** * Start a Text element * * @param qname The element qname * @param type The text type */ StreamWriter startText(QName qname, Text.Type type); /** * Start a Text element * * @param name The element name * @param type The text type * @param value The text value */ StreamWriter startText(String name, Text.Type type); /** * Start a Text element * * @param name The element name * @param namespace The element namespace * @param type The text type * @param value The text value */ StreamWriter startText(String name, String namespace, Text.Type type); /** * Start a Text element * * @param name The element name * @param namespace The element namespace * @param prefix The element prefix * @param type The text type * @param value The text value */ StreamWriter startText(String name, String namespace, String prefix, Text.Type type); /** * End the atom:content element */ StreamWriter endContent(); /** * Write an atom:content element * * @param type The text type * @param value The text value */ StreamWriter writeContent(Content.Type type, String value); /** * Write an atom:content element * * @param type The text type * @param value The text value */ StreamWriter writeContent(Content.Type type, InputStream value) throws IOException; /** * Write an atom:content element * * @param type The text type * @param value The text value */ StreamWriter writeContent(Content.Type type, DataHandler value) throws IOException; /** * Write an atom:content element * * @param type The text type * @param value The text value */ StreamWriter writeContent(String type, String value); /** * Start an atom:content element * * @param type The text type */ StreamWriter startContent(Content.Type type); /** * Start an atom:content element * * @param type The text type */ StreamWriter startContent(String type); /** * Start an atom:content element * * @param type The text type * @param src The src value */ StreamWriter startContent(Content.Type type, String src); /** * Start an atom:content element * * @param type The text type * @param src The src value */ StreamWriter startContent(String type, String src); /** * Start an element * * @param qname Element qname */ StreamWriter startElement(QName qname); /** * Start an element */ StreamWriter startElement(String name); /** * Start an element */ StreamWriter startElement(String name, String namespace); /** * Start an element */ StreamWriter startElement(String name, String namespace, String prefix); /** * Write element text using Formatter * * @param format * @param params */ StreamWriter writeElementText(String format, Object... params); /** * Write element text * * @param value The text value */ StreamWriter writeElementText(String value); /** * Write element text * * @param datahandler The text value */ StreamWriter writeElementText(DataHandler datahandler) throws IOException; /** * Write element text * * @param in The text value */ StreamWriter writeElementText(InputStream in) throws IOException; /** * Write element text * * @param value The text value */ StreamWriter writeElementText(Date value); /** * Write element text * * @param value The text value */ StreamWriter writeElementText(int value); /** * Write element text * * @param value The text value */ StreamWriter writeElementText(long value); /** * Write element text * * @param value The text value */ StreamWriter writeElementText(double value); /** * End the element */ StreamWriter endElement(); /** * Write an atom:title element * * @param value The text value */ StreamWriter writeTitle(String value); /** * Write an atom:title element * * @param type The text type * @param value The text value */ StreamWriter writeTitle(Text.Type type, String value); /** * Write an atom:subtitle element * * @param value The text value */ StreamWriter writeSubtitle(String value); /** * Write an atom:subtitle element * * @param type The text type * @param value The text value */ StreamWriter writeSubtitle(Text.Type type, String value); /** * Write an atom:summary element * * @param value The text value */ StreamWriter writeSummary(String value); /** * Write an atom:summary element * * @param type The text type * @param value The text value */ StreamWriter writeSummary(Text.Type type, String value); /** * Write an atom:rights element * * @param value The text value */ StreamWriter writeRights(String value); /** * Write an atom:rights element * * @param type The text type * @param value The text value */ StreamWriter writeRights(Text.Type type, String value); /** * Write a person element * * @param qname the element qname * @param name The person name * @param email The person email * @param uri The person uri */ StreamWriter writePerson(QName qname, String name, String email, String uri); /** * Write a person element * * @param localhost the element name * @param name The person name * @param email The person email * @param uri The person uri */ StreamWriter writePerson(String localname, String name, String email, String uri); /** * Write a person element * * @param localhost the element name * @param namespace the element namespace * @param name The person name * @param email The person email * @param uri The person uri */ StreamWriter writePerson(String localname, String namespace, String name, String email, String uri); /** * Write a person element * * @param localhost the element name * @param namespace the element namespace * @param prefix the element prefix * @param name The person name * @param email The person email * @param uri The person uri */ StreamWriter writePerson(String localname, String namespace, String prefix, String name, String email, String uri); /** * Start a person element * * @param qname The element qname */ StreamWriter startPerson(QName qname); /** * Start a person element * * @param name The element name */ StreamWriter startPerson(String name); /** * Start a person element * * @param name The element name * @param namespace The element namespace */ StreamWriter startPerson(String name, String namespace); /** * Start a person element * * @param name The element name * @param namespace The element namespace * @param prefix The element prefix */ StreamWriter startPerson(String name, String namespace, String prefix); /** * Write a person name * * @param name The person name */ StreamWriter writePersonName(String name); /** * Write a person email * * @param email The person email */ StreamWriter writePersonEmail(String email); /** * Write a person uri * * @param uri The person uri */ StreamWriter writePersonUri(String uri); /** * Write an atom:author element * * @param name The person name * @param email The person email * @param uri The person uri */ StreamWriter writeAuthor(String name, String email, String uri); /** * Write an atom:author element * * @param name The person name */ StreamWriter writeAuthor(String name); /** * Start an atom:author element */ StreamWriter startAuthor(); /** * End the atom:author element */ StreamWriter endAuthor(); /** * Write an atom:contributor element * * @param name The person name * @param email The person email * @param uri The person uri */ StreamWriter writeContributor(String name, String email, String uri); /** * Write an atom:contributor element * * @param name The person name */ StreamWriter writeContributor(String name); /** * Start an atom:contributor element */ StreamWriter startContributor(); /** * End an atom:contributor element */ StreamWriter endContributor(); /** * Write an atom:generator element * * @param version The version value * @param uri The uri value * @param value The text value */ StreamWriter writeGenerator(String version, String uri, String value); /** * Start an atom:generator element * * @param version The version value * @param uri The uri value */ StreamWriter startGenerator(String version, String uri); /** * End the atom:generator element */ StreamWriter endGenerator(); /** * Write an XML comment */ StreamWriter writeComment(String value); /** * Write an XML Processing Instruction */ StreamWriter writePI(String value); /** * Write an XML Processing Instruction */ StreamWriter writePI(String value, String target); /** * Start an app:service element */ StreamWriter startService(); /** * End an app:service element */ StreamWriter endService(); /** * Start an app:workspace element */ StreamWriter startWorkspace(); /** * End an app:workspace element */ StreamWriter endWorkspace(); /** * Start an app:collection element * * @param href The href value */ StreamWriter startCollection(String href); /** * End an app:collection element */ StreamWriter endCollection(); /** * Writes app:accept elements * * @param accepts accept element values */ StreamWriter writeAccepts(String... accepts); /** * Writes an app:accept element indicating that entries are accepted */ StreamWriter writeAcceptsEntry(); /** * Writes an app:accept element indicating that nothing is accepted */ StreamWriter writeAcceptsNothing(); /** * Start an app:categories element */ StreamWriter startCategories(); /** * Start an app:categories element * * @param fixed True if the app:categories element is fixed */ StreamWriter startCategories(boolean fixed); /** * Start an app:categories element * * @param fixed True if the app:categories element is fixed * @param scheme The scheme value */ StreamWriter startCategories(boolean fixed, String scheme); /** * End the app:categories element */ StreamWriter endCategories(); /** * Start the app:control element */ StreamWriter startControl(); /** * End the app:control element */ StreamWriter endControl(); /** * Write an app:draft element * * @param draft true if app:draft=yes */ StreamWriter writeDraft(boolean draft); /** * Write an attribute */ StreamWriter writeAttribute(QName qname, String value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, String value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, String prefix, String value); /** * Write an attribute */ StreamWriter writeAttribute(QName qname, Date value); /** * Write an attribute */ StreamWriter writeAttribute(String name, Date value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, Date value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, String prefix, Date value); /** * Write an attribute */ StreamWriter writeAttribute(QName qname, int value); /** * Write an attribute */ StreamWriter writeAttribute(String name, int value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, int value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, String prefix, int value); /** * Write an attribute */ StreamWriter writeAttribute(QName qname, long value); /** * Write an attribute */ StreamWriter writeAttribute(String name, long value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, long value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, String prefix, long value); /** * Write an attribute */ StreamWriter writeAttribute(QName qname, double value); /** * Write an attribute */ StreamWriter writeAttribute(String name, double value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, double value); /** * Write an attribute */ StreamWriter writeAttribute(String name, String namespace, String prefix, double value); /** * Write a new line and indent */ StreamWriter indent(); /** * True to enable automatic indenting */ StreamWriter setAutoIndent(boolean indent); /** * Write the xml:base attribute */ StreamWriter writeBase(String iri); /** * Write the xml:base attribute */ StreamWriter writeBase(IRI iri); /** * Write the xml:lang attribute */ StreamWriter writeLanguage(String lang); /** * Write the xml:lang attribute */ StreamWriter writeLanguage(Lang lang); /** * Write the xml:lang attribute */ StreamWriter writeLanguage(Locale locale); /** * Specify the namespace prefix */ StreamWriter setPrefix(String prefix, String uri); /** * Write a namespace declaration */ StreamWriter writeNamespace(String prefix, String uri); }
7,199