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/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolderFactory_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.OBMessaging; public class ExceptionHolderFactory_impl implements org.omg.CORBA.portable.ValueFactory { public ExceptionHolderFactory_impl() { } public java.io.Serializable read_value( org.omg.CORBA_2_3.portable.InputStream in) { return in.read_value(new ExceptionHolder_impl()); } }
6,900
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/Poller_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.OBMessaging; public class Poller_impl implements org.omg.CORBA.Pollable, org.omg.Messaging.Poller { // // ORBInstance this poller is bound to // protected org.apache.yoko.orb.OB.ORBInstance orbInstance_ = null; // // operation target // protected org.omg.CORBA.Object objectTarget_ = null; // // Operation name // protected String operationName_ = null; // // Associated ReplyHandler // protected org.omg.Messaging.ReplyHandler replyHandler_ = null; // ---------------------------------------------------------------- // Standard IDL to Java mapping // ---------------------------------------------------------------- public String[] _truncatable_ids() { throw new org.omg.CORBA.NO_IMPLEMENT(); } // ---------------------------------------------------------------- // From org.omg.CORBA.Pollable // ---------------------------------------------------------------- // // IDL:omg.org/CORBA/Pollable/is_ready:1.0 // public boolean is_ready(int timeout) { org.apache.yoko.orb.OB.Assert._OB_assert(orbInstance_ != null); org.apache.yoko.orb.OB.OrbAsyncHandler handler = orbInstance_ .getAsyncHandler(); return handler.is_ready(this, timeout); } // // IDL:omg.org/CORBA/Pollable/create_pollable_set:1.0 // public org.omg.CORBA.PollableSet create_pollable_set() { org.apache.yoko.orb.OB.Assert._OB_assert(orbInstance_ != null); return new org.apache.yoko.orb.OBCORBA.PollableSet_impl(); } // ---------------------------------------------------------------- // From org.omg.Messaging.Poller // ---------------------------------------------------------------- // // IDL:omg.org/Messaging/Poller/operation_target:1.0 // public org.omg.CORBA.Object operation_target() { return objectTarget_; } // // IDL:omg.org/Messaging/Poller/operation_name:1.0 // public String operation_name() { return operationName_; } // // IDL:omg.org/Messaging/Poller/associated_handler:1.0 // public org.omg.Messaging.ReplyHandler associated_handler() { return replyHandler_; } public void associated_handler(org.omg.Messaging.ReplyHandler handler) { replyHandler_ = handler; } // // IDL:omg.org/Messasging/Poller/is_from_poller:1.0 // public boolean is_from_poller() { return false; } // ---------------------------------------------------------------- // Proprietary methods used by the ORB // ---------------------------------------------------------------- // // set the internal ORBInstance handle // public void _OB_ORBInstance(org.apache.yoko.orb.OB.ORBInstance orb) { orbInstance_ = orb; } // // set the object target reference in this poller // public void _OB_Object(org.omg.CORBA.Object obj) { objectTarget_ = obj; } // // get the response of this request // public org.apache.yoko.orb.OB.Downcall _OB_poll_response() { org.apache.yoko.orb.OB.OrbAsyncHandler handler = orbInstance_ .getAsyncHandler(); return handler.poll_response(this); } }
6,901
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolder_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.OBMessaging; import static org.apache.yoko.orb.OCI.GiopVersion.GIOP1_2; import org.apache.yoko.osgi.ProviderLocator; public class ExceptionHolder_impl extends org.omg.Messaging._ExceptionHolder { // // The user exception proxy // private org.apache.yoko.orb.OBMessaging.UserExceptionRaiseProxy raiseProxy_; // // Raise the exception // public void raise_exception() throws java.lang.Exception // throws org.omg.CORBA.UserException { if (is_system_exception) { org.apache.yoko.orb.CORBA.InputStream in = _OB_inputStream(); org.omg.CORBA.SystemException sysEx = org.omg.CORBA.SystemExceptionHelper .read(in); try { if (sysEx.getClass().getName().equals("org.omg.CORBA.UNKNOWN")) { org.omg.CORBA.UNKNOWN ex = (org.omg.CORBA.UNKNOWN) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.BAD_PARAM")) { org.omg.CORBA.BAD_PARAM ex = (org.omg.CORBA.BAD_PARAM) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.NO_MEMORY")) { org.omg.CORBA.NO_MEMORY ex = (org.omg.CORBA.NO_MEMORY) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.IMP_LIMIT")) { org.omg.CORBA.IMP_LIMIT ex = (org.omg.CORBA.IMP_LIMIT) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.COMM_FAILURE")) { org.omg.CORBA.COMM_FAILURE ex = (org.omg.CORBA.COMM_FAILURE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INV_OBJREF")) { org.omg.CORBA.INV_OBJREF ex = (org.omg.CORBA.INV_OBJREF) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.NO_PERMISSION")) { org.omg.CORBA.NO_PERMISSION ex = (org.omg.CORBA.NO_PERMISSION) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INTERNAL")) { org.omg.CORBA.INTERNAL ex = (org.omg.CORBA.INTERNAL) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.MARSHAL")) { org.omg.CORBA.MARSHAL ex = (org.omg.CORBA.MARSHAL) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INITIALIZE")) { org.omg.CORBA.INITIALIZE ex = (org.omg.CORBA.INITIALIZE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.NO_IMPLEMENT")) { org.omg.CORBA.NO_IMPLEMENT ex = (org.omg.CORBA.NO_IMPLEMENT) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.BAD_TYPECODE")) { org.omg.CORBA.BAD_TYPECODE ex = (org.omg.CORBA.BAD_TYPECODE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.BAD_OPERATION")) { org.omg.CORBA.BAD_OPERATION ex = (org.omg.CORBA.BAD_OPERATION) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.NO_RESOURCES")) { org.omg.CORBA.NO_RESOURCES ex = (org.omg.CORBA.NO_RESOURCES) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.NO_RESPONSE")) { org.omg.CORBA.NO_RESPONSE ex = (org.omg.CORBA.NO_RESPONSE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.PERSIST_STORE")) { org.omg.CORBA.PERSIST_STORE ex = (org.omg.CORBA.PERSIST_STORE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.BAD_INV_ORDER")) { org.omg.CORBA.BAD_INV_ORDER ex = (org.omg.CORBA.BAD_INV_ORDER) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.TRANSIENT")) { org.omg.CORBA.TRANSIENT ex = (org.omg.CORBA.TRANSIENT) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.FREE_MEM")) { org.omg.CORBA.FREE_MEM ex = (org.omg.CORBA.FREE_MEM) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INV_IDENT")) { org.omg.CORBA.INV_IDENT ex = (org.omg.CORBA.INV_IDENT) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INTF_REPOS")) { org.omg.CORBA.INTF_REPOS ex = (org.omg.CORBA.INTF_REPOS) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.BAD_CONTEXT")) { org.omg.CORBA.BAD_CONTEXT ex = (org.omg.CORBA.BAD_CONTEXT) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.OBJ_ADAPTER")) { org.omg.CORBA.OBJ_ADAPTER ex = (org.omg.CORBA.OBJ_ADAPTER) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.DATA_CONVERSION")) { org.omg.CORBA.DATA_CONVERSION ex = (org.omg.CORBA.DATA_CONVERSION) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.OBJECT_NOT_EXIST")) { org.omg.CORBA.OBJECT_NOT_EXIST ex = (org.omg.CORBA.OBJECT_NOT_EXIST) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.TRANSACTION_REQUIRED")) { org.omg.CORBA.TRANSACTION_REQUIRED ex = (org.omg.CORBA.TRANSACTION_REQUIRED) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.TRANSACTION_ROLLEDBACK")) { org.omg.CORBA.TRANSACTION_ROLLEDBACK ex = (org.omg.CORBA.TRANSACTION_ROLLEDBACK) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INVALID_TRANSACTION")) { org.omg.CORBA.INVALID_TRANSACTION ex = (org.omg.CORBA.INVALID_TRANSACTION) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.INV_POLICY")) { org.omg.CORBA.INV_POLICY ex = (org.omg.CORBA.INV_POLICY) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.CODESET_INCOMPATIBLE")) { org.omg.CORBA.CODESET_INCOMPATIBLE ex = (org.omg.CORBA.CODESET_INCOMPATIBLE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.REBIND")) { org.omg.CORBA.REBIND ex = (org.omg.CORBA.REBIND) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.TIMEOUT")) { org.omg.CORBA.TIMEOUT ex = (org.omg.CORBA.TIMEOUT) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.TRANSACTION_UNAVAILABLE")) { org.omg.CORBA.TRANSACTION_UNAVAILABLE ex = (org.omg.CORBA.TRANSACTION_UNAVAILABLE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.TRANSACTION_MODE")) { org.omg.CORBA.TRANSACTION_MODE ex = (org.omg.CORBA.TRANSACTION_MODE) sysEx; throw ex; } else if (sysEx.getClass().getName().equals( "org.omg.CORBA.BAD_QOS")) { org.omg.CORBA.BAD_QOS ex = (org.omg.CORBA.BAD_QOS) sysEx; throw ex; } } catch (org.omg.CORBA.SystemException ex) { throw ex; } } if (raiseProxy_ != null) raiseProxy_.raise(this); throw new org.omg.CORBA.UNKNOWN(); } // // Raise the exception with a list of possible exceptions // public void raise_exception_with_list(org.omg.CORBA.TypeCode[] exc_list) throws java.lang.Exception { try { this.raise_exception(); } catch (java.lang.Exception ex) { // // This should work for all our exception types (System and // User) // org.omg.CORBA.Any any = new org.apache.yoko.orb.CORBA.Any(); Class exClass = ex.getClass(); String className = exClass.getName(); try { // // Get the helper class and the insert method with // appropriate parameter types // // get the appropriate class for the loading. ClassLoader loader = exClass.getClassLoader(); Class c = ProviderLocator.loadClass(className + "Helper", exClass); Class[] paramTypes = new Class[2]; paramTypes[0] = org.omg.CORBA.Any.class; paramTypes[1] = exClass; java.lang.reflect.Method m = c.getMethod("insert", paramTypes); // // Build up the parameter list // Object[] parameters = new Object[2]; parameters[0] = any; parameters[1] = ex; // // No object is needed since this is a static method // call // m.invoke(null, parameters); } catch (ClassNotFoundException e) { // // REVISIT: // This just means that we probably caught a non-CORBA // exception. What do we want to do with it? // return; } catch (NoSuchMethodException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (IllegalAccessException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (IllegalArgumentException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (java.lang.reflect.InvocationTargetException e) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (SecurityException e) { return; } // // Check against typecodes // for (int i = 0; i < exc_list.length; ++i) { if (any.type().equal(exc_list[i])) throw ex; } } } // // from ValueBase // public org.omg.CORBA.portable.ValueBase _copy_value() throws org.omg.CORBA.SystemException { ExceptionHolder_impl copy = new ExceptionHolder_impl(); // // Copy data members // copy.is_system_exception = is_system_exception; copy.byte_order = byte_order; if (marshaled_exception != null) { copy.marshaled_exception = new byte[marshaled_exception.length]; System.arraycopy(marshaled_exception, 0, copy.marshaled_exception, 0, marshaled_exception.length); } // // Copy the raiser class // if (raiseProxy_ != null) { copy.raiseProxy_ = raiseProxy_; } return copy; } // // Copy the contents of the stream into the internal octet sequence // public void _OB_extractSequence(org.apache.yoko.orb.OCI.Buffer buf) { org.apache.yoko.orb.OB.Assert._OB_assert(buf != null); marshaled_exception = new byte[buf.rest_length()]; System.arraycopy(buf.data_, buf.pos(), marshaled_exception, 0, buf .rest_length()); } // // Obtain an input stream from the marshalled exception sequence. This // is used for unmarshalling the exception. // public org.apache.yoko.orb.CORBA.InputStream _OB_inputStream() { org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer( marshaled_exception, marshaled_exception.length); org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream( buf, 0, false, null, GIOP1_2); return in; } // // Register the class used to raise any exceptions. This class will // take ownership of that raiser object. // public void _OB_register_raise_proxy( org.apache.yoko.orb.OBMessaging.UserExceptionRaiseProxy proxy) { org.apache.yoko.orb.OB.Assert._OB_assert(proxy != null); org.apache.yoko.orb.OB.Assert._OB_assert(raiseProxy_ == null); raiseProxy_ = proxy; } // // ExceptionHolder_impl constructors // public ExceptionHolder_impl() { byte_order = false; is_system_exception = false; marshaled_exception = null; raiseProxy_ = null; } public ExceptionHolder_impl(boolean border) { byte_order = border; is_system_exception = false; marshaled_exception = null; raiseProxy_ = null; } public ExceptionHolder_impl(boolean border, boolean sys_except) { byte_order = border; is_system_exception = sys_except; marshaled_exception = null; raiseProxy_ = null; } }
6,902
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/Current_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; final class CurrentState { org.omg.PortableServer.POA poa; org.omg.PortableServer.Servant servant; java.lang.Object cookie; byte[] oid; String op; CurrentState next; } final public class Current_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.Current { private java.util.Hashtable stateKey_ = new java.util.Hashtable(); public Current_impl() { } protected void finalize() throws Throwable { super.finalize(); } public org.omg.PortableServer.POA get_POA() throws org.omg.PortableServer.CurrentPackage.NoContext { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); if (state == null || state.poa == null) throw new org.omg.PortableServer.CurrentPackage.NoContext(); return state.poa; } public byte[] get_object_id() throws org.omg.PortableServer.CurrentPackage.NoContext { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); if (state == null || state.poa == null) throw new org.omg.PortableServer.CurrentPackage.NoContext(); return state.oid; } public org.omg.CORBA.Object get_reference() throws org.omg.PortableServer.CurrentPackage.NoContext { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); if (state == null || state.poa == null) throw new org.omg.PortableServer.CurrentPackage.NoContext(); try { return state.poa.servant_to_reference(state.servant); } catch (org.omg.PortableServer.POAPackage.WrongPolicy ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } catch (org.omg.PortableServer.POAPackage.ServantNotActive ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } return null; } public org.omg.PortableServer.Servant get_servant() throws org.omg.PortableServer.CurrentPackage.NoContext { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); if (state == null || state.poa == null) throw new org.omg.PortableServer.CurrentPackage.NoContext(); return state.servant; } public void _OB_preinvoke( org.apache.yoko.orb.OBPortableServer.POA_impl poa, org.omg.PortableServer.Servant servant, String op, byte[] oid, java.lang.Object cookie) { Thread t = Thread.currentThread(); CurrentState state = (CurrentState) stateKey_.get(t); CurrentState ns = new CurrentState(); ns.poa = poa; // // These should be valid for the duration of the invocation // ns.oid = oid; ns.cookie = cookie; ns.servant = servant; ns.op = op; ns.next = state; state = ns; stateKey_.put(t, state); } public void _OB_postinvoke() { Thread t = Thread.currentThread(); CurrentState state = (CurrentState) stateKey_.get(t); CurrentState save = state; state = state.next; // // Note: Hashtable cannot hold null keys or values // if (state == null) stateKey_.remove(t); else stateKey_.put(t, state); } public boolean _OB_inUpcall() { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); return state != null; } public org.omg.PortableServer.Servant _OB_getServant() { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); org.apache.yoko.orb.OB.Assert._OB_assert(state != null); return state.servant; } public java.lang.Object _OB_getCookie() { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); org.apache.yoko.orb.OB.Assert._OB_assert(state != null); return state.cookie; } public byte[] _OB_getObjectId() { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); org.apache.yoko.orb.OB.Assert._OB_assert(state != null); return state.oid; } public String _OB_getOp() { CurrentState state = (CurrentState) stateKey_.get(Thread .currentThread()); org.apache.yoko.orb.OB.Assert._OB_assert(state != null); return state.op; } }
6,903
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/ServantRetentionPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class ServantRetentionPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.ServantRetentionPolicy { private ServantRetentionPolicyValue value_; public ServantRetentionPolicy_impl(ServantRetentionPolicyValue value) { value_ = value; } public ServantRetentionPolicyValue value() { return value_; } public int policy_type() { return SERVANT_RETENTION_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,904
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/ImplicitActivationPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class ImplicitActivationPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.ImplicitActivationPolicy { private ImplicitActivationPolicyValue value_; public ImplicitActivationPolicy_impl(ImplicitActivationPolicyValue value) { value_ = value; } public ImplicitActivationPolicyValue value() { return value_; } public int policy_type() { return IMPLICIT_ACTIVATION_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,905
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/Delegate.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; // This class must be public public final class Delegate implements org.omg.PortableServer.portable.Delegate { private org.omg.CORBA.ORB orb_; private org.omg.CORBA.Object resolve(String name) { try { return orb_.resolve_initial_references(name); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { throw new org.omg.CORBA.INITIALIZE("Initial reference not found: " + name); } } // ------------------------------------------------------------------ // Standard IDL to Java Mapping // ------------------------------------------------------------------ public org.omg.CORBA.ORB orb(org.omg.PortableServer.Servant self) { return orb_; } public org.omg.CORBA.Object this_object(org.omg.PortableServer.Servant self) { // // Similar to PortableServant::ServantBase::_OB_createReference() // org.omg.CORBA.Object obj = null; org.omg.PortableServer.POA thePOA = self._default_POA(); org.apache.yoko.orb.OBPortableServer.POA_impl poaImpl = (org.apache.yoko.orb.OBPortableServer.POA_impl) thePOA; Current_impl current = poaImpl._OB_POACurrent(); // now that we have the current context, we need to use the current POA // for validating. try { poaImpl = (org.apache.yoko.orb.OBPortableServer.POA_impl)current.get_POA(); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { // we ignore the exception, and use the rootPOA for the activation, if possible. } // // If we're in an upcall to this servant, then obtain the object // reference for the target CORBA Object it is incarnating for // this request. // if (current._OB_inUpcall() && current._OB_getServant() == self) { try { byte[] oid = current.get_object_id(); String[] all = self._all_interfaces(thePOA, oid); obj = poaImpl.create_reference_with_id(oid, all[0]); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { org.apache.yoko.orb.OB.Assert._OB_assert(ex); } } else { try { obj = thePOA.servant_to_reference(self); } catch (org.omg.PortableServer.POAPackage.ServantNotActive ex) { throw new org.omg.CORBA.OBJ_ADAPTER("Servant is not active"); } catch (org.omg.PortableServer.POAPackage.WrongPolicy ex) { throw new org.omg.CORBA.OBJ_ADAPTER("Wrong policy"); } } return obj; } public org.omg.PortableServer.POA poa(org.omg.PortableServer.Servant self) { org.omg.PortableServer.Current current = org.omg.PortableServer.CurrentHelper .narrow(resolve("POACurrent")); try { return current.get_POA(); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { throw new org.omg.CORBA.OBJ_ADAPTER("No current context"); } } public byte[] object_id(org.omg.PortableServer.Servant self) { org.omg.PortableServer.Current current = org.omg.PortableServer.CurrentHelper .narrow(resolve("POACurrent")); try { return current.get_object_id(); } catch (org.omg.PortableServer.CurrentPackage.NoContext ex) { throw new org.omg.CORBA.OBJ_ADAPTER("No current context"); } } public org.omg.PortableServer.POA default_POA( org.omg.PortableServer.Servant self) { return org.omg.PortableServer.POAHelper.narrow(resolve("RootPOA")); } public boolean is_a(org.omg.PortableServer.Servant self, String repository_id) { if (repository_id.equals("IDL:omg.org/CORBA/Object:1.0")) return true; else { org.omg.PortableServer.POA poa = poa(self); byte[] objectId = object_id(self); String[] ids = self._all_interfaces(poa, objectId); for (int i = 0; i < ids.length; i++) if (repository_id.equals(ids[i])) return true; } return false; } public boolean non_existent(org.omg.PortableServer.Servant self) { return false; } public org.omg.CORBA.InterfaceDef get_interface( org.omg.PortableServer.Servant self) { org.omg.PortableServer.POA thePOA = self._default_POA(); org.apache.yoko.orb.OBPortableServer.POA_impl poaImpl = (org.apache.yoko.orb.OBPortableServer.POA_impl) thePOA; org.omg.CORBA.Object obj = null; try { org.apache.yoko.orb.OB.ORBInstance orbInstance = poaImpl ._OB_ORBInstance(); org.apache.yoko.orb.OB.InitialServiceManager initialServiceManager = orbInstance .getInitialServiceManager(); obj = initialServiceManager .resolveInitialReferences("InterfaceRepository"); } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { throw new org.omg.CORBA.INTF_REPOS( org.apache.yoko.orb.OB.MinorCodes .describeIntfRepos(org.apache.yoko.orb.OB.MinorCodes.MinorNoIntfRepos), org.apache.yoko.orb.OB.MinorCodes.MinorNoIntfRepos, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } if (obj == null) throw new org.omg.CORBA.INTF_REPOS( org.apache.yoko.orb.OB.MinorCodes .describeIntfRepos(org.apache.yoko.orb.OB.MinorCodes.MinorNoIntfRepos), org.apache.yoko.orb.OB.MinorCodes.MinorNoIntfRepos, org.omg.CORBA.CompletionStatus.COMPLETED_NO); org.omg.CORBA.Repository repository = null; try { repository = org.omg.CORBA.RepositoryHelper.narrow(obj); } catch (org.omg.CORBA.BAD_PARAM ex) // narrow failed { throw new org.omg.CORBA.INTF_REPOS( org.apache.yoko.orb.OB.MinorCodes .describeIntfRepos(org.apache.yoko.orb.OB.MinorCodes.MinorNoIntfRepos), org.apache.yoko.orb.OB.MinorCodes.MinorNoIntfRepos, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } byte[] objectId = object_id(self); String[] ids = self._all_interfaces(thePOA, objectId); org.omg.CORBA.Contained contained = repository.lookup_id(ids[0]); if (contained == null) return null; org.omg.CORBA.InterfaceDef result = null; try { result = org.omg.CORBA.InterfaceDefHelper.narrow(contained); } catch (org.omg.CORBA.BAD_PARAM ex) // narrow failed { // ignore } return result; } public org.omg.CORBA.Object get_interface_def( org.omg.PortableServer.Servant self) { return get_interface(self); } // ------------------------------------------------------------------ // Yoko internal functions // Application programs must not use these functions directly // ------------------------------------------------------------------ public Delegate(org.omg.CORBA.ORB orb) { orb_ = orb; } public org.omg.CORBA.portable.InputStream _OB_preUnmarshal( org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { return up.preUnmarshal(); } public void _OB_unmarshalEx(org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up, org.omg.CORBA.SystemException ex) throws org.apache.yoko.orb.OB.LocationForward { up.unmarshalEx(ex); } public void _OB_postUnmarshal(org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { up.postUnmarshal(); } public void _OB_postinvoke(org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { up.postinvoke(); } public org.omg.CORBA.portable.OutputStream _OB_preMarshal( org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { return up.preMarshal(); } public void _OB_marshalEx(org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up, org.omg.CORBA.SystemException ex) throws org.apache.yoko.orb.OB.LocationForward { up.unmarshalEx(ex); } public void _OB_postMarshal(org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { up.postMarshal(); } public void _OB_setArgDesc(org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up, org.apache.yoko.orb.OB.ParameterDesc[] argDesc, org.apache.yoko.orb.OB.ParameterDesc retDesc, org.omg.CORBA.TypeCode[] exceptionTC) { if (up instanceof org.apache.yoko.orb.OB.PIUpcall) { org.apache.yoko.orb.OB.PIUpcall piup = (org.apache.yoko.orb.OB.PIUpcall) up; piup.setArgDesc(argDesc, retDesc, exceptionTC); } } public org.omg.CORBA.portable.OutputStream _OB_beginUserException( org.omg.PortableServer.Servant self, org.apache.yoko.orb.OB.Upcall up, org.omg.CORBA.UserException ex) { return up.beginUserException(ex); } }
6,906
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/LifespanPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class LifespanPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.LifespanPolicy { private LifespanPolicyValue value_; public LifespanPolicy_impl(LifespanPolicyValue value) { value_ = value; } public LifespanPolicyValue value() { return value_; } public int policy_type() { return LIFESPAN_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,907
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/ThreadPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class ThreadPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.ThreadPolicy { private ThreadPolicyValue value_; public ThreadPolicy_impl(ThreadPolicyValue value) { value_ = value; } public ThreadPolicyValue value() { return value_; } public int policy_type() { return THREAD_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,908
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/IdAssignmentPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class IdAssignmentPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.IdAssignmentPolicy { private IdAssignmentPolicyValue value_; public IdAssignmentPolicy_impl(IdAssignmentPolicyValue value) { value_ = value; } public IdAssignmentPolicyValue value() { return value_; } public int policy_type() { return ID_ASSIGNMENT_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,909
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/RequestProcessingPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class RequestProcessingPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.RequestProcessingPolicy { private RequestProcessingPolicyValue value_; public RequestProcessingPolicy_impl(RequestProcessingPolicyValue value) { value_ = value; } public RequestProcessingPolicyValue value() { return value_; } public int policy_type() { return REQUEST_PROCESSING_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,910
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/Servant.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; // // Servant is the base class for proprietary skeletons with full // interceptor support // abstract public class Servant extends org.omg.PortableServer.Servant { protected org.omg.CORBA.portable.InputStream _OB_preUnmarshal( org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); return d._OB_preUnmarshal(this, up); } protected void _OB_unmarshalEx(org.apache.yoko.orb.OB.Upcall up, org.omg.CORBA.SystemException ex) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); d._OB_unmarshalEx(this, up, ex); } protected void _OB_postUnmarshal(org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); d._OB_postUnmarshal(this, up); } protected void _OB_postinvoke(org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); d._OB_postinvoke(this, up); } protected org.omg.CORBA.portable.OutputStream _OB_preMarshal( org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); return d._OB_preMarshal(this, up); } protected void _OB_marshalEx(org.apache.yoko.orb.OB.Upcall up, org.omg.CORBA.SystemException ex) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); d._OB_unmarshalEx(this, up, ex); } protected void _OB_postMarshal(org.apache.yoko.orb.OB.Upcall up) throws org.apache.yoko.orb.OB.LocationForward { Delegate d = (Delegate) _get_delegate(); d._OB_postMarshal(this, up); } protected void _OB_setArgDesc(org.apache.yoko.orb.OB.Upcall up, org.apache.yoko.orb.OB.ParameterDesc[] argDesc, org.apache.yoko.orb.OB.ParameterDesc retDesc, org.omg.CORBA.TypeCode[] exceptionTC) { Delegate d = (Delegate) _get_delegate(); d._OB_setArgDesc(this, up, argDesc, retDesc, exceptionTC); } protected org.omg.CORBA.portable.OutputStream _OB_beginUserException( org.apache.yoko.orb.OB.Upcall up, org.omg.CORBA.UserException ex) { Delegate d = (Delegate) _get_delegate(); return d._OB_beginUserException(this, up, ex); } abstract public void _OB_dispatch(org.apache.yoko.orb.OB.Upcall _ob_up) throws org.apache.yoko.orb.OB.LocationForward; }
6,911
0
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb
Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/PortableServer/IdUniquenessPolicy_impl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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. */ package org.apache.yoko.orb.PortableServer; import org.omg.PortableServer.*; public final class IdUniquenessPolicy_impl extends org.omg.CORBA.LocalObject implements org.omg.PortableServer.IdUniquenessPolicy { private IdUniquenessPolicyValue value_; public IdUniquenessPolicy_impl(IdUniquenessPolicyValue value) { value_ = value; } public IdUniquenessPolicyValue value() { return value_; } public int policy_type() { return ID_UNIQUENESS_POLICY_ID.value; } public org.omg.CORBA.Policy copy() { return this; } public void destroy() { } }
6,912
0
Create_ds/wire/wire-benchmarks/src/jmh/java/com/squareup/wire
Create_ds/wire/wire-benchmarks/src/jmh/java/com/squareup/wire/benchmarks/SimpleMessageBenchmark.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.benchmarks; import static java.util.concurrent.TimeUnit.MICROSECONDS; import static org.openjdk.jmh.annotations.Mode.SampleTime; import com.squareup.wire.ProtoWriter; import com.squareup.wire.ReverseProtoWriter; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import okio.Buffer; import okio.BufferedSource; import okio.Okio; import okio.Source; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import squareup.wire.benchmarks.EmailSearchResponse; import squareup.wire.benchmarks.EmailSearchResponseProto; @Fork(1) @Warmup(iterations = 5, time = 2) @Measurement(iterations = 5, time = 2) @State(Scope.Benchmark) @BenchmarkMode(SampleTime) @OutputTimeUnit(MICROSECONDS) public class SimpleMessageBenchmark { Buffer buffer = new Buffer(); byte[] bytes; @Setup public void setup() throws IOException { // `medium_value.bytes` contains bytes for the message // [squareup.wire.benchmarks.EmailSearchResponse]. File file = new File("src/main/resources/medium_value.bytes"); try (Source fileSource = Okio.source(file); BufferedSource bufferedFileSource = Okio.buffer(fileSource)) { bytes = bufferedFileSource.readByteArray(); } } @Benchmark public void encodeWire3x() throws IOException { ProtoWriter writer = new ProtoWriter(buffer); EmailSearchResponse.ADAPTER.encode(writer, SampleData.newMediumValueWire()); buffer.clear(); } @Benchmark public void encodeWire4x() throws IOException { ReverseProtoWriter writer = new ReverseProtoWriter(); EmailSearchResponse.ADAPTER.encode(writer, SampleData.newMediumValueWire()); writer.writeTo(buffer); buffer.clear(); } @Benchmark public void encodeProtobuf() throws IOException { SampleData.newMediumValueProtobuf().writeTo(buffer.outputStream()); buffer.clear(); } @Benchmark public void decodeWire() throws IOException { EmailSearchResponse.ADAPTER.decode(bytes); } @Benchmark public void decodeProtobuf() throws IOException { EmailSearchResponseProto.EmailSearchResponse.parseFrom(bytes); } /** Run encode for 10 seconds to capture a profile. */ public static void main(String[] args) throws IOException { long now = System.nanoTime(); long done = now + TimeUnit.SECONDS.toNanos(10L); SimpleMessageBenchmark benchmark = new SimpleMessageBenchmark(); benchmark.setup(); while (System.nanoTime() < done) { System.out.println("."); for (int i = 0; i < 1_000_000; i++) { benchmark.encodeWire4x(); } } } }
6,913
0
Create_ds/wire/wire-java-generator/src/test/java/com/squareup/wire
Create_ds/wire/wire-java-generator/src/test/java/com/squareup/wire/java/JavaGeneratorTest.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.wire.java; import static com.google.common.truth.Truth.assertThat; import static com.squareup.wire.schema.SchemaHelpersJvmKt.addFromTest; import static org.junit.Assert.fail; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.TypeSpec; import com.squareup.wire.SchemaBuilder; import com.squareup.wire.schema.MessageType; import com.squareup.wire.schema.PruningRules; import com.squareup.wire.schema.Schema; import java.io.IOException; import okio.Path; import org.junit.Test; public final class JavaGeneratorTest { @Test public void sanitizeJavadocStripsTrailingWhitespace() { String input = "The quick brown fox \nJumps over \n\t \t\nThe lazy dog "; String expected = "The quick brown fox\nJumps over\n\nThe lazy dog"; assertThat(JavaGenerator.sanitizeJavadoc(input)).isEqualTo(expected); } @Test public void sanitizeJavadocWrapsSeeLinks() { String input = "Google query.\n\n@see http://google.com"; String expected = "Google query.\n\n@see <a href=\"http://google.com\">http://google.com</a>"; assertThat(JavaGenerator.sanitizeJavadoc(input)).isEqualTo(expected); } @Test public void sanitizeJavadocStarSlash() { String input = "/* comment inside comment. */"; String expected = "/* comment inside comment. &#42;/"; assertThat(JavaGenerator.sanitizeJavadoc(input)).isEqualTo(expected); } @Test public void generateTypeUsesNameAllocatorInMessageBuilderBuild() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message Message {\n" + " required float long = 1;\n" + "}\n") .build(); assertThat(new JavaWithProfilesGenerator(schema).generateJava("Message")) .contains( "" + " @Override\n" + " public Message build() {\n" + " if (long_ == null) {\n" + " throw Internal.missingRequiredFields(long_, \"long\");\n" + " }\n" + " return new Message(long_, super.buildUnknownFields());\n" + " }\n"); } @Test public void tooManyFieldsTest() throws Exception { StringBuilder s = new StringBuilder(); for (int i = 1; i < 257; i++) { s.append(" repeated int32 field_" + i + " = " + i + ";\n"); } Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message Message {\n" + s.toString() + " oneof oneof_name {\n" + " int32 foo = 257;\n" + " int32 bar = 258;\n" + " }\n" + "}\n") .build(); assertThat(new JavaWithProfilesGenerator(schema).generateJava("Message")) .contains("" + "public Message(Builder builder, ByteString unknownFields)"); } @Test public void map() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message Message {\n" + " map<string, CdnResource> templates = 1;\n" + " message CdnResource {\n" + " }\n" + "}\n") .build(); MessageType message = (MessageType) schema.getType("Message"); JavaGenerator javaGenerator = JavaGenerator.get(schema); TypeSpec typeSpec = javaGenerator.generateType(message); assertThat(JavaFile.builder("", typeSpec).build().toString()) .contains( "" + " @WireField(\n" + " tag = 1,\n" + " keyAdapter = \"com.squareup.wire.ProtoAdapter#STRING\",\n" + " adapter = \"Message$CdnResource#ADAPTER\"\n" + " )\n" + " public final Map<String, CdnResource> templates;\n"); } @Test public void generateAbstractAdapter() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "package original.proto;\n" + "option java_package = \"original.java\";\n" + "import \"foo.proto\";\n" + "message ProtoMessage {\n" + " optional foo.proto.Foo field = 1;\n" + " repeated int32 numbers = 3;\n" + " optional foo.proto.CoinFlip coin_flip = 4;\n" + " map<string, foo.proto.Bar> bars = 2;\n" + "}\n") .add( Path.get("foo.proto"), "" + "package foo.proto;\n" + "option java_package = \"foo.java\";\n" + "message Foo {\n" + "}\n" + "message Bar {\n" + "}\n" + "enum CoinFlip {\n" + " HEADS = 1;\n" + " TAILS = 2;\n" + "}\n") .build(); assertThat( new JavaWithProfilesGenerator(schema) .withProfile( "android.wire", "" + "syntax = \"wire2\";\n" + "import \"message.proto\";\n" + "package original.proto;\n" + "type original.proto.ProtoMessage {\n" + " target target.java.JavaMessage using target.java.JavaMessage#ADAPTER;\n" + "}\n") .generateJava("original.proto.ProtoMessage", "android")) .isEqualTo( "" + "package original.java;\n" + "\n" + "import com.squareup.wire.FieldEncoding;\n" + "import com.squareup.wire.ProtoAdapter;\n" + "import com.squareup.wire.ProtoReader;\n" + "import com.squareup.wire.ProtoWriter;\n" + "import com.squareup.wire.ReverseProtoWriter;\n" + "import com.squareup.wire.Syntax;\n" + "import com.squareup.wire.internal.Internal;\n" + "import foo.java.Bar;\n" + "import foo.java.CoinFlip;\n" + "import foo.java.Foo;\n" + "import java.io.IOException;\n" + "import java.lang.Integer;\n" + "import java.lang.Override;\n" + "import java.lang.String;\n" + "import java.util.List;\n" + "import java.util.Map;\n" + "import target.java.JavaMessage;\n" + "\n" + "public abstract class AbstractProtoMessageAdapter extends ProtoAdapter<JavaMessage> {\n" + " private ProtoAdapter<Map<String, Bar>> bars;\n" + "\n" + " public AbstractProtoMessageAdapter() {\n" + " super(FieldEncoding.LENGTH_DELIMITED, JavaMessage.class, \"type.googleapis.com/original.proto.ProtoMessage\", Syntax.PROTO_2, null, \"message.proto\");\n" + " }\n" + "\n" + " public abstract Foo field(JavaMessage value);\n" + "\n" + " public abstract List<Integer> numbers(JavaMessage value);\n" + "\n" + " public abstract CoinFlip coin_flip(JavaMessage value);\n" + "\n" + " public abstract Map<String, Bar> bars(JavaMessage value);\n" + "\n" + " public abstract JavaMessage fromProto(Foo field, List<Integer> numbers, CoinFlip coin_flip,\n" + " Map<String, Bar> bars);\n" + "\n" + " @Override\n" + " public int encodedSize(JavaMessage value) {\n" + " int result = 0;\n" + " result += Foo.ADAPTER.encodedSizeWithTag(1, field(value));\n" + " result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(3, numbers(value));\n" + " result += CoinFlip.ADAPTER.encodedSizeWithTag(4, coin_flip(value));\n" + " result += barsAdapter().encodedSizeWithTag(2, bars(value));\n" + " return result;\n" + " }\n" + "\n" + " @Override\n" + " public void encode(ProtoWriter writer, JavaMessage value) throws IOException {\n" + " Foo.ADAPTER.encodeWithTag(writer, 1, field(value));\n" + " ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 3, numbers(value));\n" + " CoinFlip.ADAPTER.encodeWithTag(writer, 4, coin_flip(value));\n" + " barsAdapter().encodeWithTag(writer, 2, bars(value));\n" + " }\n" + "\n" + " @Override\n" + " public void encode(ReverseProtoWriter writer, JavaMessage value) throws IOException {\n" + " barsAdapter().encodeWithTag(writer, 2, bars(value));\n" + " CoinFlip.ADAPTER.encodeWithTag(writer, 4, coin_flip(value));\n" + " ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 3, numbers(value));\n" + " Foo.ADAPTER.encodeWithTag(writer, 1, field(value));\n" + " }\n" + "\n" + " @Override\n" + " public JavaMessage decode(ProtoReader reader) throws IOException {\n" + " Foo field = null;\n" + " Map<String, Bar> bars = Internal.newMutableMap();\n" + " List<Integer> numbers = Internal.newMutableList();\n" + " CoinFlip coin_flip = null;\n" + " long token = reader.beginMessage();\n" + " for (int tag; (tag = reader.nextTag()) != -1;) {\n" + " switch (tag) {\n" + " case 1: field = Foo.ADAPTER.decode(reader); break;\n" + " case 2: bars.putAll(barsAdapter().decode(reader)); break;\n" + " case 3: numbers.add(ProtoAdapter.INT32.decode(reader)); break;\n" + " case 4: {\n" + " try {\n" + " coin_flip = CoinFlip.ADAPTER.decode(reader);\n" + " } catch (ProtoAdapter.EnumConstantNotFoundException ignored) {\n" + " }\n" + " break;\n" + " }\n" + " default: {\n" + " reader.skip();\n" + " }\n" + " }\n" + " }\n" + " reader.endMessageAndGetUnknownFields(token);\n" + " return fromProto(field, numbers, coin_flip, bars);\n" + " }\n" + "\n" + " @Override\n" + " public JavaMessage redact(JavaMessage value) {\n" + " return value;\n" + " }\n" + "\n" + " private ProtoAdapter<Map<String, Bar>> barsAdapter() {\n" + " ProtoAdapter<Map<String, Bar>> result = bars;\n" + " if (result == null) {\n" + " result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, Bar.ADAPTER);\n" + " bars = result;\n" + " }\n" + " return result;\n" + " }\n" + "}\n"); } @Test public void generateAbstractAdapterForEnum() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "package original.proto;\n" + "message ProtoMessage {\n" + " optional CoinFlip coin_flip = 1;\n" + "}\n" + "enum CoinFlip {\n" + " // In Canada this is the Queen!\n" + " HEADS = 1;\n" + " TAILS = 2;\n" + "}\n") .build(); assertThat( new JavaWithProfilesGenerator(schema) .withProfile( "android.wire", "" + "syntax = \"wire2\";\n" + "import \"message.proto\";\n" + "package original.proto;\n" + "type original.proto.CoinFlip {\n" + " target target.java.JavaCoinFlip using target.java.JavaCoinFlip#ADAPTER;\n" + "}\n") .generateJava("original.proto.CoinFlip", "android")) .isEqualTo( "" + "package original.proto;\n" + "\n" + "import com.squareup.wire.FieldEncoding;\n" + "import com.squareup.wire.ProtoAdapter;\n" + "import com.squareup.wire.ProtoReader;\n" + "import com.squareup.wire.ProtoWriter;\n" + "import com.squareup.wire.ReverseProtoWriter;\n" + "import java.io.IOException;\n" + "import java.lang.Override;\n" + "import java.net.ProtocolException;\n" + "import target.java.JavaCoinFlip;\n" + "\n" + "public class CoinFlipAdapter extends ProtoAdapter<JavaCoinFlip> {\n" + " /**\n" + " * In Canada this is the Queen!\n" + " */\n" + " protected final JavaCoinFlip HEADS;\n" + "\n" + " protected final JavaCoinFlip TAILS;\n" + "\n" + " public CoinFlipAdapter(JavaCoinFlip HEADS, JavaCoinFlip TAILS) {\n" + " super(FieldEncoding.VARINT, JavaCoinFlip.class);\n" + " this.HEADS = HEADS;\n" + " this.TAILS = TAILS;\n" + " }\n" + "\n" + " protected int toValue(JavaCoinFlip value) {\n" + " if (value.equals(HEADS)) return 1;\n" + " if (value.equals(TAILS)) return 2;\n" + " return -1;\n" + " }\n" + "\n" + " protected JavaCoinFlip fromValue(int value) {\n" + " switch (value) {\n" + " case 1: return HEADS;\n" + " case 2: return TAILS;\n" + " default: throw new ProtoAdapter.EnumConstantNotFoundException(value, JavaCoinFlip.class);\n" + " }\n" + " }\n" + "\n" + " @Override\n" + " public int encodedSize(JavaCoinFlip value) {\n" + " return ProtoAdapter.UINT32.encodedSize(toValue(value));\n" + " }\n" + "\n" + " @Override\n" + " public void encode(ProtoWriter writer, JavaCoinFlip value) throws IOException {\n" + " int i = toValue(value);\n" + " if (i == -1) throw new ProtocolException(\"Unexpected enum constant: \" + value);\n" + " writer.writeVarint32(i);\n" + " }\n" + "\n" + " @Override\n" + " public void encode(ReverseProtoWriter writer, JavaCoinFlip value) throws IOException {\n" + " int i = toValue(value);\n" + " if (i == -1) throw new ProtocolException(\"Unexpected enum constant: \" + value);\n" + " writer.writeVarint32(i);\n" + " }\n" + "\n" + " @Override\n" + " public JavaCoinFlip decode(ProtoReader reader) throws IOException {\n" + " int value = reader.readVarint32();\n" + " return fromValue(value);\n" + " }\n" + "\n" + " @Override\n" + " public JavaCoinFlip redact(JavaCoinFlip value) {\n" + " return value;\n" + " }\n" + "}\n"); } @Test public void generateAbstractAdapterWithRedactedField() throws IOException { SchemaBuilder builder = new SchemaBuilder() .add( Path.get("message.proto"), "" + "import \"option_redacted.proto\";\n" + "message ProtoMessage {\n" + " optional string secret = 1 [(squareup.protos.redacted_option.redacted) = true];\n" + "}\n"); addFromTest(builder, Path.get("option_redacted.proto")); Schema schema = builder.build(); assertThat( new JavaWithProfilesGenerator(schema) .withProfile( "android.wire", "" + "syntax = \"wire2\";\n" + "import \"message.proto\";\n" + "type ProtoMessage {\n" + " target JavaMessage using JavaMessage#ADAPTER;\n" + "}\n") .generateJava("ProtoMessage", "android")) .contains( "" + " @Override\n" + " public JavaMessage redact(JavaMessage value) {\n" + " return null;\n" + " }\n"); } @Test public void nestedAbstractAdapterIsStatic() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message A {\n" + " message B {\n" + " optional string c = 1;\n" + " }\n" + "}\n") .build(); assertThat( new JavaWithProfilesGenerator(schema) .withProfile( "android.wire", "" + "syntax = \"wire2\";\n" + "import \"message.proto\";\n" + "type A.B {\n" + " target java.lang.String using AbAdapter#INSTANCE;\n" + "}\n") .generateJava("A", "android")) .contains( "" + " public abstract static class AbstractBAdapter extends ProtoAdapter<String> {\n"); } /** https://github.com/square/wire/issues/655 */ @Test public void defaultValues() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message Message {\n" + " optional int32 a = 1 [default = 10 ];\n" + " optional int32 b = 2 [default = 0x20 ];\n" + " optional int64 c = 3 [default = 11 ];\n" + " optional int64 d = 4 [default = 0x21 ];\n" + " optional float e = 5 [default = inf ];\n" + " optional double f = 6 [default = -inf ];\n" + " optional double g = 7 [default = nan ];\n" + " optional double h = 8 [default = -nan ];\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("Message"); assertThat(code).contains(" public static final Integer DEFAULT_A = 10;"); assertThat(code).contains(" public static final Integer DEFAULT_B = 32;"); assertThat(code).contains(" public static final Long DEFAULT_C = 11L;"); assertThat(code).contains(" public static final Long DEFAULT_D = 33L;"); assertThat(code).contains(" public static final Float DEFAULT_E = Float.POSITIVE_INFINITY;"); assertThat(code).contains(" public static final Double DEFAULT_F = Double.NEGATIVE_INFINITY;"); assertThat(code).contains(" public static final Double DEFAULT_G = Double.NaN;"); assertThat(code).contains(" public static final Double DEFAULT_H = Double.NaN;"); } @Test public void defaultValuesMustNotBeOctal() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message Message {\n" + " optional int32 a = 1 [default = 020 ];\n" + " optional int64 b = 2 [default = 021 ];\n" + "}\n") .build(); try { new JavaWithProfilesGenerator(schema).generateJava("Message"); fail(); } catch (IllegalStateException expected) { assertThat(expected).hasMessageThat().contains("Octal literal unsupported: 020"); } } @Test public void nullableFieldsWithoutParcelable() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message A {\n" + " message B {\n" + " optional string c = 1;\n" + " }\n" + "}\n") .build(); MessageType message = (MessageType) schema.getType("A"); JavaGenerator javaGenerator = JavaGenerator.get(schema).withAndroidAnnotations(true); TypeSpec typeSpec = javaGenerator.generateType(message); assertThat(JavaFile.builder("", typeSpec).build().toString()) .contains( "" + " @WireField(\n" + " tag = 1,\n" + " adapter = \"com.squareup.wire.ProtoAdapter#STRING\"\n" + " )\n" + " @Nullable\n" + " public final String c;"); } @Test public void unsortedTagsPrintSchemaIndex() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message A {\n" + " optional string two = 2;\n" + " optional string one = 1;\n" + "}\n") .build(); MessageType message = (MessageType) schema.getType("A"); JavaGenerator javaGenerator = JavaGenerator.get(schema).withAndroidAnnotations(true); TypeSpec typeSpec = javaGenerator.generateType(message); String javaOutput = JavaFile.builder("", typeSpec).build().toString(); System.out.println(javaOutput); assertThat(javaOutput) .contains( "" + " @WireField(\n" + " tag = 2,\n" + " adapter = \"com.squareup.wire.ProtoAdapter#STRING\"\n" + " )\n" + " @Nullable\n" + " public final String two;"); assertThat(javaOutput) .contains( "" + " @WireField(\n" + " tag = 1,\n" + " adapter = \"com.squareup.wire.ProtoAdapter#STRING\"\n" + " )\n" + " @Nullable\n" + " public final String one;"); } @Test public void androidSupport() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message A {\n" + " message B {\n" + " optional string c = 1;\n" + " }\n" + "}\n") .build(); MessageType message = (MessageType) schema.getType("A"); JavaGenerator javaGenerator = JavaGenerator.get(schema).withAndroid(true); TypeSpec typeSpec = javaGenerator.generateType(message); String javaOutput = JavaFile.builder("", typeSpec).build().toString(); assertThat(javaOutput) .contains( "" + " @WireField(\n" + " tag = 1,\n" + " adapter = \"com.squareup.wire.ProtoAdapter#STRING\"\n" + " )\n" + " public final String c;"); assertThat(javaOutput) .contains( "" + "public static final Parcelable.Creator<B> CREATOR = AndroidMessage.newCreator(ADAPTER)"); } @Test public void enclosingTypeIsNotMessage() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "message A {\n" + " message B {\n" + " }\n" + " optional B b = 1;\n" + "}\n") .build(); Schema pruned = schema.prune(new PruningRules.Builder().addRoot("A.B").build()); JavaGenerator javaGenerator = JavaGenerator.get(schema); TypeSpec typeSpec = javaGenerator.generateType(pruned.getType("A")); String javaOutput = JavaFile.builder("", typeSpec).build().toString(); assertThat(javaOutput) .contains( "" + "public final class A {\n" + " private A() {\n" + " throw new AssertionError();\n" + " }"); assertThat(javaOutput).contains("public static final class B extends Message<B, B.Builder> {"); } @Test public void generateTypeUsesPackageNameOnFieldAndClassNameClash() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("person.proto"), "" + "package common.proto;\n" + "enum Gender {\n" + " Gender_Male = 0;\n" + " Gender_Female = 1;\n" + "}\n" + "message Person {\n" + " optional Gender Gender = 1;\n" + "}\n") .build(); assertThat(new JavaWithProfilesGenerator(schema).generateJava("common.proto.Person")) .contains("public final Gender common_proto_Gender;"); } @Test public void buildersOnlyGeneratesNonPublicConstructors() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("message.proto"), "" + "syntax = \"proto2\";\n" + "message SomeMessage {\n" + " optional string a = 1;\n" + " optional string b = 2;\n" + " message InnerMessage {\n" + " optional string c = 3;\n" + " optional string d = 8;\n" + " }\n" + "}\n") .build(); String javaOutput = new JavaWithProfilesGenerator(schema) .generateJava("SomeMessage", null /* profileName */, true /* buildersOnly */); assertThat(javaOutput).contains(" SomeMessage("); assertThat(javaOutput).contains(" InnerMessage("); assertThat(javaOutput).doesNotContain("public SomeMessage("); assertThat(javaOutput).doesNotContain("public InnerMessage("); } @Test public void generateTypeUsesPackageNameOnFieldAndClassNameClashWithinPackage() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("a.proto"), "" + "package common.proto;\n" + "enum Status {\n" + " Status_Approved = 0;\n" + " Status_Denied = 1;\n" + "}\n" + "enum AnotherStatus {\n" + " AnotherStatus_Processing = 0;\n" + " AnotherStatus_Completed = 1;\n" + "}\n" + "message A {\n" + " message B {\n" + " optional Status Status = 1;\n" + " }\n" + " repeated B b = 1;" + " optional AnotherStatus Status = 2;\n" + "}\n") .build(); assertThat(new JavaWithProfilesGenerator(schema).generateJava("common.proto.A")) .contains("public final AnotherStatus common_proto_Status;"); } @Test public void fieldHasScalarName() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("example.proto"), "" + "package squareup.testing.wire;\n" + "\n" + "option java_package = \"com.squareup.testing.wire\";\n" + "\n" + "message Data {\n" + " optional string string = 1;\n" + " repeated string values = 2;\n" + "}\n") .build(); assertThat(new JavaWithProfilesGenerator(schema).generateJava("squareup.testing.wire.Data")) .contains( "" + " public Builder string(String string) {\n" + " this.string = string;\n" + " return this;\n" + " }"); } @Test public void sanitizeStringsOnPrinting() throws Exception { Schema schema = new SchemaBuilder() .add( Path.get("example.proto"), "" + "message Person {\n" + " required string name = 1;\n" + " required int32 id = 2;\n" + " repeated PhoneNumber phone = 3;\n" + " repeated string aliases = 4;\n" + "\n" + " message PhoneNumber {\n" + " required string number = 1;\n" + " optional PhoneType type = 2 [default = HOME];\n" + " }\n" + " enum PhoneType {\n" + " HOME = 0;\n" + " WORK = 1;\n" + " MOBILE = 2;\n" + " }\n" + "}\n") .build(); String generatedCode = new JavaWithProfilesGenerator(schema).generateJava("Person"); assertThat(generatedCode) .contains( "" + " public String toString() {\n" + " StringBuilder builder = new StringBuilder();\n" + " builder.append(\", name=\").append(Internal.sanitize(name));\n" + " builder.append(\", id=\").append(id);\n" + " if (!phone.isEmpty()) builder.append(\", phone=\").append(phone);\n" + " if (!aliases.isEmpty()) builder.append(\", aliases=\").append(Internal.sanitize(aliases));\n" + " return builder.replace(0, 2, \"Person{\").append('}').toString();\n" + " }"); assertThat(generatedCode) .contains( "" + " public String toString() {\n" + " StringBuilder builder = new StringBuilder();\n" + " builder.append(\", number=\").append(Internal.sanitize(number));\n" + " if (type != null) builder.append(\", type=\").append(type);\n" + " return builder.replace(0, 2, \"PhoneNumber{\").append('}').toString();\n" + " }"); } @Test public void wirePackageTakesPrecedenceOverJavaPackage() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "import \"wire/extensions.proto\";\n" + "\n" + "option java_package = \"java_package\";\n" + "option (wire.wire_package) = \"wire_package\";\n" + "\n" + "message Person {\n" + " required string name = 1;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("proto_package.Person"); assertThat(code).contains("package wire_package"); assertThat(code).contains("class Person"); } @Test public void wirePackageTakesPrecedenceOverProtoPackage() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "import \"wire/extensions.proto\";\n" + "\n" + "option (wire.wire_package) = \"wire_package\";\n" + "\n" + "message Person {\n" + " required string name = 1;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("proto_package.Person"); assertThat(code).contains("package wire_package"); assertThat(code).contains("class Person"); } @Test public void packageNameUsedIfFieldNameIsSameAsNonScalarTypeName() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("common/common_message.proto"), "package a.Common;\n" + "option java_package = \"a.common\";" + "message CommonMessage {\n" + " required string First = 1;\n" + "}\n") .add( Path.get("example.proto"), "package a;\n" + "import \"common/common_message.proto\";\n" + "\n" + "message Example {\n" + " required Common.CommonMessage CommonMessage = 1;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("a.Example"); assertThat(code).contains("package a"); assertThat(code).contains("import a.common.CommonMessage"); assertThat(code).contains("public CommonMessage a_CommonMessage"); } @Test public void wirePackageUsedInImport() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "import \"wire/extensions.proto\";\n" + "\n" + "option (wire.wire_package) = \"wire_package\";\n" + "\n" + "message Person {\n" + " required string name = 1;\n" + "}\n") .add( Path.get("city_package/home.proto"), "package city_package;\n" + "import \"proto_package/person.proto\";\n" + "\n" + "message Home {\n" + " repeated proto_package.Person person = 1;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("city_package.Home"); assertThat(code).contains("package city_package"); assertThat(code).contains("import wire_package.Person"); } @Test public void deprecatedEnum() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "enum Direction {\n" + " option deprecated = true;\n" + " NORTH = 1;\n" + " EAST = 2;\n" + " SOUTH = 3;\n" + " WEST = 4;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("proto_package.Direction"); assertThat(code).contains("@Deprecated\npublic enum Direction"); } @Test public void deprecatedEnumConstant() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "enum Direction {\n" + " NORTH = 1;\n" + " EAST = 2 [deprecated = true];\n" + " SOUTH = 3;\n" + " WEST = 4;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("proto_package.Direction"); assertThat(code).contains(" @Deprecated\n EAST(2)"); } @Test public void deprecatedField() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "message Person {\n" + " optional string name = 1 [deprecated = true];\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("proto_package.Person"); assertThat(code).contains(" @Deprecated\n public final String name;"); } @Test public void deprecatedMessage() throws IOException { Schema schema = new SchemaBuilder() .add( Path.get("proto_package/person.proto"), "package proto_package;\n" + "message Person {\n" + " option deprecated = true;\n" + " optional string name = 1;\n" + "}\n") .build(); String code = new JavaWithProfilesGenerator(schema).generateJava("proto_package.Person"); assertThat(code).contains("@Deprecated\npublic final class Person"); } }
6,914
0
Create_ds/wire/wire-java-generator/src/main/java/com/squareup/wire
Create_ds/wire/wire-java-generator/src/main/java/com/squareup/wire/java/JavaGenerator.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.wire.java; import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.wire.schema.internal.JvmLanguages.annotationName; import static com.squareup.wire.schema.internal.JvmLanguages.annotationTargetType; import static com.squareup.wire.schema.internal.JvmLanguages.builtInAdapterString; import static com.squareup.wire.schema.internal.JvmLanguages.eligibleAsAnnotationMember; import static com.squareup.wire.schema.internal.JvmLanguages.hasEponymousType; import static com.squareup.wire.schema.internal.JvmLanguages.javaPackage; import static com.squareup.wire.schema.internal.JvmLanguages.legacyQualifiedFieldName; import static com.squareup.wire.schema.internal.JvmLanguages.optionValueToInt; import static com.squareup.wire.schema.internal.JvmLanguages.optionValueToLong; import static javax.lang.model.element.Modifier.ABSTRACT; import static javax.lang.model.element.Modifier.FINAL; import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PROTECTED; import static javax.lang.model.element.Modifier.PUBLIC; import static javax.lang.model.element.Modifier.STATIC; import com.google.common.base.Charsets; import com.google.common.base.Joiner; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Ordering; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ArrayTypeName; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.NameAllocator; import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.WildcardTypeName; import com.squareup.wire.EnumAdapter; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoAdapter.EnumConstantNotFoundException; 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 com.squareup.wire.schema.AdapterConstant; import com.squareup.wire.schema.EnclosingType; import com.squareup.wire.schema.EnumConstant; import com.squareup.wire.schema.EnumType; import com.squareup.wire.schema.Extend; import com.squareup.wire.schema.Field; import com.squareup.wire.schema.MessageType; import com.squareup.wire.schema.OneOf; import com.squareup.wire.schema.Options; import com.squareup.wire.schema.Profile; import com.squareup.wire.schema.ProtoFile; import com.squareup.wire.schema.ProtoMember; import com.squareup.wire.schema.ProtoType; import com.squareup.wire.schema.Schema; import com.squareup.wire.schema.Service; import com.squareup.wire.schema.Type; import com.squareup.wire.schema.internal.NameFactory; import java.io.IOException; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.net.ProtocolException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; import javax.annotation.Nullable; import okio.ByteString; /** * Generates Java source code that matches proto definitions. * * <p>This can map type names from protocol buffers (like {@code uint32}, {@code string}, or {@code * squareup.protos.person.Person} to the corresponding Java names (like {@code int}, {@code * java.lang.String}, or {@code com.squareup.protos.person.Person}). */ public final class JavaGenerator { static final ClassName BYTE_STRING = ClassName.get(ByteString.class); static final ClassName STRING = ClassName.get(String.class); static final ClassName LIST = ClassName.get(List.class); static final ClassName MESSAGE = ClassName.get(Message.class); static final ClassName ANDROID_MESSAGE = MESSAGE.peerClass("AndroidMessage"); static final ClassName ADAPTER = ClassName.get(ProtoAdapter.class); static final ClassName BUILDER = ClassName.get(Message.Builder.class); static final ClassName ENUM_ADAPTER = ClassName.get(EnumAdapter.class); static final ClassName NULLABLE = ClassName.get("androidx.annotation", "Nullable"); static final ClassName CREATOR = ClassName.get("android.os", "Parcelable", "Creator"); private static final Ordering<Field> TAG_ORDERING = Ordering.from( new Comparator<Field>() { @Override public int compare(Field o1, Field o2) { return Integer.compare(o1.getTag(), o2.getTag()); } }); public static boolean builtInType(ProtoType protoType) { return BUILT_IN_TYPES_MAP.containsKey(protoType); } private static final Map<ProtoType, TypeName> BUILT_IN_TYPES_MAP = ImmutableMap.<ProtoType, TypeName>builder() .put(ProtoType.BOOL, TypeName.BOOLEAN) .put(ProtoType.BYTES, ClassName.get(ByteString.class)) .put(ProtoType.DOUBLE, TypeName.DOUBLE) .put(ProtoType.FLOAT, TypeName.FLOAT) .put(ProtoType.FIXED32, TypeName.INT) .put(ProtoType.FIXED64, TypeName.LONG) .put(ProtoType.INT32, TypeName.INT) .put(ProtoType.INT64, TypeName.LONG) .put(ProtoType.SFIXED32, TypeName.INT) .put(ProtoType.SFIXED64, TypeName.LONG) .put(ProtoType.SINT32, TypeName.INT) .put(ProtoType.SINT64, TypeName.LONG) .put(ProtoType.STRING, ClassName.get(String.class)) .put(ProtoType.UINT32, TypeName.INT) .put(ProtoType.UINT64, TypeName.LONG) .put(ProtoType.ANY, ClassName.get("com.squareup.wire", "AnyMessage")) .put(ProtoType.DURATION, ClassName.get("java.time", "Duration")) .put(ProtoType.TIMESTAMP, ClassName.get("java.time", "Instant")) .put(ProtoType.EMPTY, ClassName.get("kotlin", "Unit")) .put( ProtoType.STRUCT_MAP, ParameterizedTypeName.get( ClassName.get("java.util", "Map"), ClassName.get("java.lang", "String"), WildcardTypeName.subtypeOf(Object.class))) .put(ProtoType.STRUCT_VALUE, ClassName.get("java.lang", "Object")) .put(ProtoType.STRUCT_NULL, ClassName.get("java.lang", "Void")) .put( ProtoType.STRUCT_LIST, ParameterizedTypeName.get( ClassName.get("java.util", "List"), WildcardTypeName.subtypeOf(Object.class))) .put(ProtoType.DOUBLE_VALUE, TypeName.DOUBLE) .put(ProtoType.FLOAT_VALUE, TypeName.FLOAT) .put(ProtoType.INT64_VALUE, TypeName.LONG) .put(ProtoType.UINT64_VALUE, TypeName.LONG) .put(ProtoType.INT32_VALUE, TypeName.INT) .put(ProtoType.UINT32_VALUE, TypeName.INT) .put(ProtoType.BOOL_VALUE, TypeName.BOOLEAN) .put(ProtoType.STRING_VALUE, ClassName.get(String.class)) .put(ProtoType.BYTES_VALUE, ClassName.get(ByteString.class)) .build(); private static final Map<ProtoType, CodeBlock> PROTOTYPE_TO_IDENTITY_VALUES = ImmutableMap.<ProtoType, CodeBlock>builder() .put(ProtoType.BOOL, CodeBlock.of("false")) .put(ProtoType.STRING, CodeBlock.of("\"\"")) .put(ProtoType.BYTES, CodeBlock.of("$T.$L", ByteString.class, "EMPTY")) .put(ProtoType.DOUBLE, CodeBlock.of("0.0")) .put(ProtoType.FLOAT, CodeBlock.of("0f")) .put(ProtoType.FIXED64, CodeBlock.of("0L")) .put(ProtoType.INT64, CodeBlock.of("0L")) .put(ProtoType.SFIXED64, CodeBlock.of("0L")) .put(ProtoType.SINT64, CodeBlock.of("0L")) .put(ProtoType.UINT64, CodeBlock.of("0L")) .put(ProtoType.FIXED32, CodeBlock.of("0")) .put(ProtoType.INT32, CodeBlock.of("0")) .put(ProtoType.SFIXED32, CodeBlock.of("0")) .put(ProtoType.SINT32, CodeBlock.of("0")) .put(ProtoType.UINT32, CodeBlock.of("0")) .build(); private static final String URL_CHARS = "[-!#$%&'()*+,./0-9:;=?@A-Z\\[\\]_a-z~]"; private static final int MAX_PARAMS_IN_CONSTRUCTOR = 16; private static final String DOUBLE_FULL_BLOCK = "\u2588\u2588"; /** * Preallocate all of the names we'll need for {@code type}. Names are allocated in precedence * order, so names we're stuck with (serialVersionUID etc.) occur before proto field names are * assigned. * * <p>Name allocations are computed once and reused because some types may be needed when * generating other types. */ private final LoadingCache<Type, NameAllocator> nameAllocators = CacheBuilder.newBuilder() .build( new CacheLoader<Type, NameAllocator>() { @Override public NameAllocator load(Type type) throws Exception { NameAllocator nameAllocator = new NameAllocator(); if (type instanceof MessageType) { nameAllocator.newName("serialVersionUID", "serialVersionUID"); nameAllocator.newName("ADAPTER", "ADAPTER"); nameAllocator.newName("MESSAGE_OPTIONS", "MESSAGE_OPTIONS"); if (emitAndroid) { nameAllocator.newName("CREATOR", "CREATOR"); } List<Field> fieldsAndOneOfFields = ((MessageType) type).getFieldsAndOneOfFields(); Set<String> collidingNames = collidingFieldNames(fieldsAndOneOfFields); for (Field field : fieldsAndOneOfFields) { String suggestion = collidingNames.contains(field.getName()) || (field.getName().equals(field.getType().getSimpleName()) && !field.getType().isScalar()) || hasEponymousType(schema, field) ? legacyQualifiedFieldName(field) : field.getName(); nameAllocator.newName(suggestion, field); } } else if (type instanceof EnumType) { nameAllocator.newName("value", "value"); nameAllocator.newName("i", "i"); nameAllocator.newName("reader", "reader"); nameAllocator.newName("writer", "writer"); for (EnumConstant constant : ((EnumType) type).getConstants()) { nameAllocator.newName(constant.getName(), constant); } } return nameAllocator; } }); private final Schema schema; /** Proto type to the corresponding Java type. This honors the Java package extension. */ private final ImmutableMap<ProtoType, TypeName> typeToJavaName; /** Proto member to the corresponding Java type. This is only used for extension fields. */ private final ImmutableMap<ProtoMember, TypeName> memberToJavaName; private final Profile profile; private final boolean emitAndroid; private final boolean emitAndroidAnnotations; private final boolean emitCompact; private final boolean emitDeclaredOptions; private final boolean emitAppliedOptions; private final boolean buildersOnly; private JavaGenerator( Schema schema, Map<ProtoType, TypeName> typeToJavaName, Map<ProtoMember, TypeName> memberToJavaName, Profile profile, boolean emitAndroid, boolean emitAndroidAnnotations, boolean emitCompact, boolean emitDeclaredOptions, boolean emitAppliedOptions, boolean buildersOnly) { this.schema = schema; this.typeToJavaName = ImmutableMap.copyOf(typeToJavaName); this.memberToJavaName = ImmutableMap.copyOf(memberToJavaName); this.profile = profile; this.emitAndroid = emitAndroid; this.emitAndroidAnnotations = emitAndroidAnnotations; this.emitCompact = emitCompact; this.emitDeclaredOptions = emitDeclaredOptions; this.emitAppliedOptions = emitAppliedOptions; this.buildersOnly = buildersOnly; } public JavaGenerator withAndroid(boolean emitAndroid) { return new JavaGenerator( schema, typeToJavaName, memberToJavaName, profile, emitAndroid, emitAndroidAnnotations, emitCompact, emitDeclaredOptions, emitAppliedOptions, buildersOnly); } public JavaGenerator withAndroidAnnotations(boolean emitAndroidAnnotations) { return new JavaGenerator( schema, typeToJavaName, memberToJavaName, profile, emitAndroid, emitAndroidAnnotations, emitCompact, emitDeclaredOptions, emitAppliedOptions, buildersOnly); } public JavaGenerator withCompact(boolean emitCompact) { return new JavaGenerator( schema, typeToJavaName, memberToJavaName, profile, emitAndroid, emitAndroidAnnotations, emitCompact, emitDeclaredOptions, emitAppliedOptions, buildersOnly); } public JavaGenerator withProfile(Profile profile) { return new JavaGenerator( schema, typeToJavaName, memberToJavaName, profile, emitAndroid, emitAndroidAnnotations, emitCompact, emitDeclaredOptions, emitAppliedOptions, buildersOnly); } public JavaGenerator withOptions(boolean emitDeclaredOptions, boolean emitAppliedOptions) { return new JavaGenerator( schema, typeToJavaName, memberToJavaName, profile, emitAndroid, emitAndroidAnnotations, emitCompact, emitDeclaredOptions, emitAppliedOptions, buildersOnly); } public JavaGenerator withBuildersOnly(boolean buildersOnly) { return new JavaGenerator( schema, typeToJavaName, memberToJavaName, profile, emitAndroid, emitAndroidAnnotations, emitCompact, emitDeclaredOptions, emitAppliedOptions, buildersOnly); } public static JavaGenerator get(Schema schema) { Map<ProtoType, TypeName> nameToJavaName = new LinkedHashMap<>(); Map<ProtoMember, TypeName> memberToJavaName = new LinkedHashMap<>(); for (ProtoFile protoFile : schema.getProtoFiles()) { String javaPackage = javaPackage(protoFile); putAll(nameToJavaName, javaPackage, null, protoFile.getTypes()); for (Service service : protoFile.getServices()) { ClassName className = ClassName.get(javaPackage, service.type().getSimpleName()); nameToJavaName.put(service.type(), className); } putAllExtensions( schema, protoFile, protoFile.getTypes(), protoFile.getExtendList(), memberToJavaName); } nameToJavaName.putAll(BUILT_IN_TYPES_MAP); return new JavaGenerator( schema, nameToJavaName, memberToJavaName, new Profile(), false /* emitAndroid */, false /* emitAndroidAnnotations */, false /* emitCompact */, false /* emitDeclaredOptions */, false /* emitAppliedOptions */, false /* buildersOnly */); } private static void putAllExtensions( Schema schema, ProtoFile protoFile, List<Type> types, List<Extend> extendList, Map<ProtoMember, TypeName> memberToJavaName) { for (Extend extend : extendList) { if (annotationTargetType(extend) == null) continue; for (Field field : extend.getFields()) { if (!eligibleAsAnnotationMember(schema, field)) continue; ProtoMember protoMember = extend.member(field); memberToJavaName.put(protoMember, annotationName(protoFile, field, new ClassNameFactory())); } } for (Type type : types) { putAllExtensions( schema, protoFile, type.getNestedTypes(), type.getNestedExtendList(), memberToJavaName); } } private static class ClassNameFactory implements NameFactory<ClassName> { @Override public ClassName newName(String packageName, String simpleName) { return ClassName.get(packageName, simpleName); } @Override public ClassName nestedName(ClassName enclosing, String simpleName) { return enclosing.nestedClass(simpleName); } } private static void putAll( Map<ProtoType, TypeName> wireToJava, String javaPackage, ClassName enclosingClassName, List<Type> types) { for (Type type : types) { ClassName className = enclosingClassName != null ? enclosingClassName.nestedClass(type.getType().getSimpleName()) : ClassName.get(javaPackage, type.getType().getSimpleName()); wireToJava.put(type.getType(), className); putAll(wireToJava, javaPackage, className, type.getNestedTypes()); } } public Schema schema() { return schema; } /** * Returns the Java type for {@code protoType}. * * @throws IllegalArgumentException if there is no known Java type for {@code protoType}, such as * if that type wasn't in this generator's schema. */ public TypeName typeName(ProtoType protoType) { TypeName profileJavaName = profile.javaTarget(protoType); if (profileJavaName != null) return profileJavaName; TypeName candidate = typeToJavaName.get(protoType); checkArgument(candidate != null, "unexpected type %s", protoType); return candidate; } /** * Returns the Java type of the abstract adapter class generated for a corresponding {@code * protoType}. Returns null if {@code protoType} is not using a custom proto adapter. */ public @Nullable ClassName abstractAdapterName(ProtoType protoType) { TypeName profileJavaName = profile.javaTarget(protoType); if (profileJavaName == null) return null; TypeName typeName = typeToJavaName.get(protoType); Type type = schema.getType(protoType); ClassName javaName; if (typeName instanceof ClassName) { javaName = (ClassName) typeName; } else if (typeName instanceof ParameterizedTypeName) { javaName = ((ParameterizedTypeName) typeName).rawType; } else { throw new IllegalArgumentException("Unexpected typeName :" + typeName); } return type instanceof EnumType ? javaName.peerClass(javaName.simpleName() + "Adapter") : javaName.peerClass("Abstract" + javaName.simpleName() + "Adapter"); } private CodeBlock singleAdapterFor(Field field, NameAllocator nameAllocator) { return field.getType().isMap() ? CodeBlock.of("$NAdapter()", nameAllocator.get(field)) : singleAdapterFor(field.getType()); } private CodeBlock singleAdapterFor(ProtoType type) { CodeBlock.Builder result = CodeBlock.builder(); if (type.isScalar()) { result.add("$T.$L", ADAPTER, type.getSimpleName().toUpperCase(Locale.US)); } else if (type.equals(ProtoType.DURATION)) { result.add("$T.$L", ADAPTER, "DURATION"); } else if (type.equals(ProtoType.TIMESTAMP)) { result.add("$T.$L", ADAPTER, "INSTANT"); } else if (type.equals(ProtoType.EMPTY)) { result.add("$T.$L", ADAPTER, "EMPTY"); } else if (type.equals(ProtoType.STRUCT_MAP)) { result.add("$T.$L", ADAPTER, "STRUCT_MAP"); } else if (type.equals(ProtoType.STRUCT_VALUE)) { result.add("$T.$L", ADAPTER, "STRUCT_VALUE"); } else if (type.equals(ProtoType.STRUCT_NULL)) { result.add("$T.$L", ADAPTER, "STRUCT_NULL"); } else if (type.equals(ProtoType.STRUCT_LIST)) { result.add("$T.$L", ADAPTER, "STRUCT_LIST"); } else if (type.equals(ProtoType.DOUBLE_VALUE)) { result.add("$T.$L", ADAPTER, "DOUBLE_VALUE"); } else if (type.equals(ProtoType.FLOAT_VALUE)) { result.add("$T.$L", ADAPTER, "FLOAT_VALUE"); } else if (type.equals(ProtoType.INT64_VALUE)) { result.add("$T.$L", ADAPTER, "INT64_VALUE"); } else if (type.equals(ProtoType.UINT64_VALUE)) { result.add("$T.$L", ADAPTER, "UINT64_VALUE"); } else if (type.equals(ProtoType.INT32_VALUE)) { result.add("$T.$L", ADAPTER, "INT32_VALUE"); } else if (type.equals(ProtoType.UINT32_VALUE)) { result.add("$T.$L", ADAPTER, "UINT32_VALUE"); } else if (type.equals(ProtoType.BOOL_VALUE)) { result.add("$T.$L", ADAPTER, "BOOL_VALUE"); } else if (type.equals(ProtoType.STRING_VALUE)) { result.add("$T.$L", ADAPTER, "STRING_VALUE"); } else if (type.equals(ProtoType.BYTES_VALUE)) { result.add("$T.$L", ADAPTER, "BYTES_VALUE"); } else if (type.isMap()) { throw new IllegalArgumentException("Cannot create single adapter for map type " + type); } else { AdapterConstant adapterConstant = profile.getAdapter(type); if (adapterConstant != null) { result.add("$T.$L", adapterConstant.javaClassName, adapterConstant.memberName); } else { result.add("$T.ADAPTER", typeName(type)); } } return result.build(); } private CodeBlock adapterFor(Field field, NameAllocator nameAllocator) { CodeBlock.Builder result = singleAdapterFor(field, nameAllocator).toBuilder(); if (field.isPacked()) { result.add(".asPacked()"); } else if (field.isRepeated()) { result.add(".asRepeated()"); } return result.build(); } public boolean isEnum(ProtoType type) { return schema.getType(type) instanceof EnumType; } EnumConstant enumDefault(ProtoType type) { EnumType wireEnum = (EnumType) schema.getType(type); return wireEnum.getConstants().get(0); } static TypeName listOf(TypeName type) { return ParameterizedTypeName.get(LIST, type); } static TypeName messageOf(ClassName messageType, TypeName type, ClassName builderType) { return ParameterizedTypeName.get(messageType, type, builderType); } static TypeName adapterOf(TypeName messageType) { return ParameterizedTypeName.get(ADAPTER, messageType); } static TypeName builderOf(TypeName messageType, ClassName builderType) { return ParameterizedTypeName.get(BUILDER, messageType, builderType); } static TypeName creatorOf(TypeName messageType) { return ParameterizedTypeName.get(CREATOR, messageType); } static TypeName enumAdapterOf(TypeName enumType) { return ParameterizedTypeName.get(ENUM_ADAPTER, enumType); } /** A grab-bag of fixes for things that can go wrong when converting to javadoc. */ static String sanitizeJavadoc(String documentation) { // Remove trailing whitespace on each line. documentation = documentation.replaceAll("[^\\S\n]+\n", "\n"); documentation = documentation.replaceAll("\\s+$", ""); documentation = documentation.replaceAll("\\*/", "&#42;/"); // Rewrite '@see <url>' to use an html anchor tag documentation = documentation.replaceAll("@see (http:" + URL_CHARS + "+)", "@see <a href=\"$1\">$1</a>"); return documentation; } /** Returns the full name of the class generated for {@code type}. */ public ClassName generatedTypeName(Type type) { ClassName abstractAdapterName = abstractAdapterName(type.getType()); return abstractAdapterName != null ? abstractAdapterName : (ClassName) typeName(type.getType()); } /** Returns the generated code for {@code type}, which may be a top-level or a nested type. */ public TypeSpec generateType(Type type) { AdapterConstant adapterConstant = profile.getAdapter(type.getType()); if (adapterConstant != null) { return generateAdapterForCustomType(type); } if (type instanceof MessageType) { return generateMessage((MessageType) type); } if (type instanceof EnumType) { return generateEnum((EnumType) type); } if (type instanceof EnclosingType) { return generateEnclosingType((EnclosingType) type); } throw new IllegalStateException("Unknown type: " + type); } private TypeSpec generateEnum(EnumType type) { NameAllocator nameAllocator = nameAllocators.getUnchecked(type); String value = nameAllocator.get("value"); ClassName javaType = (ClassName) typeName(type.getType()); TypeSpec.Builder builder = TypeSpec.enumBuilder(javaType.simpleName()) .addModifiers(PUBLIC) .addSuperinterface(WireEnum.class); if (!type.getDocumentation().isEmpty()) { builder.addJavadoc("$L\n", sanitizeJavadoc(type.getDocumentation())); } for (AnnotationSpec annotation : optionAnnotations(type.getOptions())) { builder.addAnnotation(annotation); } if (type.isDeprecated()) { builder.addAnnotation(Deprecated.class); } // Output Private tag field builder.addField(TypeName.INT, value, PRIVATE, FINAL); // Enum constructor takes the constant tag. builder.addMethod( MethodSpec.constructorBuilder() .addStatement("this.$1N = $1N", value) .addParameter(TypeName.INT, value) .build()); MethodSpec.Builder fromValueBuilder = MethodSpec.methodBuilder("fromValue") .addJavadoc("Return the constant for {@code $N} or null.\n", value) .addModifiers(PUBLIC, STATIC) .returns(javaType) .addParameter(int.class, value) .beginControlFlow("switch ($N)", value); Set<Integer> seenTags = new LinkedHashSet<>(); for (EnumConstant constant : type.getConstants()) { TypeSpec.Builder constantBuilder = TypeSpec.anonymousClassBuilder("$L", constant.getTag()); if (!constant.getDocumentation().isEmpty()) { constantBuilder.addJavadoc("$L\n", sanitizeJavadoc(constant.getDocumentation())); } for (AnnotationSpec annotation : optionAnnotations(constant.getOptions())) { constantBuilder.addAnnotation(annotation); } AnnotationSpec wireEnumConstantAnnotation = wireEnumConstantAnnotation(nameAllocator, constant); if (wireEnumConstantAnnotation != null) { constantBuilder.addAnnotation(wireEnumConstantAnnotation); } if (constant.isDeprecated()) { constantBuilder.addAnnotation(Deprecated.class); } builder.addEnumConstant(nameAllocator.get(constant), constantBuilder.build()); // Ensure constant case tags are unique, which might not be the case if allow_alias is true. if (seenTags.add(constant.getTag())) { fromValueBuilder.addStatement( "case $L: return $L", constant.getTag(), nameAllocator.get(constant)); } } builder.addMethod( fromValueBuilder.addStatement("default: return null").endControlFlow().build()); // ADAPTER FieldSpec.Builder adapterBuilder = FieldSpec.builder(adapterOf(javaType), "ADAPTER").addModifiers(PUBLIC, STATIC, FINAL); ClassName adapterJavaType = javaType.nestedClass("ProtoAdapter_" + javaType.simpleName()); if (!emitCompact) { adapterBuilder.initializer("new $T()", adapterJavaType); } else { adapterBuilder.initializer("$T.newEnumAdapter($T.class)", ProtoAdapter.class, javaType); } builder.addField(adapterBuilder.build()); // Public Getter builder.addMethod( MethodSpec.methodBuilder("getValue") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(TypeName.INT) .addStatement("return $N", value) .build()); if (!emitCompact) { // Adds the ProtoAdapter implementation at the bottom. builder.addType(enumAdapter(javaType, adapterJavaType, type)); } return builder.build(); } private TypeSpec generateMessage(MessageType type) { boolean constructorTakesAllFields = constructorTakesAllFields(type); NameAllocator nameAllocator = nameAllocators.getUnchecked(type); ClassName javaType = (ClassName) typeName(type.getType()); ClassName builderJavaType = javaType.nestedClass("Builder"); TypeSpec.Builder builder = TypeSpec.classBuilder(javaType.simpleName()); builder.addModifiers(PUBLIC, FINAL); if (javaType.enclosingClassName() != null) { builder.addModifiers(STATIC); } if (!type.getDocumentation().isEmpty()) { builder.addJavadoc("$L\n", sanitizeJavadoc(type.getDocumentation())); } for (AnnotationSpec annotation : optionAnnotations(type.getOptions())) { builder.addAnnotation(annotation); } if (type.isDeprecated()) { builder.addAnnotation(Deprecated.class); } ClassName messageType = emitAndroid ? ANDROID_MESSAGE : MESSAGE; builder.superclass(messageOf(messageType, javaType, builderJavaType)); String adapterName = nameAllocator.get("ADAPTER"); String protoAdapterName = "ProtoAdapter_" + javaType.simpleName(); String protoAdapterClassName = nameAllocator.newName(protoAdapterName); ClassName adapterJavaType = javaType.nestedClass(protoAdapterClassName); builder.addField( messageAdapterField( adapterName, javaType, adapterJavaType, type.getType(), type.getSyntax())); // Note: The non-compact implementation is added at the very bottom of the surrounding type. if (emitAndroid) { TypeName creatorType = creatorOf(javaType); String creatorName = nameAllocator.get("CREATOR"); builder.addField( FieldSpec.builder(creatorType, creatorName, PUBLIC, STATIC, FINAL) .initializer("$T.newCreator($L)", ANDROID_MESSAGE, adapterName) .build()); } builder.addField( FieldSpec.builder(TypeName.LONG, nameAllocator.get("serialVersionUID")) .addModifiers(PRIVATE, STATIC, FINAL) .initializer("$LL", 0L) .build()); for (Field field : type.getFieldsAndOneOfFields()) { TypeName fieldJavaType = fieldType(field); Field.EncodeMode encodeMode = field.getEncodeMode(); if ((field.getType().isScalar() || isEnum(field.getType())) && !field.getType().equals(ProtoType.STRUCT_NULL) && encodeMode != Field.EncodeMode.REPEATED && encodeMode != Field.EncodeMode.PACKED && encodeMode != Field.EncodeMode.OMIT_IDENTITY) { builder.addField(defaultField(nameAllocator, field, fieldJavaType)); } String fieldName = nameAllocator.get(field); FieldSpec.Builder fieldBuilder = FieldSpec.builder(fieldJavaType, fieldName, PUBLIC, FINAL); if (!field.getDocumentation().isEmpty()) { fieldBuilder.addJavadoc("$L\n", sanitizeJavadoc(field.getDocumentation())); } for (AnnotationSpec annotation : optionAnnotations(field.getOptions())) { fieldBuilder.addAnnotation(annotation); } fieldBuilder.addAnnotation(wireFieldAnnotation(nameAllocator, field, type)); if (field.isExtension()) { fieldBuilder.addJavadoc("Extension source: $L\n", field.getLocation().withPathOnly()); } if (field.isDeprecated()) { fieldBuilder.addAnnotation(Deprecated.class); } if (emitAndroidAnnotations && encodeMode == Field.EncodeMode.NULL_IF_ABSENT) { fieldBuilder.addAnnotation(NULLABLE); } builder.addField(fieldBuilder.build()); } if (constructorTakesAllFields) { builder.addMethod(messageFieldsConstructor(nameAllocator, type)); } builder.addMethod(messageConstructor(nameAllocator, type, builderJavaType)); builder.addMethod(newBuilder(nameAllocator, type)); builder.addMethod(messageEquals(nameAllocator, type)); builder.addMethod(messageHashCode(nameAllocator, type)); if (!emitCompact) { builder.addMethod(messageToString(nameAllocator, type)); } builder.addType(builder(nameAllocator, type, javaType, builderJavaType)); for (Type nestedType : type.getNestedTypes()) { builder.addType(generateType(nestedType)); } for (Extend nestedExtend : type.getNestedExtendList()) { for (Field extension : nestedExtend.getFields()) { TypeSpec extensionOption = generateOptionType(nestedExtend, extension); if (extensionOption != null) { builder.addType(extensionOption); } } } if (!emitCompact) { // Add the ProtoAdapter implementation at the very bottom since it's ugly serialization code. builder.addType( messageAdapter(nameAllocator, type, javaType, adapterJavaType, builderJavaType)); } return builder.build(); } /** Decides if a constructor should take all fields or a builder as a parameter. */ private boolean constructorTakesAllFields(MessageType type) { return type.fields().size() < MAX_PARAMS_IN_CONSTRUCTOR; } private TypeSpec generateEnclosingType(EnclosingType type) { ClassName javaType = (ClassName) typeName(type.getType()); TypeSpec.Builder builder = TypeSpec.classBuilder(javaType.simpleName()).addModifiers(PUBLIC, FINAL); if (javaType.enclosingClassName() != null) { builder.addModifiers(STATIC); } String documentation = type.getDocumentation(); if (!documentation.isEmpty()) { documentation += "\n\n<p>"; } documentation += "<b>NOTE:</b> This type only exists to maintain class structure" + " for its nested types and is not an actual message."; builder.addJavadoc("$L\n", documentation); builder.addMethod( MethodSpec.constructorBuilder() .addModifiers(PRIVATE) .addStatement("throw new $T()", AssertionError.class) .build()); for (Type nestedType : type.getNestedTypes()) { builder.addType(generateType(nestedType)); } return builder.build(); } /** Returns a standalone adapter for {@code type}. */ public TypeSpec generateAdapterForCustomType(Type type) { NameAllocator nameAllocator = nameAllocators.getUnchecked(type); ClassName adapterTypeName = abstractAdapterName(type.getType()); ClassName typeName = (ClassName) typeName(type.getType()); TypeSpec.Builder adapter; if (type instanceof MessageType) { adapter = messageAdapter(nameAllocator, (MessageType) type, typeName, adapterTypeName, null) .toBuilder(); } else { adapter = enumAdapter(nameAllocator, (EnumType) type, typeName, adapterTypeName).toBuilder(); } if (adapterTypeName.enclosingClassName() != null) adapter.addModifiers(STATIC); for (Type nestedType : type.getNestedTypes()) { if (profile.getAdapter(nestedType.getType()) == null) { throw new IllegalArgumentException( "Missing custom proto adapter for " + nestedType.getType().getEnclosingTypeOrPackage() + "." + nestedType.getType().getSimpleName() + " when enclosing proto has custom proto adapter."); } adapter.addType(generateAdapterForCustomType(nestedType)); } return adapter.build(); } /** Returns the set of names that are not unique within {@code fields}. */ private Set<String> collidingFieldNames(List<Field> fields) { Set<String> fieldNames = new LinkedHashSet<>(); Set<String> collidingNames = new LinkedHashSet<>(); for (Field field : fields) { if (!fieldNames.add(field.getName())) { collidingNames.add(field.getName()); } } return collidingNames; } private FieldSpec messageAdapterField( String adapterName, ClassName javaType, ClassName adapterJavaType, ProtoType protoType, Syntax syntax) { FieldSpec.Builder result = FieldSpec.builder(adapterOf(javaType), adapterName).addModifiers(PUBLIC, STATIC, FINAL); if (emitCompact) { result.initializer( "$T.newMessageAdapter($T.class, $S, $T.$L)", ProtoAdapter.class, javaType, protoType.getTypeUrl(), Syntax.class, syntax.name()); } else { result.initializer("new $T()", adapterJavaType); } return result.build(); } /** * Generates a custom enum adapter to decode a proto enum to a user-specified Java type. Users * need to instantiate a constant instance of this adapter that provides all enum constants in the * constructor in the proper order. * * <pre>{@code * public static final ProtoAdapter<Roshambo> ADAPTER * = new RoshamboAdapter(Roshambo.ROCK, Roshambo.SCISSORS, Roshambo.PAPER); * }</pre> */ private TypeSpec enumAdapter( NameAllocator nameAllocator, EnumType type, ClassName javaType, ClassName adapterJavaType) { String value = nameAllocator.get("value"); String i = nameAllocator.get("i"); String reader = nameAllocator.get("reader"); String writer = nameAllocator.get("writer"); TypeSpec.Builder builder = TypeSpec.classBuilder(adapterJavaType.simpleName()); builder.superclass(adapterOf(javaType)); builder.addModifiers(PUBLIC); MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder(); constructorBuilder.addModifiers(PUBLIC); constructorBuilder.addStatement("super($T.VARINT, $T.class)", FieldEncoding.class, javaType); for (EnumConstant constant : type.getConstants()) { String name = nameAllocator.get(constant); FieldSpec.Builder fieldBuilder = FieldSpec.builder(javaType, name).addModifiers(PROTECTED, FINAL); if (!constant.getDocumentation().isEmpty()) { fieldBuilder.addJavadoc("$L\n", sanitizeJavadoc(constant.getDocumentation())); } if (constant.isDeprecated()) { fieldBuilder.addAnnotation(Deprecated.class); } builder.addField(fieldBuilder.build()); constructorBuilder.addParameter(javaType, name); constructorBuilder.addStatement("this.$N = $N", name, name); } builder.addMethod(constructorBuilder.build()); MethodSpec.Builder toValueBuilder = MethodSpec.methodBuilder("toValue") .addModifiers(PROTECTED) .returns(int.class) .addParameter(javaType, value); for (EnumConstant constant : type.getConstants()) { String name = nameAllocator.get(constant); toValueBuilder.addStatement("if ($N.equals($N)) return $L", value, name, constant.getTag()); } toValueBuilder.addStatement("return $L", -1); builder.addMethod(toValueBuilder.build()); MethodSpec.Builder fromValueBuilder = MethodSpec.methodBuilder("fromValue") .addModifiers(PROTECTED) .returns(javaType) .addParameter(int.class, value); fromValueBuilder.beginControlFlow("switch ($N)", value); for (EnumConstant constant : type.getConstants()) { String name = nameAllocator.get(constant); fromValueBuilder.addStatement("case $L: return $N", constant.getTag(), name); } fromValueBuilder.addStatement( "default: throw new $T($N, $T.class)", EnumConstantNotFoundException.class, value, javaType); fromValueBuilder.endControlFlow(); builder.addMethod(fromValueBuilder.build()); builder.addMethod( MethodSpec.methodBuilder("encodedSize") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(int.class) .addParameter(javaType, value) .addStatement("return $T.UINT32.encodedSize(toValue($N))", ProtoAdapter.class, value) .build()); builder.addMethod(enumEncode(javaType, value, i, writer, false)); builder.addMethod(enumEncode(javaType, value, i, writer, true)); builder.addMethod( MethodSpec.methodBuilder("decode") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(javaType) .addParameter(ProtoReader.class, reader) .addException(IOException.class) .addStatement("int $N = $N.readVarint32()", value, reader) .addStatement("return fromValue($N)", value) .build()); builder.addMethod( MethodSpec.methodBuilder("redact") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(javaType) .addParameter(javaType, "value") .addStatement("return value") .build()); return builder.build(); } private MethodSpec enumEncode( ClassName javaType, String value, String localInt, String localWriter, boolean reverse) { return MethodSpec.methodBuilder("encode") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(reverse ? ReverseProtoWriter.class : ProtoWriter.class, localWriter) .addParameter(javaType, value) .addException(IOException.class) .addStatement("int $N = toValue($N)", localInt, value) .addStatement( "if ($N == $L) throw new $T($S + $N)", localInt, -1, ProtocolException.class, "Unexpected enum constant: ", value) .addStatement("$N.writeVarint32($N)", localWriter, localInt) .build(); } private TypeSpec enumAdapter(ClassName javaType, ClassName adapterJavaType, EnumType enumType) { return TypeSpec.classBuilder(adapterJavaType.simpleName()) .superclass(enumAdapterOf(javaType)) .addModifiers(PRIVATE, STATIC, FINAL) .addMethod( MethodSpec.constructorBuilder() .addStatement( "super($T.class, $T.$L, $L)", javaType, Syntax.class, enumType.getSyntax().name(), identity(enumType)) .build()) .addMethod( MethodSpec.methodBuilder("fromValue") .addAnnotation(Override.class) .addModifiers(PROTECTED) .returns(javaType) .addParameter(int.class, "value") .addStatement("return $T.fromValue(value)", javaType) .build()) .build(); } private TypeSpec messageAdapter( NameAllocator nameAllocator, MessageType type, ClassName javaType, ClassName adapterJavaType, ClassName builderType) { boolean useBuilder = builderType != null; TypeSpec.Builder adapter = TypeSpec.classBuilder(adapterJavaType.simpleName()).superclass(adapterOf(javaType)); if (useBuilder) { adapter.addModifiers(PRIVATE, STATIC, FINAL); } else { adapter.addModifiers(PUBLIC, ABSTRACT); } adapter.addMethod( MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addStatement( "super($T.LENGTH_DELIMITED, $T.class, $S, $T.$L, null, $S)", FieldEncoding.class, javaType, type.getType().getTypeUrl(), Syntax.class, type.getSyntax().name(), type.getLocation().getPath()) .build()); if (!useBuilder) { MethodSpec.Builder fromProto = MethodSpec.methodBuilder("fromProto").addModifiers(PUBLIC, ABSTRACT).returns(javaType); for (Field field : type.getFieldsAndOneOfFields()) { TypeName fieldType = fieldType(field); String fieldName = nameAllocator.get(field); fromProto.addParameter(fieldType, fieldName); adapter.addMethod( MethodSpec.methodBuilder(fieldName) .addModifiers(PUBLIC, ABSTRACT) .addParameter(javaType, "value") .returns(fieldType) .build()); } adapter.addMethod(fromProto.build()); } adapter.addMethod(messageAdapterEncodedSize(nameAllocator, type, javaType, useBuilder)); adapter.addMethod(messageAdapterEncode(nameAllocator, type, javaType, useBuilder, false)); adapter.addMethod(messageAdapterEncode(nameAllocator, type, javaType, useBuilder, true)); adapter.addMethod(messageAdapterDecode(nameAllocator, type, javaType, useBuilder, builderType)); adapter.addMethod(messageAdapterRedact(nameAllocator, type, javaType, useBuilder, builderType)); for (Field field : type.getFieldsAndOneOfFields()) { if (field.getType().isMap()) { TypeName adapterType = adapterOf(fieldType(field)); String fieldName = nameAllocator.get(field); adapter.addField(FieldSpec.builder(adapterType, fieldName, PRIVATE).build()); // Map adapters have to be lazy in order to avoid a circular reference when its value type // is the same as its enclosing type. adapter.addMethod(mapAdapter(nameAllocator, adapterType, fieldName, field.getType())); } } return adapter.build(); } private MethodSpec messageAdapterEncodedSize( NameAllocator nameAllocator, MessageType type, TypeName javaType, boolean useBuilder) { MethodSpec.Builder result = MethodSpec.methodBuilder("encodedSize") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(int.class) .addParameter(javaType, "value"); String resultName = nameAllocator.clone().newName("result"); result.addStatement("int $L = 0", resultName); for (Field field : type.getFieldsAndOneOfFields()) { int fieldTag = field.getTag(); String fieldName = nameAllocator.get(field); CodeBlock adapter = adapterFor(field, nameAllocator); boolean omitIdentity = field.getEncodeMode().equals(Field.EncodeMode.OMIT_IDENTITY); if (omitIdentity) { result.beginControlFlow( "if (!$T.equals(value.$L, $L))", ClassName.get(Objects.class), fieldName, identityValue(field)); } result .addCode("$L += ", resultName) .addCode("$L.encodedSizeWithTag($L, ", adapter, fieldTag) .addCode((useBuilder ? "value.$L" : "$L(value)"), fieldName) .addCode(");\n"); if (omitIdentity) { result.endControlFlow(); } } if (useBuilder) { result.addStatement("$L += value.unknownFields().size()", resultName); } result.addStatement("return $L", resultName); return result.build(); } private MethodSpec messageAdapterEncode( NameAllocator nameAllocator, MessageType type, TypeName javaType, boolean useBuilder, boolean reverse) { MethodSpec.Builder result = MethodSpec.methodBuilder("encode") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(reverse ? ReverseProtoWriter.class : ProtoWriter.class, "writer") .addParameter(javaType, "value") .addException(IOException.class); List<CodeBlock> encodeCalls = new ArrayList<>(); for (Field field : type.getFieldsAndOneOfFields()) { int fieldTag = field.getTag(); CodeBlock adapter = adapterFor(field, nameAllocator); String fieldName = nameAllocator.get(field); CodeBlock.Builder encodeCall = CodeBlock.builder(); if (field.getEncodeMode().equals(Field.EncodeMode.OMIT_IDENTITY)) { encodeCall.add( "if (!$T.equals(value.$L, $L)) ", ClassName.get(Objects.class), fieldName, identityValue(field)); } encodeCall .add("$L.encodeWithTag(writer, $L, ", adapter, fieldTag) .add((useBuilder ? "value.$L" : "$L(value)"), fieldName) .add(");\n"); encodeCalls.add(encodeCall.build()); } if (useBuilder) { encodeCalls.add( CodeBlock.builder().addStatement("writer.writeBytes(value.unknownFields())").build()); } if (reverse) { Collections.reverse(encodeCalls); } for (CodeBlock encodeCall : encodeCalls) { result.addCode(encodeCall); } return result.build(); } private MethodSpec messageAdapterDecode( NameAllocator nameAllocator, MessageType type, TypeName javaType, boolean useBuilder, ClassName builderJavaType) { MethodSpec.Builder result = MethodSpec.methodBuilder("decode") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(javaType) .addParameter(ProtoReader.class, "reader") .addException(IOException.class); List<Field> fields = TAG_ORDERING.sortedCopy(type.getFieldsAndOneOfFields()); if (useBuilder) { result.addStatement("$1T builder = new $1T()", builderJavaType); } else { for (Field field : fields) { result.addStatement( "$T $N = $L", fieldType(field), nameAllocator.get(field), initialValue(field)); } } result.addStatement("long token = reader.beginMessage()"); result.beginControlFlow("for (int tag; (tag = reader.nextTag()) != -1;)"); result.beginControlFlow("switch (tag)"); for (Field field : fields) { int fieldTag = field.getTag(); if (isEnum(field.getType()) && !field.getType().equals(ProtoType.STRUCT_NULL)) { result.beginControlFlow("case $L:", fieldTag); result.beginControlFlow("try"); result.addCode(decodeAndAssign(field, nameAllocator, useBuilder)); result.addCode(";\n"); if (useBuilder) { result.nextControlFlow("catch ($T e)", EnumConstantNotFoundException.class); result.addStatement( "builder.addUnknownField(tag, $T.VARINT, (long) e.value)", FieldEncoding.class); result.endControlFlow(); // try/catch } else { result.nextControlFlow("catch ($T ignored)", EnumConstantNotFoundException.class); result.endControlFlow(); // try/catch } result.addStatement("break"); result.endControlFlow(); // case } else { result.addCode( "case $L: $L; break;\n", fieldTag, decodeAndAssign(field, nameAllocator, useBuilder)); } } result.beginControlFlow("default:"); if (useBuilder) { result.addStatement("reader.readUnknownField(tag)"); } else { result.addStatement("reader.skip()"); } result.endControlFlow(); // default result.endControlFlow(); // switch result.endControlFlow(); // for if (useBuilder) { result.addStatement("builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token))"); } else { result.addStatement("reader.endMessageAndGetUnknownFields(token)"); } if (useBuilder) { result.addStatement("return builder.build()"); } else { result.addCode("return fromProto("); boolean first = true; for (Field field : type.getFieldsAndOneOfFields()) { if (!first) result.addCode(", "); result.addCode("$N", nameAllocator.get(field)); first = false; } result.addCode(");\n"); } return result.build(); } private CodeBlock decodeAndAssign(Field field, NameAllocator nameAllocator, boolean useBuilder) { String fieldName = nameAllocator.get(field); CodeBlock decode = CodeBlock.of("$L.decode(reader)", singleAdapterFor(field, nameAllocator)); if (field.isRepeated()) { return useBuilder ? field.getType().equals(ProtoType.STRUCT_NULL) ? CodeBlock.of("builder.$L.add(($T) $L)", fieldName, Void.class, decode) : CodeBlock.of("builder.$L.add($L)", fieldName, decode) : CodeBlock.of("$L.add($L)", fieldName, decode); } else if (field.getType().isMap()) { return useBuilder ? CodeBlock.of("builder.$L.putAll($L)", fieldName, decode) : CodeBlock.of("$L.putAll($L)", fieldName, decode); } else { return useBuilder ? field.getType().equals(ProtoType.STRUCT_NULL) ? CodeBlock.of("builder.$L(($T) $L)", fieldName, Void.class, decode) : CodeBlock.of("builder.$L($L)", fieldName, decode) : CodeBlock.of("$L = $L", fieldName, decode); } } private MethodSpec messageAdapterRedact( NameAllocator nameAllocator, MessageType type, ClassName javaType, boolean useBuilder, ClassName builderJavaType) { MethodSpec.Builder result = MethodSpec.methodBuilder("redact") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(javaType) .addParameter(javaType, "value"); int redactedFieldCount = 0; List<String> requiredRedacted = new ArrayList<>(); for (Field field : type.getFieldsAndOneOfFields()) { if (field.isRedacted()) { redactedFieldCount++; if (field.isRequired()) { requiredRedacted.add(nameAllocator.get(field)); } } } if (!useBuilder) { result.addStatement((redactedFieldCount == 0) ? "return value" : "return null"); return result.build(); } if (!requiredRedacted.isEmpty()) { boolean isPlural = requiredRedacted.size() != 1; result.addStatement( "throw new $T($S)", UnsupportedOperationException.class, (isPlural ? "Fields" : "Field") + " '" + Joiner.on("', '").join(requiredRedacted) + "' " + (isPlural ? "are" : "is") + " required and cannot be redacted."); return result.build(); } result.addStatement("$1T builder = value.newBuilder()", builderJavaType); for (Field field : type.getFieldsAndOneOfFields()) { String fieldName = nameAllocator.get(field); if (field.isRedacted()) { if (field.isRepeated()) { result.addStatement("builder.$N = $T.emptyList()", fieldName, Collections.class); } else if (field.getType().isMap()) { result.addStatement("builder.$N = $T.emptyMap()", fieldName, Collections.class); } else { result.addStatement("builder.$N = null", fieldName); } } else if (!field.getType().isScalar() && !isEnum(field.getType())) { if (field.isRepeated()) { CodeBlock adapter = singleAdapterFor(field, nameAllocator); result.addStatement( "$T.redactElements(builder.$N, $L)", Internal.class, fieldName, adapter); } else if (field.getType().isMap()) { // We only need to ask the values to redact themselves if the type is a message. if (!field.getType().getValueType().isScalar() && !isEnum(field.getType().getValueType())) { CodeBlock adapter = singleAdapterFor(field.getType().getValueType()); result.addStatement( "$T.redactElements(builder.$N, $L)", Internal.class, fieldName, adapter); } } else { CodeBlock adapter = adapterFor(field, nameAllocator); if (!field.isRequired()) { result.addCode("if (builder.$N != null) ", fieldName); } result.addStatement("builder.$1N = $2L.redact(builder.$1N)", fieldName, adapter); } } } result.addStatement("builder.clearUnknownFields()"); result.addStatement("return builder.build()"); return result.build(); } private String fieldName(ProtoType type, Field field) { MessageType messageType = (MessageType) schema.getType(type); NameAllocator names = nameAllocators.getUnchecked(messageType); return names.get(field); } private TypeName fieldType(Field field) { ProtoType type = field.getType(); if (type.isMap()) { return ParameterizedTypeName.get( ClassName.get(Map.class), typeName(type.getKeyType()).box(), typeName(type.getValueType()).box()); } TypeName messageType = typeName(type); switch (field.getEncodeMode()) { case REPEATED: case PACKED: return listOf(messageType.box()); case NULL_IF_ABSENT: case REQUIRED: return messageType.box(); default: if (isWrapper(field.getType())) return messageType.box(); return messageType; } } // Example: // // public static final Integer DEFAULT_OPT_INT32 = 123; // private FieldSpec defaultField(NameAllocator nameAllocator, Field field, TypeName fieldType) { String defaultFieldName = "DEFAULT_" + nameAllocator.get(field).toUpperCase(Locale.US); return FieldSpec.builder(fieldType, defaultFieldName, PUBLIC, STATIC, FINAL) .initializer(defaultValue(field)) .build(); } // Example: // // @WireField( // tag = 1, // type = INT32 // ) // private AnnotationSpec wireFieldAnnotation( NameAllocator nameAllocator, Field field, MessageType message) { AnnotationSpec.Builder result = AnnotationSpec.builder(WireField.class); NameAllocator localNameAllocator = nameAllocator.clone(); int tag = field.getTag(); result.addMember("tag", String.valueOf(tag)); if (field.getType().isMap()) { result.addMember("keyAdapter", "$S", adapterString(field.getType().getKeyType())); result.addMember("adapter", "$S", adapterString(field.getType().getValueType())); } else { result.addMember("adapter", "$S", adapterString(field.getType())); } WireField.Label wireFieldLabel; //noinspection ConstantConditions switch (field.getEncodeMode()) { case REQUIRED: wireFieldLabel = WireField.Label.REQUIRED; break; case OMIT_IDENTITY: // Wrapper types don't omit identity values on JSON as other proto3 messages would. if (field.getType().isWrapper()) { wireFieldLabel = null; } else { wireFieldLabel = WireField.Label.OMIT_IDENTITY; } break; case REPEATED: wireFieldLabel = WireField.Label.REPEATED; break; case PACKED: wireFieldLabel = WireField.Label.PACKED; break; case MAP: case NULL_IF_ABSENT: default: wireFieldLabel = null; } if (wireFieldLabel != null) { result.addMember("label", "$T.$L", WireField.Label.class, wireFieldLabel); } if (field.isRedacted()) { result.addMember("redacted", "true"); } String generatedName = localNameAllocator.get(field); if (!generatedName.equals(field.getName())) { result.addMember("declaredName", "$S", field.getName()); } if (!field.getJsonName().equals(field.getName())) { result.addMember("jsonName", "$S", field.getJsonName()); } if (field.isOneOf()) { String oneofName = null; for (OneOf oneOf : message.getOneOfs()) { if (oneOf.getFields().contains(field)) { oneofName = oneOf.getName(); break; } } if (oneofName == null) { throw new IllegalArgumentException("No oneof found for field: " + field.getQualifiedName()); } result.addMember("oneofName", "$S", oneofName); } return result.build(); } // Example: // // @WireEnumConstant( // declaredName = "final", // ) // private @Nullable AnnotationSpec wireEnumConstantAnnotation( NameAllocator nameAllocator, EnumConstant constant) { AnnotationSpec.Builder result = AnnotationSpec.builder(WireEnumConstant.class); NameAllocator localNameAllocator = nameAllocator.clone(); String generatedName = localNameAllocator.get(constant); if (generatedName.equals(constant.getName())) { return null; } result.addMember("declaredName", "$S", constant.getName()); return result.build(); } private String adapterString(ProtoType type) { String builtInAdapterString = builtInAdapterString(type, false); if (builtInAdapterString != null) { return builtInAdapterString; } AdapterConstant adapterConstant = profile.getAdapter(type); if (adapterConstant != null) { return reflectionName(adapterConstant.javaClassName) + "#" + adapterConstant.memberName; } return reflectionName(typeName(type)) + "#ADAPTER"; } private String reflectionName(TypeName typeName) { ClassName className; if (typeName instanceof ParameterizedTypeName) { className = ((ParameterizedTypeName) typeName).rawType; } else { className = (ClassName) typeName; } return className.packageName().isEmpty() ? Joiner.on('$').join(className.simpleNames()) : className.packageName() + '.' + Joiner.on('$').join(className.simpleNames()); } // Example: // // public SimpleMessage(int optional_int32, long optional_int64) { // this(builder.optional_int32, builder.optional_int64, null); // } // private MethodSpec messageFieldsConstructor(NameAllocator nameAllocator, MessageType type) { MethodSpec.Builder result = MethodSpec.constructorBuilder(); if (!buildersOnly) result.addModifiers(PUBLIC); result.addCode("this("); for (Field field : type.getFieldsAndOneOfFields()) { TypeName javaType = fieldType(field); String fieldName = nameAllocator.get(field); ParameterSpec.Builder param = ParameterSpec.builder(javaType, fieldName); if (emitAndroidAnnotations && field.getEncodeMode() == Field.EncodeMode.NULL_IF_ABSENT) { param.addAnnotation(NULLABLE); } result.addParameter(param.build()); result.addCode("$L, ", fieldName); } result.addCode("$T.EMPTY);\n", BYTE_STRING); return result.build(); } // Example: // // public SimpleMessage(int optional_int32, long optional_int64, ByteString unknownFields) { // super(ADAPTER, unknownFields); // this.optional_int32 = optional_int32; // this.optional_int64 = optional_int64; // } // // Alternate example, where the constructor takes in a builder, would be the case when there are // too many fields: // // public SimpleMessage(Builder builder, ByteString unknownFields) { // super(ADAPTER, unknownFields); // this.optional_int32 = builder.optional_int32; // this.optional_int64 = builder.optional_int64; // } // private MethodSpec messageConstructor( NameAllocator nameAllocator, MessageType type, ClassName builderJavaType) { boolean constructorTakesAllFields = constructorTakesAllFields(type); NameAllocator localNameAllocator = nameAllocator.clone(); String adapterName = localNameAllocator.get("ADAPTER"); String unknownFieldsName = localNameAllocator.newName("unknownFields"); String builderName = localNameAllocator.newName("builder"); MethodSpec.Builder result = MethodSpec.constructorBuilder() .addStatement("super($N, $N)", adapterName, unknownFieldsName); if (!buildersOnly) result.addModifiers(PUBLIC); for (OneOf oneOf : type.getOneOfs()) { if (oneOf.getFields().size() < 2) continue; CodeBlock.Builder fieldNamesBuilder = CodeBlock.builder(); boolean first = true; for (Field field : oneOf.getFields()) { if (!first) fieldNamesBuilder.add(", "); if (constructorTakesAllFields) { fieldNamesBuilder.add("$N", localNameAllocator.get(field)); } else { fieldNamesBuilder.add("$N.$N", builderName, localNameAllocator.get(field)); } first = false; } CodeBlock fieldNames = fieldNamesBuilder.build(); result.beginControlFlow("if ($T.countNonNull($L) > 1)", Internal.class, fieldNames); result.addStatement( "throw new IllegalArgumentException($S)", "at most one of " + fieldNames + " may be non-null"); result.endControlFlow(); } for (Field field : type.getFieldsAndOneOfFields()) { TypeName javaType = fieldType(field); String fieldName = localNameAllocator.get(field); String fieldAccessName = constructorTakesAllFields ? fieldName : builderName + "." + fieldName; if (constructorTakesAllFields) { ParameterSpec.Builder param = ParameterSpec.builder(javaType, fieldName); if (emitAndroidAnnotations && field.getEncodeMode() == Field.EncodeMode.NULL_IF_ABSENT) { param.addAnnotation(NULLABLE); } result.addParameter(param.build()); } if (field.getEncodeMode() == Field.EncodeMode.OMIT_IDENTITY) { // Other scalars use not-boxed types to guarantee a value. if (field.getType().isScalar() && (field.getType() == ProtoType.STRING || field.getType() == ProtoType.BYTES) || (isEnum(field.getType()) && !field.getType().equals(ProtoType.STRUCT_NULL))) { result.beginControlFlow("if ($L == null)", fieldAccessName); result.addStatement( "throw new IllegalArgumentException($S)", fieldAccessName + " == null"); result.endControlFlow(); } } if (field.getType().isMap() && isStruct(field.getType().getValueType())) { result.addStatement( "this.$1L = $2T.immutableCopyOfMapWithStructValues($1S, $3L)", fieldName, Internal.class, fieldAccessName); } else if (isStruct(field.getType())) { result.addStatement( "this.$1L = $2T.immutableCopyOfStruct($1S, $3L)", fieldName, Internal.class, fieldAccessName); } else if (field.isRepeated() || field.getType().isMap()) { result.addStatement( "this.$1L = $2T.immutableCopyOf($1S, $3L)", fieldName, Internal.class, fieldAccessName); } else { result.addStatement("this.$1L = $2L", fieldName, fieldAccessName); } } if (!constructorTakesAllFields) { result.addParameter(builderJavaType, builderName); } result.addParameter(BYTE_STRING, unknownFieldsName); return result.build(); } private boolean isStruct(ProtoType protoType) { return protoType.equals(ProtoType.STRUCT_MAP) || protoType.equals(ProtoType.STRUCT_LIST) || protoType.equals(ProtoType.STRUCT_VALUE) || protoType.equals(ProtoType.STRUCT_NULL); } private boolean isWrapper(ProtoType protoType) { return protoType.equals(ProtoType.DOUBLE_VALUE) || protoType.equals(ProtoType.FLOAT_VALUE) || protoType.equals(ProtoType.INT64_VALUE) || protoType.equals(ProtoType.UINT64_VALUE) || protoType.equals(ProtoType.INT32_VALUE) || protoType.equals(ProtoType.UINT32_VALUE) || protoType.equals(ProtoType.BOOL_VALUE) || protoType.equals(ProtoType.STRING_VALUE) || protoType.equals(ProtoType.BYTES_VALUE); } // Example: // // @Override // public boolean equals(Object other) { // if (other == this) return true; // if (!(other instanceof SimpleMessage)) return false; // SimpleMessage o = (SimpleMessage) other; // return equals(unknownFields(), o.unknownFields()) // && equals(optional_int32, o.optional_int32); // private MethodSpec messageEquals(NameAllocator nameAllocator, MessageType type) { NameAllocator localNameAllocator = nameAllocator.clone(); String otherName = localNameAllocator.newName("other"); String oName = localNameAllocator.newName("o"); TypeName javaType = typeName(type.getType()); MethodSpec.Builder result = MethodSpec.methodBuilder("equals") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(boolean.class) .addParameter(Object.class, otherName); result.addStatement("if ($N == this) return true", otherName); result.addStatement("if (!($N instanceof $T)) return false", otherName, javaType); result.addStatement("$T $N = ($T) $N", javaType, oName, javaType, otherName); result.addCode("$[return unknownFields().equals($N.unknownFields())", oName); List<Field> fields = type.getFieldsAndOneOfFields(); for (Field field : fields) { String fieldName = localNameAllocator.get(field); if (field.isRequired() || field.isRepeated() || field.getType().isMap()) { result.addCode("\n&& $1L.equals($2N.$1L)", fieldName, oName); } else { result.addCode("\n&& $1T.equals($2L, $3N.$2L)", Internal.class, fieldName, oName); } } result.addCode(";\n$]"); return result.build(); } // Example: // // @Override // public int hashCode() { // int result = hashCode; // if (result == 0) { // result = unknownFields().hashCode(); // result = result * 37 + (f != null ? f.hashCode() : 0); // hashCode = result; // } // return result; // } // // For repeated fields, the final "0" in the example above changes to a "1" // in order to be the same as the system hash code for an empty list. // private MethodSpec messageHashCode(NameAllocator nameAllocator, MessageType type) { NameAllocator localNameAllocator = nameAllocator.clone(); String resultName = localNameAllocator.newName("result"); MethodSpec.Builder result = MethodSpec.methodBuilder("hashCode") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(int.class); List<Field> fields = type.getFieldsAndOneOfFields(); if (fields.isEmpty()) { result.addStatement("return unknownFields().hashCode()"); return result.build(); } result.addStatement("int $N = super.hashCode", resultName); result.beginControlFlow("if ($N == 0)", resultName); result.addStatement("$N = unknownFields().hashCode()", resultName); for (Field field : fields) { String fieldName = localNameAllocator.get(field); TypeName typeName = fieldType(field); result.addCode("$1N = $1N * 37 + ", resultName); if (typeName == TypeName.BOOLEAN) { result.addStatement("$T.hashCode($N)", Boolean.class, fieldName); } else if (typeName == TypeName.INT) { result.addStatement("$T.hashCode($N)", Integer.class, fieldName); } else if (typeName == TypeName.LONG) { result.addStatement("$T.hashCode($N)", Long.class, fieldName); } else if (typeName == TypeName.FLOAT) { result.addStatement("$T.hashCode($N)", Float.class, fieldName); } else if (typeName == TypeName.DOUBLE) { result.addStatement("$T.hashCode($N)", Double.class, fieldName); } else if (field.isRequired() || field.isRepeated() || field.getType().isMap()) { result.addStatement("$L.hashCode()", fieldName); } else { result.addStatement("($1L != null ? $1L.hashCode() : 0)", fieldName); } } result.addStatement("super.hashCode = $N", resultName); result.endControlFlow(); result.addStatement("return $N", resultName); return result.build(); } // Example: // // private ProtoAdapter<Map<String, ModelEvaluation>> modelsAdapter() { // ProtoAdapter<Map<String, ModelEvaluation>> result = models; // if (result == null) { // result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ModelEvaluation.ADAPTER); // models = result; // } // return result; // } // private MethodSpec mapAdapter( NameAllocator nameAllocator, TypeName adapterType, String fieldName, ProtoType mapType) { NameAllocator localNameAllocator = nameAllocator.clone(); String resultName = localNameAllocator.newName("result"); MethodSpec.Builder result = MethodSpec.methodBuilder(fieldName + "Adapter").addModifiers(PRIVATE).returns(adapterType); result.addStatement("$T $N = $N", adapterType, resultName, fieldName); result.beginControlFlow("if ($N == null)", resultName); result.addStatement( "$N = $T.newMapAdapter($L, $L)", resultName, ADAPTER, singleAdapterFor(mapType.getKeyType()), singleAdapterFor(mapType.getValueType())); result.addStatement("$N = $N", fieldName, resultName); result.endControlFlow(); result.addStatement("return $N", resultName); return result.build(); } private MethodSpec messageToString(NameAllocator nameAllocator, MessageType type) { NameAllocator localNameAllocator = nameAllocator.clone(); MethodSpec.Builder result = MethodSpec.methodBuilder("toString") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(String.class); String builderName = localNameAllocator.newName("builder"); result.addStatement("$1T $2N = new $1T()", StringBuilder.class, builderName); for (Field field : type.getFieldsAndOneOfFields()) { String fieldName = nameAllocator.get(field); TypeName fieldType = fieldType(field); if (field.isRepeated() || field.getType().isMap()) { result.addCode("if (!$N.isEmpty()) ", fieldName); } else if (!field.isRequired() && !fieldType.isPrimitive()) { result.addCode("if ($N != null) ", fieldName); } if (field.isRedacted()) { result.addStatement( "$N.append(\", $N=$L\")", builderName, field.getName(), DOUBLE_FULL_BLOCK); } else if (field.getType().equals(ProtoType.STRING)) { result.addStatement( "$N.append(\", $N=\").append($T.sanitize($L))", builderName, field.getName(), Internal.class, fieldName); } else { result.addStatement( "$N.append(\", $N=\").append($L)", builderName, field.getName(), fieldName); } } result.addStatement( "return builder.replace(0, 2, \"$L{\").append('}').toString()", type.getType().getSimpleName()); return result.build(); } private TypeSpec builder( NameAllocator nameAllocator, MessageType type, ClassName javaType, ClassName builderType) { TypeSpec.Builder result = TypeSpec.classBuilder("Builder").addModifiers(PUBLIC, STATIC, FINAL); result.superclass(builderOf(javaType, builderType)); for (Field field : type.getFieldsAndOneOfFields()) { String fieldName = nameAllocator.get(field); result.addField(fieldType(field), fieldName, PUBLIC); } result.addMethod(builderNoArgsConstructor(nameAllocator, type)); for (Field field : type.fields()) { result.addMethod(setter(nameAllocator, builderType, null, field)); } for (OneOf oneOf : type.getOneOfs()) { for (Field field : oneOf.getFields()) { result.addMethod(setter(nameAllocator, builderType, oneOf, field)); } } result.addMethod(builderBuild(nameAllocator, type, javaType)); return result.build(); } // Example: // // public Builder() { // names = newMutableList(); // } // private MethodSpec builderNoArgsConstructor(NameAllocator nameAllocator, MessageType type) { MethodSpec.Builder result = MethodSpec.constructorBuilder().addModifiers(PUBLIC); for (Field field : type.getFieldsAndOneOfFields()) { String fieldName = nameAllocator.get(field); CodeBlock initialValue = initialValue(field); if (initialValue != null) { result.addStatement("$L = $L", fieldName, initialValue); } } return result.build(); } /** Returns the initial value of {@code field}, or null if it is doesn't have one. */ private @Nullable CodeBlock initialValue(Field field) { if (field.isPacked() || field.isRepeated()) { return CodeBlock.of("$T.newMutableList()", Internal.class); } else if (field.getType().isMap()) { return CodeBlock.of("$T.newMutableMap()", Internal.class); } else if (field.getEncodeMode() == Field.EncodeMode.OMIT_IDENTITY) { CodeBlock identityValue = identityValue(field); if (identityValue.equals(CodeBlock.of("null"))) { return null; } else { return identityValue(field); } } else { return null; } } // Example: // // @Override // public Message.Builder newBuilder() { // Builder builder = new Builder(); // builder.optional_int32 = optional_int32; // ... // builder.addUnknownFields(unknownFields()); // return builder; // } private MethodSpec newBuilder(NameAllocator nameAllocator, MessageType message) { NameAllocator localNameAllocator = nameAllocator.clone(); String builderName = localNameAllocator.newName("builder"); ClassName javaType = (ClassName) typeName(message.getType()); ClassName builderJavaType = javaType.nestedClass("Builder"); MethodSpec.Builder result = MethodSpec.methodBuilder("newBuilder") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(builderJavaType) .addStatement("$1T $2L = new $1T()", builderJavaType, builderName); List<Field> fields = message.getFieldsAndOneOfFields(); for (Field field : fields) { String fieldName = localNameAllocator.get(field); if (field.isRepeated() || field.getType().isMap()) { result.addStatement("$1L.$2L = $3T.copyOf($2L)", builderName, fieldName, Internal.class); } else { result.addStatement("$1L.$2L = $2L", builderName, fieldName); } } result.addStatement("$L.addUnknownFields(unknownFields())", builderName); result.addStatement("return $L", builderName); return result.build(); } private MethodSpec setter( NameAllocator nameAllocator, TypeName builderType, OneOf oneOf, Field field) { TypeName javaType = fieldType(field); String fieldName = nameAllocator.get(field); MethodSpec.Builder result = MethodSpec.methodBuilder(fieldName) .addModifiers(PUBLIC) .addParameter(javaType, fieldName) .returns(builderType); if (!field.getDocumentation().isEmpty()) { result.addJavadoc("$L\n", sanitizeJavadoc(field.getDocumentation())); } if (field.isDeprecated()) { result.addAnnotation(Deprecated.class); } if (field.isRepeated() || field.getType().isMap()) { result.addStatement("$T.checkElementsNotNull($L)", Internal.class, fieldName); } result.addStatement("this.$L = $L", fieldName, fieldName); if (oneOf != null) { for (Field other : oneOf.getFields()) { if (field != other) { result.addStatement("this.$L = null", nameAllocator.get(other)); } } } result.addStatement("return this"); return result.build(); } // Example: // // @Override // public SimpleMessage build() { // if (field_one == null) { // throw missingRequiredFields(field_one, "field_one"); // } // return new SimpleMessage(field_one, super.buildUnknownFields()); // } // // The call to checkRequiredFields will be emitted only if the message has // required fields. The constructor can also take instance of the builder // rather than individual fields depending on how many fields there are. // private MethodSpec builderBuild( NameAllocator nameAllocator, MessageType message, ClassName javaType) { MethodSpec.Builder result = MethodSpec.methodBuilder("build") .addAnnotation(Override.class) .addModifiers(PUBLIC) .returns(javaType); List<Field> requiredFields = message.getRequiredFields(); if (!requiredFields.isEmpty()) { CodeBlock.Builder conditionals = CodeBlock.builder().add("$["); CodeBlock.Builder missingArgs = CodeBlock.builder(); for (int i = 0; i < requiredFields.size(); i++) { Field requiredField = requiredFields.get(i); if (i > 0) conditionals.add("\n|| "); conditionals.add("$L == null", nameAllocator.get(requiredField)); if (i > 0) missingArgs.add(",\n"); missingArgs.add("$1L, $2S", nameAllocator.get(requiredField), requiredField.getName()); } result .beginControlFlow("if ($L)", conditionals.add("$]").build()) .addStatement("throw $T.missingRequiredFields($L)", Internal.class, missingArgs.build()) .endControlFlow(); } boolean constructorTakesAllFields = constructorTakesAllFields(message); result.addCode("return new $T(", javaType); if (constructorTakesAllFields) { for (Field field : message.getFieldsAndOneOfFields()) { result.addCode("$L, ", nameAllocator.get(field)); } } else { result.addCode("this, "); } result.addCode("super.buildUnknownFields());\n"); return result.build(); } private CodeBlock defaultValue(Field field) { Object defaultValue = field.getDefault(); if (defaultValue == null && isEnum(field.getType())) { defaultValue = enumDefault(field.getType()).getName(); } if (field.getType().isScalar() || defaultValue != null) { return fieldInitializer(field.getType(), defaultValue, false); } throw new IllegalStateException("Field " + field + " cannot have default value"); } private CodeBlock fieldInitializer(ProtoType type, @Nullable Object value, boolean annotation) { TypeName javaType = typeName(type); if (value instanceof List) { CodeBlock.Builder builder = CodeBlock.builder(); if (annotation) { builder.add("{"); } else { builder.add("$T.asList(", Arrays.class); } boolean first = true; for (Object o : (List<?>) value) { if (!first) builder.add(","); first = false; builder.add("\n$>$>$L$<$<", fieldInitializer(type, o, annotation)); } builder.add(annotation ? "}" : ")"); return builder.build(); } else if (value instanceof Map) { CodeBlock.Builder builder = CodeBlock.builder(); builder.add("new $T.Builder()", javaType); for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) { ProtoMember protoMember = (ProtoMember) entry.getKey(); Field field = schema.getField(protoMember); CodeBlock valueInitializer = fieldInitializer(field.getType(), entry.getValue(), annotation); builder.add("\n$>$>.$L($L)$<$<", fieldName(type, field), valueInitializer); } builder.add("\n$>$>.build()$<$<"); return builder.build(); } else if (javaType.equals(TypeName.BOOLEAN)) { return CodeBlock.of("$L", value != null ? value : false); } else if (javaType.equals(TypeName.INT)) { return CodeBlock.of("$L", optionValueToInt(value)); } else if (javaType.equals(TypeName.LONG)) { return CodeBlock.of("$LL", optionValueToLong(value)); } else if (javaType.equals(TypeName.FLOAT)) { if (value == null) { return CodeBlock.of("0.0f"); } else if ("inf".equals(value)) { return CodeBlock.of("Float.POSITIVE_INFINITY"); } else if ("-inf".equals(value)) { return CodeBlock.of("Float.NEGATIVE_INFINITY"); } else if ("nan".equals(value) || "-nan".equals(value)) { return CodeBlock.of("Float.NaN"); } else { return CodeBlock.of("$Lf", String.valueOf(value)); } } else if (javaType.equals(TypeName.DOUBLE)) { if (value == null) { return CodeBlock.of("0.0d"); } else if ("inf".equals(value)) { return CodeBlock.of("Double.POSITIVE_INFINITY"); } else if ("-inf".equals(value)) { return CodeBlock.of("Double.NEGATIVE_INFINITY"); } else if ("nan".equals(value) || "-nan".equals(value)) { return CodeBlock.of("Double.NaN"); } else { return CodeBlock.of("$Ld", String.valueOf(value)); } } else if (javaType.equals(STRING)) { return CodeBlock.of("$S", value != null ? value : ""); } else if (javaType.equals(BYTE_STRING)) { if (value == null) { return CodeBlock.of("$T.EMPTY", ByteString.class); } else { return CodeBlock.of( "$T.decodeBase64($S)", ByteString.class, ByteString.encodeString(String.valueOf(value), Charsets.ISO_8859_1).base64()); } } else if (isEnum(type) && value != null) { return CodeBlock.of("$T.$L", javaType, value); } else { throw new IllegalStateException(type + " is not an allowed scalar type"); } } private CodeBlock identityValue(Field field) { switch (field.getEncodeMode()) { case MAP: return CodeBlock.of("$T.emptyMap()", Collections.class); case REPEATED: case PACKED: return CodeBlock.of("$T.emptyList()", Collections.class); case NULL_IF_ABSENT: return CodeBlock.of("null"); case OMIT_IDENTITY: ProtoType protoType = field.getType(); Type type = schema.getType(protoType); if (protoType.equals(ProtoType.STRUCT_NULL)) { return CodeBlock.of("null"); } else if (field.isOneOf()) { return CodeBlock.of("null"); } else if (protoType.isScalar()) { CodeBlock value = PROTOTYPE_TO_IDENTITY_VALUES.get(protoType); if (value == null) { throw new IllegalArgumentException("Unexpected scalar proto type: " + protoType); } return value; } else if (type instanceof MessageType) { return CodeBlock.of("null"); } else if (type instanceof EnumType) { return identity((EnumType) type); } case REQUIRED: default: throw new IllegalArgumentException( "No identity value for field: " + field + "(" + field.getEncodeMode() + ")"); } } private CodeBlock identity(EnumType enumType) { EnumConstant constantZero = enumType.constant(0); if (constantZero == null) return CodeBlock.of("null"); return CodeBlock.of( "$T.$L", typeName(enumType.getType()), nameAllocators.getUnchecked(enumType).get(constantZero)); } /** Returns the full name of the class generated for {@code member}. */ public ClassName generatedTypeName(ProtoMember member) { return (ClassName) memberToJavaName.get(member); } // Example: // // @Retention(RetentionPolicy.RUNTIME) // @Target(ElementType.FIELD) // public @interface MyFieldOption { // String value(); // } public @Nullable TypeSpec generateOptionType(Extend extend, Field field) { checkArgument(extend.getFields().contains(field)); if (!emitDeclaredOptions) return null; ElementType elementType = annotationTargetType(extend); if (elementType == null) return null; if (!eligibleAsAnnotationMember(schema, field)) return null; TypeName returnType; if (field.getLabel().equals(Field.Label.REPEATED)) { TypeName typeName = typeName(field.getType()); if (typeName.equals(TypeName.LONG) || typeName.equals(TypeName.INT) || typeName.equals(TypeName.FLOAT) || typeName.equals(TypeName.DOUBLE) || typeName.equals(TypeName.BOOLEAN) || typeName.equals(ClassName.get(String.class)) || isEnum(field.getType())) { returnType = ArrayTypeName.of(typeName); } else { throw new IllegalStateException("Unsupported annotation for " + field.getType()); } } else { returnType = typeName(field.getType()); } ClassName javaType = generatedTypeName(extend.member(field)); TypeSpec.Builder builder = TypeSpec.annotationBuilder(javaType.simpleName()) .addModifiers(PUBLIC) .addAnnotation( AnnotationSpec.builder(Retention.class) .addMember("value", "$T.$L", RetentionPolicy.class, RetentionPolicy.RUNTIME) .build()) .addAnnotation( AnnotationSpec.builder(Target.class) .addMember("value", "$T.$L", ElementType.class, elementType) .build()); if (!field.getDocumentation().isEmpty()) { builder.addJavadoc("$L\n", field.getDocumentation()); } builder.addMethod( MethodSpec.methodBuilder("value") .returns(returnType) .addModifiers(PUBLIC, ABSTRACT) .build()); return builder.build(); } private List<AnnotationSpec> optionAnnotations(Options options) { List<AnnotationSpec> result = new ArrayList<>(); for (Map.Entry<ProtoMember, Object> entry : options.getMap().entrySet()) { AnnotationSpec annotationSpec = optionAnnotation(entry.getKey(), entry.getValue()); if (annotationSpec != null) { result.add(annotationSpec); } } return result; } private @Nullable AnnotationSpec optionAnnotation(ProtoMember protoMember, Object value) { if (!emitAppliedOptions) return null; Field field = schema.getField(protoMember); if (field == null) return null; if (!eligibleAsAnnotationMember(schema, field)) return null; ProtoFile protoFile = schema.protoFile(field.getLocation().getPath()); ClassName type = annotationName(protoFile, field, new ClassNameFactory()); CodeBlock fieldValue = fieldInitializer(field.getType(), value, true); return AnnotationSpec.builder(type).addMember("value", fieldValue).build(); } }
6,915
0
Create_ds/wire/wire-gradle-plugin-playground/src/main
Create_ds/wire/wire-gradle-plugin-playground/src/main/java/MyListener.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. */ import com.squareup.wire.schema.EmittingRules; import com.squareup.wire.schema.EventListener; import com.squareup.wire.schema.PruningRules; import com.squareup.wire.schema.Schema; import com.squareup.wire.schema.SchemaHandler; import com.squareup.wire.schema.WireRun; import com.squareup.wire.schema.internal.TypeMover; import java.util.List; import org.jetbrains.annotations.NotNull; public class MyListener extends EventListener { @Override public void runStart(@NotNull WireRun wireRun) { super.runStart(wireRun); } @Override public void runSuccess(@NotNull WireRun wireRun) { super.runSuccess(wireRun); } @Override public void runFailed(@NotNull List<String> errors) { super.runFailed(errors); } @Override public void loadSchemaStart() { super.loadSchemaStart(); } @Override public void loadSchemaSuccess(@NotNull Schema schema) { super.loadSchemaSuccess(schema); } @Override public void treeShakeStart(@NotNull Schema schema, @NotNull PruningRules pruningRules) { super.treeShakeStart(schema, pruningRules); } @Override public void treeShakeEnd(@NotNull Schema refactoredSchema, @NotNull PruningRules pruningRules) { super.treeShakeEnd(refactoredSchema, pruningRules); } @Override public void moveTypesStart(@NotNull Schema schema, @NotNull List<TypeMover.Move> moves) { super.moveTypesStart(schema, moves); } @Override public void moveTypesEnd(@NotNull Schema refactoredSchema, @NotNull List<TypeMover.Move> moves) { super.moveTypesEnd(refactoredSchema, moves); } @Override public void schemaHandlersStart() { super.schemaHandlersStart(); } @Override public void schemaHandlersEnd() { super.schemaHandlersEnd(); } @Override public void schemaHandlerStart( @NotNull SchemaHandler schemaHandler, @NotNull EmittingRules emittingRules) { super.schemaHandlerStart(schemaHandler, emittingRules); } @Override public void schemaHandlerEnd( @NotNull SchemaHandler schemaHandler, @NotNull EmittingRules emittingRules) { super.schemaHandlerEnd(schemaHandler, emittingRules); } }
6,916
0
Create_ds/wire/wire-tests/src/jvmKotlinInteropTest/proto-kotlin/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmKotlinInteropTest/proto-kotlin/com/squareup/wire/protos/depend_on_kotlin_option/Letter.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.depend_on_kotlin_option.Letter in depend_on_kotlin_option.proto package com.squareup.wire.protos.depend_on_kotlin_option; 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.protos.custom_options.MyFieldOptionOneOption; import java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Letter extends Message<Letter, Letter.Builder> { public static final ProtoAdapter<Letter> ADAPTER = new ProtoAdapter_Letter(); private static final long serialVersionUID = 0L; public static final String DEFAULT_SUBJECT = ""; @MyFieldOptionOneOption(12) @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String subject; public Letter(String subject) { this(subject, ByteString.EMPTY); } public Letter(String subject, ByteString unknownFields) { super(ADAPTER, unknownFields); this.subject = subject; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.subject = subject; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Letter)) return false; Letter o = (Letter) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(subject, o.subject); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (subject != null ? subject.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (subject != null) builder.append(", subject=").append(Internal.sanitize(subject)); return builder.replace(0, 2, "Letter{").append('}').toString(); } public static final class Builder extends Message.Builder<Letter, Builder> { public String subject; public Builder() { } public Builder subject(String subject) { this.subject = subject; return this; } @Override public Letter build() { return new Letter(subject, super.buildUnknownFields()); } } private static final class ProtoAdapter_Letter extends ProtoAdapter<Letter> { public ProtoAdapter_Letter() { super(FieldEncoding.LENGTH_DELIMITED, Letter.class, "type.googleapis.com/squareup.protos.depend_on_kotlin_option.Letter", Syntax.PROTO_2, null, "depend_on_kotlin_option.proto"); } @Override public int encodedSize(Letter value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.subject); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Letter value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.subject); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Letter value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.subject); } @Override public Letter 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.subject(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Letter redact(Letter value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,917
0
Create_ds/wire/wire-tests/src/jvmJavaAndroidCompactTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaAndroidCompactTest/proto-java/com/squareup/wire/protos/person/Person.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.person.Person in person.proto package com.squareup.wire.protos.person; import android.os.Parcelable; import com.squareup.wire.AndroidMessage; 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.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.List; import okio.ByteString; public final class Person extends AndroidMessage<Person, Person.Builder> { public static final ProtoAdapter<Person> ADAPTER = ProtoAdapter.newMessageAdapter(Person.class, "type.googleapis.com/squareup.protos.person.Person", Syntax.PROTO_2); public static final Parcelable.Creator<Person> CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_ID = 0; public static final String DEFAULT_NAME = ""; public static final String DEFAULT_EMAIL = ""; /** * The customer's ID number. */ @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer id; /** * The customer's full name. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String name; /** * 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.protos.person.Person$PhoneNumber#ADAPTER", label = WireField.Label.REPEATED ) public final List<PhoneNumber> phone; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> aliases; public Person(Integer id, String name, String email, List<PhoneNumber> phone, List<String> aliases) { this(id, name, email, phone, aliases, ByteString.EMPTY); } public Person(Integer id, String name, String email, List<PhoneNumber> phone, List<String> aliases, ByteString unknownFields) { super(ADAPTER, unknownFields); this.id = id; this.name = name; this.email = email; this.phone = Internal.immutableCopyOf("phone", phone); this.aliases = Internal.immutableCopyOf("aliases", aliases); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.id = id; builder.name = name; builder.email = email; builder.phone = Internal.copyOf(phone); builder.aliases = Internal.copyOf(aliases); 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()) && id.equals(o.id) && name.equals(o.name) && Internal.equals(email, o.email) && phone.equals(o.phone) && aliases.equals(o.aliases); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + id.hashCode(); result = result * 37 + name.hashCode(); result = result * 37 + (email != null ? email.hashCode() : 0); result = result * 37 + phone.hashCode(); result = result * 37 + aliases.hashCode(); super.hashCode = result; } return result; } public static final class Builder extends Message.Builder<Person, Builder> { public Integer id; public String name; public String email; public List<PhoneNumber> phone; public List<String> aliases; public Builder() { phone = Internal.newMutableList(); aliases = Internal.newMutableList(); } /** * The customer's ID number. */ public Builder id(Integer id) { this.id = id; return this; } /** * The customer's full name. */ public Builder name(String name) { this.name = name; 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; } public Builder aliases(List<String> aliases) { Internal.checkElementsNotNull(aliases); this.aliases = aliases; return this; } @Override public Person build() { if (id == null || name == null) { throw Internal.missingRequiredFields(id, "id", name, "name"); } return new Person(id, name, email, phone, aliases, super.buildUnknownFields()); } } public enum PhoneType implements WireEnum { MOBILE(0), HOME(1), /** * Could be phone or fax. */ WORK(2); public static final ProtoAdapter<PhoneType> ADAPTER = ProtoAdapter.newEnumAdapter(PhoneType.class); 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; } } public static final class PhoneNumber extends AndroidMessage<PhoneNumber, PhoneNumber.Builder> { public static final ProtoAdapter<PhoneNumber> ADAPTER = ProtoAdapter.newMessageAdapter(PhoneNumber.class, "type.googleapis.com/squareup.protos.person.Person.PhoneNumber", Syntax.PROTO_2); public static final Parcelable.Creator<PhoneNumber> CREATOR = AndroidMessage.newCreator(ADAPTER); 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.protos.person.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; } 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()); } } } }
6,918
0
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos/roots/H.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.H in roots.proto package com.squareup.wire.protos.roots; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class H extends Message<H, H.Builder> { public static final ProtoAdapter<H> ADAPTER = new ProtoAdapter_H(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.roots.E$F#ADAPTER" ) public final E.F ef; public H(E.F ef) { this(ef, ByteString.EMPTY); } public H(E.F ef, ByteString unknownFields) { super(ADAPTER, unknownFields); this.ef = ef; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.ef = ef; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof H)) return false; H o = (H) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(ef, o.ef); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (ef != null ? ef.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (ef != null) builder.append(", ef=").append(ef); return builder.replace(0, 2, "H{").append('}').toString(); } public static final class Builder extends Message.Builder<H, Builder> { public E.F ef; public Builder() { } public Builder ef(E.F ef) { this.ef = ef; return this; } @Override public H build() { return new H(ef, super.buildUnknownFields()); } } private static final class ProtoAdapter_H extends ProtoAdapter<H> { public ProtoAdapter_H() { super(FieldEncoding.LENGTH_DELIMITED, H.class, "type.googleapis.com/squareup.protos.roots.H", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(H value) { int result = 0; result += E.F.ADAPTER.encodedSizeWithTag(1, value.ef); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, H value) throws IOException { E.F.ADAPTER.encodeWithTag(writer, 1, value.ef); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, H value) throws IOException { writer.writeBytes(value.unknownFields()); E.F.ADAPTER.encodeWithTag(writer, 1, value.ef); } @Override public H 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.ef(E.F.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public H redact(H value) { Builder builder = value.newBuilder(); if (builder.ef != null) builder.ef = E.F.ADAPTER.redact(builder.ef); builder.clearUnknownFields(); return builder.build(); } } }
6,919
0
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos/roots/D.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.D in roots.proto package com.squareup.wire.protos.roots; 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 okio.ByteString; public final class D extends Message<D, D.Builder> { public static final ProtoAdapter<D> ADAPTER = new ProtoAdapter_D(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public D(Integer i) { this(i, ByteString.EMPTY); } public D(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof D)) return false; D o = (D) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "D{").append('}').toString(); } public static final class Builder extends Message.Builder<D, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public D build() { return new D(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_D extends ProtoAdapter<D> { public ProtoAdapter_D() { super(FieldEncoding.LENGTH_DELIMITED, D.class, "type.googleapis.com/squareup.protos.roots.D", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(D value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, D value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, D value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public D 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public D redact(D value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,920
0
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos/roots/E.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.E in roots.proto package com.squareup.wire.protos.roots; 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.AssertionError; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; /** * <b>NOTE:</b> This type only exists to maintain class structure for its nested types and is not an actual message. */ public final class E { private E() { throw new AssertionError(); } public static final class F extends Message<F, F.Builder> { public static final ProtoAdapter<F> ADAPTER = new ProtoAdapter_F(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public F(Integer i) { this(i, ByteString.EMPTY); } public F(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof F)) return false; F o = (F) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "F{").append('}').toString(); } public static final class Builder extends Message.Builder<F, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public F build() { return new F(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_F extends ProtoAdapter<F> { public ProtoAdapter_F() { super(FieldEncoding.LENGTH_DELIMITED, F.class, "type.googleapis.com/squareup.protos.roots.E.F", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(F value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, F value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, F value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public F 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public F redact(F value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } }
6,921
0
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaPrunedTest/proto-java/com/squareup/wire/protos/roots/A.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.A in roots.proto package com.squareup.wire.protos.roots; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; /** * Used to test --includes flag of WireCompiler * * A -> B -> C * \ * -> D * * E -> E.F * \ * -> G * * H -> E.F * * I -> nothing */ public final class A extends Message<A, A.Builder> { public static final ProtoAdapter<A> ADAPTER = new ProtoAdapter_A(); private static final long serialVersionUID = 0L; @WireField( tag = 2, adapter = "com.squareup.wire.protos.roots.D#ADAPTER" ) public final D d; public A(D d) { this(d, ByteString.EMPTY); } public A(D d, ByteString unknownFields) { super(ADAPTER, unknownFields); this.d = d; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.d = d; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof A)) return false; A o = (A) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(d, o.d); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (d != null ? d.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (d != null) builder.append(", d=").append(d); return builder.replace(0, 2, "A{").append('}').toString(); } public static final class Builder extends Message.Builder<A, Builder> { public D d; public Builder() { } public Builder d(D d) { this.d = d; return this; } @Override public A build() { return new A(d, super.buildUnknownFields()); } } private static final class ProtoAdapter_A extends ProtoAdapter<A> { public ProtoAdapter_A() { super(FieldEncoding.LENGTH_DELIMITED, A.class, "type.googleapis.com/squareup.protos.roots.A", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(A value) { int result = 0; result += D.ADAPTER.encodedSizeWithTag(2, value.d); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, A value) throws IOException { D.ADAPTER.encodeWithTag(writer, 2, value.d); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, A value) throws IOException { writer.writeBytes(value.unknownFields()); D.ADAPTER.encodeWithTag(writer, 2, value.d); } @Override public A decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 2: builder.d(D.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public A redact(A value) { Builder builder = value.newBuilder(); if (builder.d != null) builder.d = D.ADAPTER.redact(builder.d); builder.clearUnknownFields(); return builder.build(); } } }
6,922
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/squareup/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/squareup/protos/packed_encoding/OuterMessage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.packed_encoding.OuterMessage in packed_encoding.proto package squareup.protos.packed_encoding; 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 okio.ByteString; public final class OuterMessage extends Message<OuterMessage, OuterMessage.Builder> { public static final ProtoAdapter<OuterMessage> ADAPTER = new ProtoAdapter_OuterMessage(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OUTER_NUMBER_BEFORE = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer outer_number_before; @WireField( tag = 2, adapter = "squareup.protos.packed_encoding.EmbeddedMessage#ADAPTER" ) public final EmbeddedMessage embedded_message; public OuterMessage(Integer outer_number_before, EmbeddedMessage embedded_message) { this(outer_number_before, embedded_message, ByteString.EMPTY); } public OuterMessage(Integer outer_number_before, EmbeddedMessage embedded_message, ByteString unknownFields) { super(ADAPTER, unknownFields); this.outer_number_before = outer_number_before; this.embedded_message = embedded_message; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.outer_number_before = outer_number_before; builder.embedded_message = embedded_message; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof OuterMessage)) return false; OuterMessage o = (OuterMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(outer_number_before, o.outer_number_before) && Internal.equals(embedded_message, o.embedded_message); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (outer_number_before != null ? outer_number_before.hashCode() : 0); result = result * 37 + (embedded_message != null ? embedded_message.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (outer_number_before != null) builder.append(", outer_number_before=").append(outer_number_before); if (embedded_message != null) builder.append(", embedded_message=").append(embedded_message); return builder.replace(0, 2, "OuterMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<OuterMessage, Builder> { public Integer outer_number_before; public EmbeddedMessage embedded_message; public Builder() { } public Builder outer_number_before(Integer outer_number_before) { this.outer_number_before = outer_number_before; return this; } public Builder embedded_message(EmbeddedMessage embedded_message) { this.embedded_message = embedded_message; return this; } @Override public OuterMessage build() { return new OuterMessage(outer_number_before, embedded_message, super.buildUnknownFields()); } } private static final class ProtoAdapter_OuterMessage extends ProtoAdapter<OuterMessage> { public ProtoAdapter_OuterMessage() { super(FieldEncoding.LENGTH_DELIMITED, OuterMessage.class, "type.googleapis.com/squareup.protos.packed_encoding.OuterMessage", Syntax.PROTO_2, null, "packed_encoding.proto"); } @Override public int encodedSize(OuterMessage value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.outer_number_before); result += EmbeddedMessage.ADAPTER.encodedSizeWithTag(2, value.embedded_message); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, OuterMessage value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.outer_number_before); EmbeddedMessage.ADAPTER.encodeWithTag(writer, 2, value.embedded_message); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, OuterMessage value) throws IOException { writer.writeBytes(value.unknownFields()); EmbeddedMessage.ADAPTER.encodeWithTag(writer, 2, value.embedded_message); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.outer_number_before); } @Override public OuterMessage 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.outer_number_before(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.embedded_message(EmbeddedMessage.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public OuterMessage redact(OuterMessage value) { Builder builder = value.newBuilder(); if (builder.embedded_message != null) builder.embedded_message = EmbeddedMessage.ADAPTER.redact(builder.embedded_message); builder.clearUnknownFields(); return builder.build(); } } }
6,923
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/squareup/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/squareup/protos/packed_encoding/EmbeddedMessage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.packed_encoding.EmbeddedMessage in packed_encoding.proto package squareup.protos.packed_encoding; 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 okio.ByteString; public final class EmbeddedMessage extends Message<EmbeddedMessage, EmbeddedMessage.Builder> { public static final ProtoAdapter<EmbeddedMessage> ADAPTER = new ProtoAdapter_EmbeddedMessage(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_INNER_NUMBER_AFTER = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.PACKED ) public final List<Integer> inner_repeated_number; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer inner_number_after; public EmbeddedMessage(List<Integer> inner_repeated_number, Integer inner_number_after) { this(inner_repeated_number, inner_number_after, ByteString.EMPTY); } public EmbeddedMessage(List<Integer> inner_repeated_number, Integer inner_number_after, ByteString unknownFields) { super(ADAPTER, unknownFields); this.inner_repeated_number = Internal.immutableCopyOf("inner_repeated_number", inner_repeated_number); this.inner_number_after = inner_number_after; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.inner_repeated_number = Internal.copyOf(inner_repeated_number); builder.inner_number_after = inner_number_after; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof EmbeddedMessage)) return false; EmbeddedMessage o = (EmbeddedMessage) other; return unknownFields().equals(o.unknownFields()) && inner_repeated_number.equals(o.inner_repeated_number) && Internal.equals(inner_number_after, o.inner_number_after); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + inner_repeated_number.hashCode(); result = result * 37 + (inner_number_after != null ? inner_number_after.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!inner_repeated_number.isEmpty()) builder.append(", inner_repeated_number=").append(inner_repeated_number); if (inner_number_after != null) builder.append(", inner_number_after=").append(inner_number_after); return builder.replace(0, 2, "EmbeddedMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<EmbeddedMessage, Builder> { public List<Integer> inner_repeated_number; public Integer inner_number_after; public Builder() { inner_repeated_number = Internal.newMutableList(); } public Builder inner_repeated_number(List<Integer> inner_repeated_number) { Internal.checkElementsNotNull(inner_repeated_number); this.inner_repeated_number = inner_repeated_number; return this; } public Builder inner_number_after(Integer inner_number_after) { this.inner_number_after = inner_number_after; return this; } @Override public EmbeddedMessage build() { return new EmbeddedMessage(inner_repeated_number, inner_number_after, super.buildUnknownFields()); } } private static final class ProtoAdapter_EmbeddedMessage extends ProtoAdapter<EmbeddedMessage> { public ProtoAdapter_EmbeddedMessage() { super(FieldEncoding.LENGTH_DELIMITED, EmbeddedMessage.class, "type.googleapis.com/squareup.protos.packed_encoding.EmbeddedMessage", Syntax.PROTO_2, null, "packed_encoding.proto"); } @Override public int encodedSize(EmbeddedMessage value) { int result = 0; result += ProtoAdapter.INT32.asPacked().encodedSizeWithTag(1, value.inner_repeated_number); result += ProtoAdapter.INT32.encodedSizeWithTag(2, value.inner_number_after); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, EmbeddedMessage value) throws IOException { ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 1, value.inner_repeated_number); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.inner_number_after); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, EmbeddedMessage value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.inner_number_after); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 1, value.inner_repeated_number); } @Override public EmbeddedMessage 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.inner_repeated_number.add(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.inner_number_after(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public EmbeddedMessage redact(EmbeddedMessage value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,924
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/squareup/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/squareup/protos/extension_collision/CollisionSubject.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.extension_collision.CollisionSubject in extension_collision.proto package squareup.protos.extension_collision; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class CollisionSubject extends Message<CollisionSubject, CollisionSubject.Builder> { public static final ProtoAdapter<CollisionSubject> ADAPTER = new ProtoAdapter_CollisionSubject(); private static final long serialVersionUID = 0L; public static final String DEFAULT_F = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String f; public CollisionSubject(String f) { this(f, ByteString.EMPTY); } public CollisionSubject(String f, ByteString unknownFields) { super(ADAPTER, unknownFields); this.f = f; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.f = f; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof CollisionSubject)) return false; CollisionSubject o = (CollisionSubject) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(f, o.f); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (f != null ? f.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (f != null) builder.append(", f=").append(Internal.sanitize(f)); return builder.replace(0, 2, "CollisionSubject{").append('}').toString(); } public static final class Builder extends Message.Builder<CollisionSubject, Builder> { public String f; public Builder() { } public Builder f(String f) { this.f = f; return this; } @Override public CollisionSubject build() { return new CollisionSubject(f, super.buildUnknownFields()); } } private static final class ProtoAdapter_CollisionSubject extends ProtoAdapter<CollisionSubject> { public ProtoAdapter_CollisionSubject() { super(FieldEncoding.LENGTH_DELIMITED, CollisionSubject.class, "type.googleapis.com/squareup.protos.extension_collision.CollisionSubject", Syntax.PROTO_2, null, "extension_collision.proto"); } @Override public int encodedSize(CollisionSubject value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.f); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, CollisionSubject value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.f); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, CollisionSubject value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.f); } @Override public CollisionSubject 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.f(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public CollisionSubject redact(CollisionSubject value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,925
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/differentpackage/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/differentpackage/protos/foo/Foo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.differentpackage.foo.Foo in differentpackage/foo.proto package com.squareup.differentpackage.protos.foo; import com.squareup.differentpackage.protos.bar.Bar; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Foo extends Message<Foo, Foo.Builder> { public static final ProtoAdapter<Foo> ADAPTER = new ProtoAdapter_Foo(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.differentpackage.protos.bar.Bar$Baz$Moo#ADAPTER" ) public final Bar.Baz.Moo moo; public Foo(Bar.Baz.Moo moo) { this(moo, ByteString.EMPTY); } public Foo(Bar.Baz.Moo moo, ByteString unknownFields) { super(ADAPTER, unknownFields); this.moo = moo; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.moo = moo; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Foo)) return false; Foo o = (Foo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(moo, o.moo); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (moo != null ? moo.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (moo != null) builder.append(", moo=").append(moo); return builder.replace(0, 2, "Foo{").append('}').toString(); } public static final class Builder extends Message.Builder<Foo, Builder> { public Bar.Baz.Moo moo; public Builder() { } public Builder moo(Bar.Baz.Moo moo) { this.moo = moo; return this; } @Override public Foo build() { return new Foo(moo, super.buildUnknownFields()); } } private static final class ProtoAdapter_Foo extends ProtoAdapter<Foo> { public ProtoAdapter_Foo() { super(FieldEncoding.LENGTH_DELIMITED, Foo.class, "type.googleapis.com/squareup.differentpackage.foo.Foo", Syntax.PROTO_2, null, "differentpackage/foo.proto"); } @Override public int encodedSize(Foo value) { int result = 0; result += Bar.Baz.Moo.ADAPTER.encodedSizeWithTag(1, value.moo); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Foo value) throws IOException { Bar.Baz.Moo.ADAPTER.encodeWithTag(writer, 1, value.moo); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Foo value) throws IOException { writer.writeBytes(value.unknownFields()); Bar.Baz.Moo.ADAPTER.encodeWithTag(writer, 1, value.moo); } @Override public Foo 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.moo(Bar.Baz.Moo.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Foo redact(Foo value) { Builder builder = value.newBuilder(); if (builder.moo != null) builder.moo = Bar.Baz.Moo.ADAPTER.redact(builder.moo); builder.clearUnknownFields(); return builder.build(); } } }
6,926
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/differentpackage/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/differentpackage/protos/bar/Bar.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.differentpackage.bar.Bar in differentpackage/bar.proto package com.squareup.differentpackage.protos.bar; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Bar extends Message<Bar, Bar.Builder> { public static final ProtoAdapter<Bar> ADAPTER = new ProtoAdapter_Bar(); private static final long serialVersionUID = 0L; public Bar() { this(ByteString.EMPTY); } public Bar(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Bar)) return false; Bar o = (Bar) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "Bar{").append('}').toString(); } public static final class Builder extends Message.Builder<Bar, Builder> { public Builder() { } @Override public Bar build() { return new Bar(super.buildUnknownFields()); } } public static final class Baz extends Message<Baz, Baz.Builder> { public static final ProtoAdapter<Baz> ADAPTER = new ProtoAdapter_Baz(); private static final long serialVersionUID = 0L; public Baz() { this(ByteString.EMPTY); } public Baz(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Baz)) return false; Baz o = (Baz) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "Baz{").append('}').toString(); } public static final class Builder extends Message.Builder<Baz, Builder> { public Builder() { } @Override public Baz build() { return new Baz(super.buildUnknownFields()); } } public static final class Moo extends Message<Moo, Moo.Builder> { public static final ProtoAdapter<Moo> ADAPTER = new ProtoAdapter_Moo(); private static final long serialVersionUID = 0L; public static final String DEFAULT_BOO = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String boo; public Moo(String boo) { this(boo, ByteString.EMPTY); } public Moo(String boo, ByteString unknownFields) { super(ADAPTER, unknownFields); this.boo = boo; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.boo = boo; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Moo)) return false; Moo o = (Moo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(boo, o.boo); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (boo != null ? boo.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (boo != null) builder.append(", boo=").append(Internal.sanitize(boo)); return builder.replace(0, 2, "Moo{").append('}').toString(); } public static final class Builder extends Message.Builder<Moo, Builder> { public String boo; public Builder() { } public Builder boo(String boo) { this.boo = boo; return this; } @Override public Moo build() { return new Moo(boo, super.buildUnknownFields()); } } private static final class ProtoAdapter_Moo extends ProtoAdapter<Moo> { public ProtoAdapter_Moo() { super(FieldEncoding.LENGTH_DELIMITED, Moo.class, "type.googleapis.com/squareup.differentpackage.bar.Bar.Baz.Moo", Syntax.PROTO_2, null, "differentpackage/bar.proto"); } @Override public int encodedSize(Moo value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.boo); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Moo value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.boo); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Moo value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.boo); } @Override public Moo 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.boo(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Moo redact(Moo value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_Baz extends ProtoAdapter<Baz> { public ProtoAdapter_Baz() { super(FieldEncoding.LENGTH_DELIMITED, Baz.class, "type.googleapis.com/squareup.differentpackage.bar.Bar.Baz", Syntax.PROTO_2, null, "differentpackage/bar.proto"); } @Override public int encodedSize(Baz value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Baz value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Baz value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public Baz decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Baz redact(Baz value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_Bar extends ProtoAdapter<Bar> { public ProtoAdapter_Bar() { super(FieldEncoding.LENGTH_DELIMITED, Bar.class, "type.googleapis.com/squareup.differentpackage.bar.Bar", Syntax.PROTO_2, null, "differentpackage/bar.proto"); } @Override public int encodedSize(Bar value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Bar value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Bar value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public Bar decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Bar redact(Bar value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,927
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/RepeatedPackedAndMap.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.alltypes.RepeatedPackedAndMap in collection_types.proto package com.squareup.wire.protos; 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.protos.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; } } }
6,928
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/ChildPackage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.ChildPackage in child_pkg.proto package com.squareup.wire.protos; 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.protos.foreign.ForeignEnum; import java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class ChildPackage extends Message<ChildPackage, ChildPackage.Builder> { public static final ProtoAdapter<ChildPackage> ADAPTER = new ProtoAdapter_ChildPackage(); private static final long serialVersionUID = 0L; public static final ForeignEnum DEFAULT_INNER_FOREIGN_ENUM = ForeignEnum.BAV; @WireField( tag = 1, adapter = "com.squareup.wire.protos.foreign.ForeignEnum#ADAPTER" ) public final ForeignEnum inner_foreign_enum; public ChildPackage(ForeignEnum inner_foreign_enum) { this(inner_foreign_enum, ByteString.EMPTY); } public ChildPackage(ForeignEnum inner_foreign_enum, ByteString unknownFields) { super(ADAPTER, unknownFields); this.inner_foreign_enum = inner_foreign_enum; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.inner_foreign_enum = inner_foreign_enum; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof ChildPackage)) return false; ChildPackage o = (ChildPackage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(inner_foreign_enum, o.inner_foreign_enum); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (inner_foreign_enum != null ? inner_foreign_enum.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (inner_foreign_enum != null) builder.append(", inner_foreign_enum=").append(inner_foreign_enum); return builder.replace(0, 2, "ChildPackage{").append('}').toString(); } public static final class Builder extends Message.Builder<ChildPackage, Builder> { public ForeignEnum inner_foreign_enum; public Builder() { } public Builder inner_foreign_enum(ForeignEnum inner_foreign_enum) { this.inner_foreign_enum = inner_foreign_enum; return this; } @Override public ChildPackage build() { return new ChildPackage(inner_foreign_enum, super.buildUnknownFields()); } } private static final class ProtoAdapter_ChildPackage extends ProtoAdapter<ChildPackage> { public ProtoAdapter_ChildPackage() { super(FieldEncoding.LENGTH_DELIMITED, ChildPackage.class, "type.googleapis.com/squareup.protos.ChildPackage", Syntax.PROTO_2, null, "child_pkg.proto"); } @Override public int encodedSize(ChildPackage value) { int result = 0; result += ForeignEnum.ADAPTER.encodedSizeWithTag(1, value.inner_foreign_enum); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, ChildPackage value) throws IOException { ForeignEnum.ADAPTER.encodeWithTag(writer, 1, value.inner_foreign_enum); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, ChildPackage value) throws IOException { writer.writeBytes(value.unknownFields()); ForeignEnum.ADAPTER.encodeWithTag(writer, 1, value.inner_foreign_enum); } @Override public ChildPackage decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: { try { builder.inner_foreign_enum(ForeignEnum.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 ChildPackage redact(ChildPackage value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,929
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/custom_options/MessageWithOptions.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.custom_options.MessageWithOptions in custom_options.proto package com.squareup.wire.protos.custom_options; 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 java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class MessageWithOptions extends Message<MessageWithOptions, MessageWithOptions.Builder> { public static final ProtoAdapter<MessageWithOptions> ADAPTER = new ProtoAdapter_MessageWithOptions(); private static final long serialVersionUID = 0L; public MessageWithOptions() { this(ByteString.EMPTY); } public MessageWithOptions(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof MessageWithOptions)) return false; MessageWithOptions o = (MessageWithOptions) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "MessageWithOptions{").append('}').toString(); } public static final class Builder extends Message.Builder<MessageWithOptions, Builder> { public Builder() { } @Override public MessageWithOptions build() { return new MessageWithOptions(super.buildUnknownFields()); } } private static final class ProtoAdapter_MessageWithOptions extends ProtoAdapter<MessageWithOptions> { public ProtoAdapter_MessageWithOptions() { super(FieldEncoding.LENGTH_DELIMITED, MessageWithOptions.class, "type.googleapis.com/squareup.protos.custom_options.MessageWithOptions", Syntax.PROTO_2, null, "custom_options.proto"); } @Override public int encodedSize(MessageWithOptions value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, MessageWithOptions value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, MessageWithOptions value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public MessageWithOptions decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public MessageWithOptions redact(MessageWithOptions value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,930
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/custom_options/FooBar.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.custom_options.FooBar in custom_options.proto package com.squareup.wire.protos.custom_options; 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.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.lang.StringBuilder; import java.util.Collections; import java.util.List; import okio.ByteString; public final class FooBar extends Message<FooBar, FooBar.Builder> { public static final ProtoAdapter<FooBar> ADAPTER = new ProtoAdapter_FooBar(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_FOO = 0; public static final String DEFAULT_BAR = ""; public static final Long DEFAULT_QUX = 0L; public static final Double DEFAULT_DAISY = 0.0d; public static final FooBarBazEnum DEFAULT_EXT = FooBarBazEnum.FOO; public static final String DEFAULT_MORE_STRING = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer foo; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String bar; @WireField( tag = 3, adapter = "com.squareup.wire.protos.custom_options.FooBar$Nested#ADAPTER" ) public final Nested baz; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long qux; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#FLOAT", label = WireField.Label.REPEATED ) public final List<Float> fred; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double daisy; @WireField( tag = 7, adapter = "com.squareup.wire.protos.custom_options.FooBar#ADAPTER", label = WireField.Label.REPEATED, redacted = true ) public final List<FooBar> nested; /** * Extension source: custom_options.proto */ @WireField( tag = 101, adapter = "com.squareup.wire.protos.custom_options.FooBar$FooBarBazEnum#ADAPTER" ) public final FooBarBazEnum ext; /** * Extension source: custom_options.proto */ @WireField( tag = 102, adapter = "com.squareup.wire.protos.custom_options.FooBar$FooBarBazEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<FooBarBazEnum> rep; /** * Extension source: custom_options.proto */ @WireField( tag = 150, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String more_string; public FooBar(Integer foo, String bar, Nested baz, Long qux, List<Float> fred, Double daisy, List<FooBar> nested, FooBarBazEnum ext, List<FooBarBazEnum> rep, String more_string) { this(foo, bar, baz, qux, fred, daisy, nested, ext, rep, more_string, ByteString.EMPTY); } public FooBar(Integer foo, String bar, Nested baz, Long qux, List<Float> fred, Double daisy, List<FooBar> nested, FooBarBazEnum ext, List<FooBarBazEnum> rep, String more_string, ByteString unknownFields) { super(ADAPTER, unknownFields); this.foo = foo; this.bar = bar; this.baz = baz; this.qux = qux; this.fred = Internal.immutableCopyOf("fred", fred); this.daisy = daisy; this.nested = Internal.immutableCopyOf("nested", nested); this.ext = ext; this.rep = Internal.immutableCopyOf("rep", rep); this.more_string = more_string; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.foo = foo; builder.bar = bar; builder.baz = baz; builder.qux = qux; builder.fred = Internal.copyOf(fred); builder.daisy = daisy; builder.nested = Internal.copyOf(nested); builder.ext = ext; builder.rep = Internal.copyOf(rep); builder.more_string = more_string; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof FooBar)) return false; FooBar o = (FooBar) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(foo, o.foo) && Internal.equals(bar, o.bar) && Internal.equals(baz, o.baz) && Internal.equals(qux, o.qux) && fred.equals(o.fred) && Internal.equals(daisy, o.daisy) && nested.equals(o.nested) && Internal.equals(ext, o.ext) && rep.equals(o.rep) && Internal.equals(more_string, o.more_string); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (foo != null ? foo.hashCode() : 0); result = result * 37 + (bar != null ? bar.hashCode() : 0); result = result * 37 + (baz != null ? baz.hashCode() : 0); result = result * 37 + (qux != null ? qux.hashCode() : 0); result = result * 37 + fred.hashCode(); result = result * 37 + (daisy != null ? daisy.hashCode() : 0); result = result * 37 + nested.hashCode(); result = result * 37 + (ext != null ? ext.hashCode() : 0); result = result * 37 + rep.hashCode(); result = result * 37 + (more_string != null ? more_string.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (foo != null) builder.append(", foo=").append(foo); if (bar != null) builder.append(", bar=").append(Internal.sanitize(bar)); if (baz != null) builder.append(", baz=").append(baz); if (qux != null) builder.append(", qux=").append(qux); if (!fred.isEmpty()) builder.append(", fred=").append(fred); if (daisy != null) builder.append(", daisy=").append(daisy); if (!nested.isEmpty()) builder.append(", nested=██"); if (ext != null) builder.append(", ext=").append(ext); if (!rep.isEmpty()) builder.append(", rep=").append(rep); if (more_string != null) builder.append(", more_string=").append(Internal.sanitize(more_string)); return builder.replace(0, 2, "FooBar{").append('}').toString(); } public static final class Builder extends Message.Builder<FooBar, Builder> { public Integer foo; public String bar; public Nested baz; public Long qux; public List<Float> fred; public Double daisy; public List<FooBar> nested; public FooBarBazEnum ext; public List<FooBarBazEnum> rep; public String more_string; public Builder() { fred = Internal.newMutableList(); nested = Internal.newMutableList(); rep = Internal.newMutableList(); } public Builder foo(Integer foo) { this.foo = foo; return this; } public Builder bar(String bar) { this.bar = bar; return this; } public Builder baz(Nested baz) { this.baz = baz; return this; } public Builder qux(Long qux) { this.qux = qux; return this; } public Builder fred(List<Float> fred) { Internal.checkElementsNotNull(fred); this.fred = fred; return this; } public Builder daisy(Double daisy) { this.daisy = daisy; return this; } public Builder nested(List<FooBar> nested) { Internal.checkElementsNotNull(nested); this.nested = nested; return this; } public Builder ext(FooBarBazEnum ext) { this.ext = ext; return this; } public Builder rep(List<FooBarBazEnum> rep) { Internal.checkElementsNotNull(rep); this.rep = rep; return this; } public Builder more_string(String more_string) { this.more_string = more_string; return this; } @Override public FooBar build() { return new FooBar(foo, bar, baz, qux, fred, daisy, nested, ext, rep, more_string, super.buildUnknownFields()); } } public static final class Nested extends Message<Nested, Nested.Builder> { public static final ProtoAdapter<Nested> ADAPTER = new ProtoAdapter_Nested(); private static final long serialVersionUID = 0L; public static final FooBarBazEnum DEFAULT_VALUE = FooBarBazEnum.FOO; @WireField( tag = 1, adapter = "com.squareup.wire.protos.custom_options.FooBar$FooBarBazEnum#ADAPTER" ) public final FooBarBazEnum value; public Nested(FooBarBazEnum value) { this(value, ByteString.EMPTY); } public Nested(FooBarBazEnum value, ByteString unknownFields) { super(ADAPTER, unknownFields); this.value = value; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.value = value; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Nested)) return false; Nested o = (Nested) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(value, o.value); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (value != null ? value.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (value != null) builder.append(", value=").append(value); return builder.replace(0, 2, "Nested{").append('}').toString(); } public static final class Builder extends Message.Builder<Nested, Builder> { public FooBarBazEnum value; public Builder() { } public Builder value(FooBarBazEnum value) { this.value = value; return this; } @Override public Nested build() { return new Nested(value, super.buildUnknownFields()); } } private static final class ProtoAdapter_Nested extends ProtoAdapter<Nested> { public ProtoAdapter_Nested() { super(FieldEncoding.LENGTH_DELIMITED, Nested.class, "type.googleapis.com/squareup.protos.custom_options.FooBar.Nested", Syntax.PROTO_2, null, "custom_options.proto"); } @Override public int encodedSize(Nested value) { int result = 0; result += FooBarBazEnum.ADAPTER.encodedSizeWithTag(1, value.value); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Nested value) throws IOException { FooBarBazEnum.ADAPTER.encodeWithTag(writer, 1, value.value); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Nested value) throws IOException { writer.writeBytes(value.unknownFields()); FooBarBazEnum.ADAPTER.encodeWithTag(writer, 1, value.value); } @Override public Nested decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: { try { builder.value(FooBarBazEnum.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 Nested redact(Nested value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } public static final class More extends Message<More, More.Builder> { public static final ProtoAdapter<More> ADAPTER = new ProtoAdapter_More(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> serial; public More(List<Integer> serial) { this(serial, ByteString.EMPTY); } public More(List<Integer> serial, ByteString unknownFields) { super(ADAPTER, unknownFields); this.serial = Internal.immutableCopyOf("serial", serial); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.serial = Internal.copyOf(serial); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof More)) return false; More o = (More) other; return unknownFields().equals(o.unknownFields()) && serial.equals(o.serial); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + serial.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!serial.isEmpty()) builder.append(", serial=").append(serial); return builder.replace(0, 2, "More{").append('}').toString(); } public static final class Builder extends Message.Builder<More, Builder> { public List<Integer> serial; public Builder() { serial = Internal.newMutableList(); } public Builder serial(List<Integer> serial) { Internal.checkElementsNotNull(serial); this.serial = serial; return this; } @Override public More build() { return new More(serial, super.buildUnknownFields()); } } private static final class ProtoAdapter_More extends ProtoAdapter<More> { public ProtoAdapter_More() { super(FieldEncoding.LENGTH_DELIMITED, More.class, "type.googleapis.com/squareup.protos.custom_options.FooBar.More", Syntax.PROTO_2, null, "custom_options.proto"); } @Override public int encodedSize(More value) { int result = 0; result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(1, value.serial); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, More value) throws IOException { ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 1, value.serial); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, More value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 1, value.serial); } @Override public More 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.serial.add(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public More redact(More value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } public enum FooBarBazEnum implements WireEnum { FOO(1), BAR(2), BAZ(3); public static final ProtoAdapter<FooBarBazEnum> ADAPTER = new ProtoAdapter_FooBarBazEnum(); private final int value; FooBarBazEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static FooBarBazEnum fromValue(int value) { switch (value) { case 1: return FOO; case 2: return BAR; case 3: return BAZ; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_FooBarBazEnum extends EnumAdapter<FooBarBazEnum> { ProtoAdapter_FooBarBazEnum() { super(FooBarBazEnum.class, Syntax.PROTO_2, null); } @Override protected FooBarBazEnum fromValue(int value) { return FooBarBazEnum.fromValue(value); } } } private static final class ProtoAdapter_FooBar extends ProtoAdapter<FooBar> { public ProtoAdapter_FooBar() { super(FieldEncoding.LENGTH_DELIMITED, FooBar.class, "type.googleapis.com/squareup.protos.custom_options.FooBar", Syntax.PROTO_2, null, "custom_options.proto"); } @Override public int encodedSize(FooBar value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.foo); result += ProtoAdapter.STRING.encodedSizeWithTag(2, value.bar); result += Nested.ADAPTER.encodedSizeWithTag(3, value.baz); result += ProtoAdapter.UINT64.encodedSizeWithTag(4, value.qux); result += ProtoAdapter.FLOAT.asRepeated().encodedSizeWithTag(5, value.fred); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(6, value.daisy); result += FooBar.ADAPTER.asRepeated().encodedSizeWithTag(7, value.nested); result += FooBarBazEnum.ADAPTER.encodedSizeWithTag(101, value.ext); result += FooBarBazEnum.ADAPTER.asRepeated().encodedSizeWithTag(102, value.rep); result += ProtoAdapter.STRING.encodedSizeWithTag(150, value.more_string); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, FooBar value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.foo); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.bar); Nested.ADAPTER.encodeWithTag(writer, 3, value.baz); ProtoAdapter.UINT64.encodeWithTag(writer, 4, value.qux); ProtoAdapter.FLOAT.asRepeated().encodeWithTag(writer, 5, value.fred); ProtoAdapter.DOUBLE.encodeWithTag(writer, 6, value.daisy); FooBar.ADAPTER.asRepeated().encodeWithTag(writer, 7, value.nested); FooBarBazEnum.ADAPTER.encodeWithTag(writer, 101, value.ext); FooBarBazEnum.ADAPTER.asRepeated().encodeWithTag(writer, 102, value.rep); ProtoAdapter.STRING.encodeWithTag(writer, 150, value.more_string); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, FooBar value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 150, value.more_string); FooBarBazEnum.ADAPTER.asRepeated().encodeWithTag(writer, 102, value.rep); FooBarBazEnum.ADAPTER.encodeWithTag(writer, 101, value.ext); FooBar.ADAPTER.asRepeated().encodeWithTag(writer, 7, value.nested); ProtoAdapter.DOUBLE.encodeWithTag(writer, 6, value.daisy); ProtoAdapter.FLOAT.asRepeated().encodeWithTag(writer, 5, value.fred); ProtoAdapter.UINT64.encodeWithTag(writer, 4, value.qux); Nested.ADAPTER.encodeWithTag(writer, 3, value.baz); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.bar); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.foo); } @Override public FooBar 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.foo(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.bar(ProtoAdapter.STRING.decode(reader)); break; case 3: builder.baz(Nested.ADAPTER.decode(reader)); break; case 4: builder.qux(ProtoAdapter.UINT64.decode(reader)); break; case 5: builder.fred.add(ProtoAdapter.FLOAT.decode(reader)); break; case 6: builder.daisy(ProtoAdapter.DOUBLE.decode(reader)); break; case 7: builder.nested.add(FooBar.ADAPTER.decode(reader)); break; case 101: { try { builder.ext(FooBarBazEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 102: { try { builder.rep.add(FooBarBazEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 150: builder.more_string(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public FooBar redact(FooBar value) { Builder builder = value.newBuilder(); if (builder.baz != null) builder.baz = Nested.ADAPTER.redact(builder.baz); builder.nested = Collections.emptyList(); builder.clearUnknownFields(); return builder.build(); } } }
6,931
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/TheRequest.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.wire.protos.roots.TheRequest in service_root.proto package com.squareup.wire.protos.roots; 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 java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class TheRequest extends Message<TheRequest, TheRequest.Builder> { public static final ProtoAdapter<TheRequest> ADAPTER = new ProtoAdapter_TheRequest(); private static final long serialVersionUID = 0L; public TheRequest() { this(ByteString.EMPTY); } public TheRequest(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof TheRequest)) return false; TheRequest o = (TheRequest) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "TheRequest{").append('}').toString(); } public static final class Builder extends Message.Builder<TheRequest, Builder> { public Builder() { } @Override public TheRequest build() { return new TheRequest(super.buildUnknownFields()); } } private static final class ProtoAdapter_TheRequest extends ProtoAdapter<TheRequest> { public ProtoAdapter_TheRequest() { super(FieldEncoding.LENGTH_DELIMITED, TheRequest.class, "type.googleapis.com/squareup.wire.protos.roots.TheRequest", Syntax.PROTO_2, null, "service_root.proto"); } @Override public int encodedSize(TheRequest value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, TheRequest value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, TheRequest value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public TheRequest decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public TheRequest redact(TheRequest value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,932
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/B.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.B in roots.proto package com.squareup.wire.protos.roots; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class B extends Message<B, B.Builder> { public static final ProtoAdapter<B> ADAPTER = new ProtoAdapter_B(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.roots.C#ADAPTER", label = WireField.Label.REQUIRED ) public final C c; public B(C c) { this(c, ByteString.EMPTY); } public B(C c, ByteString unknownFields) { super(ADAPTER, unknownFields); this.c = c; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.c = c; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof B)) return false; B o = (B) other; return unknownFields().equals(o.unknownFields()) && c.equals(o.c); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + c.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(", c=").append(c); return builder.replace(0, 2, "B{").append('}').toString(); } public static final class Builder extends Message.Builder<B, Builder> { public C c; public Builder() { } public Builder c(C c) { this.c = c; return this; } @Override public B build() { if (c == null) { throw Internal.missingRequiredFields(c, "c"); } return new B(c, super.buildUnknownFields()); } } private static final class ProtoAdapter_B extends ProtoAdapter<B> { public ProtoAdapter_B() { super(FieldEncoding.LENGTH_DELIMITED, B.class, "type.googleapis.com/squareup.protos.roots.B", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(B value) { int result = 0; result += C.ADAPTER.encodedSizeWithTag(1, value.c); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, B value) throws IOException { C.ADAPTER.encodeWithTag(writer, 1, value.c); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, B value) throws IOException { writer.writeBytes(value.unknownFields()); C.ADAPTER.encodeWithTag(writer, 1, value.c); } @Override public B 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.c(C.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public B redact(B value) { Builder builder = value.newBuilder(); builder.c = C.ADAPTER.redact(builder.c); builder.clearUnknownFields(); return builder.build(); } } }
6,933
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/C.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.C in roots.proto package com.squareup.wire.protos.roots; 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 okio.ByteString; public final class C extends Message<C, C.Builder> { public static final ProtoAdapter<C> ADAPTER = new ProtoAdapter_C(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public C(Integer i) { this(i, ByteString.EMPTY); } public C(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof C)) return false; C o = (C) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "C{").append('}').toString(); } public static final class Builder extends Message.Builder<C, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public C build() { return new C(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_C extends ProtoAdapter<C> { public ProtoAdapter_C() { super(FieldEncoding.LENGTH_DELIMITED, C.class, "type.googleapis.com/squareup.protos.roots.C", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(C value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, C value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, C value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public C 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public C redact(C value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,934
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/H.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.H in roots.proto package com.squareup.wire.protos.roots; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class H extends Message<H, H.Builder> { public static final ProtoAdapter<H> ADAPTER = new ProtoAdapter_H(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.roots.E$F#ADAPTER" ) public final E.F ef; public H(E.F ef) { this(ef, ByteString.EMPTY); } public H(E.F ef, ByteString unknownFields) { super(ADAPTER, unknownFields); this.ef = ef; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.ef = ef; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof H)) return false; H o = (H) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(ef, o.ef); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (ef != null ? ef.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (ef != null) builder.append(", ef=").append(ef); return builder.replace(0, 2, "H{").append('}').toString(); } public static final class Builder extends Message.Builder<H, Builder> { public E.F ef; public Builder() { } public Builder ef(E.F ef) { this.ef = ef; return this; } @Override public H build() { return new H(ef, super.buildUnknownFields()); } } private static final class ProtoAdapter_H extends ProtoAdapter<H> { public ProtoAdapter_H() { super(FieldEncoding.LENGTH_DELIMITED, H.class, "type.googleapis.com/squareup.protos.roots.H", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(H value) { int result = 0; result += E.F.ADAPTER.encodedSizeWithTag(1, value.ef); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, H value) throws IOException { E.F.ADAPTER.encodeWithTag(writer, 1, value.ef); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, H value) throws IOException { writer.writeBytes(value.unknownFields()); E.F.ADAPTER.encodeWithTag(writer, 1, value.ef); } @Override public H 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.ef(E.F.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public H redact(H value) { Builder builder = value.newBuilder(); if (builder.ef != null) builder.ef = E.F.ADAPTER.redact(builder.ef); builder.clearUnknownFields(); return builder.build(); } } }
6,935
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/D.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.D in roots.proto package com.squareup.wire.protos.roots; 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 okio.ByteString; public final class D extends Message<D, D.Builder> { public static final ProtoAdapter<D> ADAPTER = new ProtoAdapter_D(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public D(Integer i) { this(i, ByteString.EMPTY); } public D(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof D)) return false; D o = (D) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "D{").append('}').toString(); } public static final class Builder extends Message.Builder<D, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public D build() { return new D(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_D extends ProtoAdapter<D> { public ProtoAdapter_D() { super(FieldEncoding.LENGTH_DELIMITED, D.class, "type.googleapis.com/squareup.protos.roots.D", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(D value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, D value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, D value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public D 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public D redact(D value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,936
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/E.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.E in roots.proto package com.squareup.wire.protos.roots; 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 okio.ByteString; public final class E extends Message<E, E.Builder> { public static final ProtoAdapter<E> ADAPTER = new ProtoAdapter_E(); private static final long serialVersionUID = 0L; public static final G DEFAULT_G = G.FOO; @WireField( tag = 1, adapter = "com.squareup.wire.protos.roots.E$F#ADAPTER" ) public final F f; @WireField( tag = 2, adapter = "com.squareup.wire.protos.roots.G#ADAPTER" ) public final G g; public E(F f, G g) { this(f, g, ByteString.EMPTY); } public E(F f, G g, ByteString unknownFields) { super(ADAPTER, unknownFields); this.f = f; this.g = g; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.f = f; builder.g = g; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof E)) return false; E o = (E) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(f, o.f) && Internal.equals(g, o.g); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (f != null ? f.hashCode() : 0); result = result * 37 + (g != null ? g.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (f != null) builder.append(", f=").append(f); if (g != null) builder.append(", g=").append(g); return builder.replace(0, 2, "E{").append('}').toString(); } public static final class Builder extends Message.Builder<E, Builder> { public F f; public G g; public Builder() { } public Builder f(F f) { this.f = f; return this; } public Builder g(G g) { this.g = g; return this; } @Override public E build() { return new E(f, g, super.buildUnknownFields()); } } public static final class F extends Message<F, F.Builder> { public static final ProtoAdapter<F> ADAPTER = new ProtoAdapter_F(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public F(Integer i) { this(i, ByteString.EMPTY); } public F(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof F)) return false; F o = (F) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "F{").append('}').toString(); } public static final class Builder extends Message.Builder<F, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public F build() { return new F(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_F extends ProtoAdapter<F> { public ProtoAdapter_F() { super(FieldEncoding.LENGTH_DELIMITED, F.class, "type.googleapis.com/squareup.protos.roots.E.F", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(F value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, F value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, F value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public F 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public F redact(F value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_E extends ProtoAdapter<E> { public ProtoAdapter_E() { super(FieldEncoding.LENGTH_DELIMITED, E.class, "type.googleapis.com/squareup.protos.roots.E", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(E value) { int result = 0; result += F.ADAPTER.encodedSizeWithTag(1, value.f); result += G.ADAPTER.encodedSizeWithTag(2, value.g); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, E value) throws IOException { F.ADAPTER.encodeWithTag(writer, 1, value.f); G.ADAPTER.encodeWithTag(writer, 2, value.g); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, E value) throws IOException { writer.writeBytes(value.unknownFields()); G.ADAPTER.encodeWithTag(writer, 2, value.g); F.ADAPTER.encodeWithTag(writer, 1, value.f); } @Override public E 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.f(F.ADAPTER.decode(reader)); break; case 2: { try { builder.g(G.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 E redact(E value) { Builder builder = value.newBuilder(); if (builder.f != null) builder.f = F.ADAPTER.redact(builder.f); builder.clearUnknownFields(); return builder.build(); } } }
6,937
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/I.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.I in roots.proto package com.squareup.wire.protos.roots; 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 okio.ByteString; public final class I extends Message<I, I.Builder> { public static final ProtoAdapter<I> ADAPTER = new ProtoAdapter_I(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; /** * Extension source: roots.proto */ @WireField( tag = 1000, adapter = "com.squareup.wire.protos.roots.J#ADAPTER" ) public final J j; public I(Integer i, J j) { this(i, j, ByteString.EMPTY); } public I(Integer i, J j, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; this.j = j; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.j = j; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof I)) return false; I o = (I) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i) && Internal.equals(j, o.j); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); result = result * 37 + (j != null ? j.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); if (j != null) builder.append(", j=").append(j); return builder.replace(0, 2, "I{").append('}').toString(); } public static final class Builder extends Message.Builder<I, Builder> { public Integer i; public J j; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } public Builder j(J j) { this.j = j; return this; } @Override public I build() { return new I(i, j, super.buildUnknownFields()); } } private static final class ProtoAdapter_I extends ProtoAdapter<I> { public ProtoAdapter_I() { super(FieldEncoding.LENGTH_DELIMITED, I.class, "type.googleapis.com/squareup.protos.roots.I", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(I value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += J.ADAPTER.encodedSizeWithTag(1000, value.j); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, I value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); J.ADAPTER.encodeWithTag(writer, 1000, value.j); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, I value) throws IOException { writer.writeBytes(value.unknownFields()); J.ADAPTER.encodeWithTag(writer, 1000, value.j); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public I 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.i(ProtoAdapter.INT32.decode(reader)); break; case 1000: builder.j(J.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public I redact(I value) { Builder builder = value.newBuilder(); if (builder.j != null) builder.j = J.ADAPTER.redact(builder.j); builder.clearUnknownFields(); return builder.build(); } } }
6,938
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/TheResponse.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.wire.protos.roots.TheResponse in service_root.proto package com.squareup.wire.protos.roots; 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 java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class TheResponse extends Message<TheResponse, TheResponse.Builder> { public static final ProtoAdapter<TheResponse> ADAPTER = new ProtoAdapter_TheResponse(); private static final long serialVersionUID = 0L; public TheResponse() { this(ByteString.EMPTY); } public TheResponse(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof TheResponse)) return false; TheResponse o = (TheResponse) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "TheResponse{").append('}').toString(); } public static final class Builder extends Message.Builder<TheResponse, Builder> { public Builder() { } @Override public TheResponse build() { return new TheResponse(super.buildUnknownFields()); } } private static final class ProtoAdapter_TheResponse extends ProtoAdapter<TheResponse> { public ProtoAdapter_TheResponse() { super(FieldEncoding.LENGTH_DELIMITED, TheResponse.class, "type.googleapis.com/squareup.wire.protos.roots.TheResponse", Syntax.PROTO_2, null, "service_root.proto"); } @Override public int encodedSize(TheResponse value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, TheResponse value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, TheResponse value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public TheResponse decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public TheResponse redact(TheResponse value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,939
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/J.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.J in roots.proto package com.squareup.wire.protos.roots; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class J extends Message<J, J.Builder> { public static final ProtoAdapter<J> ADAPTER = new ProtoAdapter_J(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.roots.K#ADAPTER" ) public final K k; public J(K k) { this(k, ByteString.EMPTY); } public J(K k, ByteString unknownFields) { super(ADAPTER, unknownFields); this.k = k; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.k = k; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof J)) return false; J o = (J) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(k, o.k); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (k != null ? k.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (k != null) builder.append(", k=").append(k); return builder.replace(0, 2, "J{").append('}').toString(); } public static final class Builder extends Message.Builder<J, Builder> { public K k; public Builder() { } public Builder k(K k) { this.k = k; return this; } @Override public J build() { return new J(k, super.buildUnknownFields()); } } private static final class ProtoAdapter_J extends ProtoAdapter<J> { public ProtoAdapter_J() { super(FieldEncoding.LENGTH_DELIMITED, J.class, "type.googleapis.com/squareup.protos.roots.J", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(J value) { int result = 0; result += K.ADAPTER.encodedSizeWithTag(1, value.k); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, J value) throws IOException { K.ADAPTER.encodeWithTag(writer, 1, value.k); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, J value) throws IOException { writer.writeBytes(value.unknownFields()); K.ADAPTER.encodeWithTag(writer, 1, value.k); } @Override public J 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.k(K.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public J redact(J value) { Builder builder = value.newBuilder(); if (builder.k != null) builder.k = K.ADAPTER.redact(builder.k); builder.clearUnknownFields(); return builder.build(); } } }
6,940
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/G.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.G in roots.proto package com.squareup.wire.protos.roots; 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 G implements WireEnum { FOO(1), BAR(2); public static final ProtoAdapter<G> ADAPTER = new ProtoAdapter_G(); private final int value; G(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static G fromValue(int value) { switch (value) { case 1: return FOO; case 2: return BAR; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_G extends EnumAdapter<G> { ProtoAdapter_G() { super(G.class, Syntax.PROTO_2, null); } @Override protected G fromValue(int value) { return G.fromValue(value); } } }
6,941
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/K.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.K in roots.proto package com.squareup.wire.protos.roots; 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 okio.ByteString; public final class K extends Message<K, K.Builder> { public static final ProtoAdapter<K> ADAPTER = new ProtoAdapter_K(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public K(Integer i) { this(i, ByteString.EMPTY); } public K(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof K)) return false; K o = (K) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "K{").append('}').toString(); } public static final class Builder extends Message.Builder<K, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public K build() { return new K(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_K extends ProtoAdapter<K> { public ProtoAdapter_K() { super(FieldEncoding.LENGTH_DELIMITED, K.class, "type.googleapis.com/squareup.protos.roots.K", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(K value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, K value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, K value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public K 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public K redact(K value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,942
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/UnnecessaryResponse.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.wire.protos.roots.UnnecessaryResponse in service_root.proto package com.squareup.wire.protos.roots; 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 java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class UnnecessaryResponse extends Message<UnnecessaryResponse, UnnecessaryResponse.Builder> { public static final ProtoAdapter<UnnecessaryResponse> ADAPTER = new ProtoAdapter_UnnecessaryResponse(); private static final long serialVersionUID = 0L; public UnnecessaryResponse() { this(ByteString.EMPTY); } public UnnecessaryResponse(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof UnnecessaryResponse)) return false; UnnecessaryResponse o = (UnnecessaryResponse) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "UnnecessaryResponse{").append('}').toString(); } public static final class Builder extends Message.Builder<UnnecessaryResponse, Builder> { public Builder() { } @Override public UnnecessaryResponse build() { return new UnnecessaryResponse(super.buildUnknownFields()); } } private static final class ProtoAdapter_UnnecessaryResponse extends ProtoAdapter<UnnecessaryResponse> { public ProtoAdapter_UnnecessaryResponse() { super(FieldEncoding.LENGTH_DELIMITED, UnnecessaryResponse.class, "type.googleapis.com/squareup.wire.protos.roots.UnnecessaryResponse", Syntax.PROTO_2, null, "service_root.proto"); } @Override public int encodedSize(UnnecessaryResponse value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, UnnecessaryResponse value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, UnnecessaryResponse value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public UnnecessaryResponse decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public UnnecessaryResponse redact(UnnecessaryResponse value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,943
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/roots/A.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.roots.A in roots.proto package com.squareup.wire.protos.roots; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; /** * Used to test --includes flag of WireCompiler * * A -> B -> C * \ * -> D * * E -> E.F * \ * -> G * * H -> E.F * * I -> nothing */ public final class A extends Message<A, A.Builder> { public static final ProtoAdapter<A> ADAPTER = new ProtoAdapter_A(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.roots.B#ADAPTER" ) public final B c; @WireField( tag = 2, adapter = "com.squareup.wire.protos.roots.D#ADAPTER" ) public final D d; public A(B c, D d) { this(c, d, ByteString.EMPTY); } public A(B c, D d, ByteString unknownFields) { super(ADAPTER, unknownFields); this.c = c; this.d = d; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.c = c; builder.d = d; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof A)) return false; A o = (A) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(c, o.c) && Internal.equals(d, o.d); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (c != null ? c.hashCode() : 0); result = result * 37 + (d != null ? d.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (c != null) builder.append(", c=").append(c); if (d != null) builder.append(", d=").append(d); return builder.replace(0, 2, "A{").append('}').toString(); } public static final class Builder extends Message.Builder<A, Builder> { public B c; public D d; public Builder() { } public Builder c(B c) { this.c = c; return this; } public Builder d(D d) { this.d = d; return this; } @Override public A build() { return new A(c, d, super.buildUnknownFields()); } } private static final class ProtoAdapter_A extends ProtoAdapter<A> { public ProtoAdapter_A() { super(FieldEncoding.LENGTH_DELIMITED, A.class, "type.googleapis.com/squareup.protos.roots.A", Syntax.PROTO_2, null, "roots.proto"); } @Override public int encodedSize(A value) { int result = 0; result += B.ADAPTER.encodedSizeWithTag(1, value.c); result += D.ADAPTER.encodedSizeWithTag(2, value.d); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, A value) throws IOException { B.ADAPTER.encodeWithTag(writer, 1, value.c); D.ADAPTER.encodeWithTag(writer, 2, value.d); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, A value) throws IOException { writer.writeBytes(value.unknownFields()); D.ADAPTER.encodeWithTag(writer, 2, value.d); B.ADAPTER.encodeWithTag(writer, 1, value.c); } @Override public A 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.c(B.ADAPTER.decode(reader)); break; case 2: builder.d(D.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public A redact(A value) { Builder builder = value.newBuilder(); if (builder.c != null) builder.c = B.ADAPTER.redact(builder.c); if (builder.d != null) builder.d = D.ADAPTER.redact(builder.d); builder.clearUnknownFields(); return builder.build(); } } }
6,944
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/one_extension/OneExtension.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.one_extension.OneExtension in one_extension.proto package com.squareup.wire.protos.one_extension; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class OneExtension extends Message<OneExtension, OneExtension.Builder> { public static final ProtoAdapter<OneExtension> ADAPTER = new ProtoAdapter_OneExtension(); private static final long serialVersionUID = 0L; public static final String DEFAULT_ID = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String id; /** * Extension source: one_extension.proto */ @WireField( tag = 1000, adapter = "com.squareup.wire.protos.one_extension.Foo#ADAPTER" ) public final Foo foo; public OneExtension(String id, Foo foo) { this(id, foo, ByteString.EMPTY); } public OneExtension(String id, Foo foo, ByteString unknownFields) { super(ADAPTER, unknownFields); this.id = id; this.foo = foo; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.id = id; builder.foo = foo; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof OneExtension)) return false; OneExtension o = (OneExtension) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(id, o.id) && Internal.equals(foo, o.foo); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (id != null ? id.hashCode() : 0); result = result * 37 + (foo != null ? foo.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (id != null) builder.append(", id=").append(Internal.sanitize(id)); if (foo != null) builder.append(", foo=").append(foo); return builder.replace(0, 2, "OneExtension{").append('}').toString(); } public static final class Builder extends Message.Builder<OneExtension, Builder> { public String id; public Foo foo; public Builder() { } public Builder id(String id) { this.id = id; return this; } public Builder foo(Foo foo) { this.foo = foo; return this; } @Override public OneExtension build() { return new OneExtension(id, foo, super.buildUnknownFields()); } } private static final class ProtoAdapter_OneExtension extends ProtoAdapter<OneExtension> { public ProtoAdapter_OneExtension() { super(FieldEncoding.LENGTH_DELIMITED, OneExtension.class, "type.googleapis.com/squareup.protos.one_extension.OneExtension", Syntax.PROTO_2, null, "one_extension.proto"); } @Override public int encodedSize(OneExtension value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.id); result += Foo.ADAPTER.encodedSizeWithTag(1000, value.foo); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, OneExtension value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.id); Foo.ADAPTER.encodeWithTag(writer, 1000, value.foo); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, OneExtension value) throws IOException { writer.writeBytes(value.unknownFields()); Foo.ADAPTER.encodeWithTag(writer, 1000, value.foo); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.id); } @Override public OneExtension 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.id(ProtoAdapter.STRING.decode(reader)); break; case 1000: builder.foo(Foo.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public OneExtension redact(OneExtension value) { Builder builder = value.newBuilder(); if (builder.foo != null) builder.foo = Foo.ADAPTER.redact(builder.foo); builder.clearUnknownFields(); return builder.build(); } } }
6,945
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/one_extension/Foo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.one_extension.Foo in one_extension.proto package com.squareup.wire.protos.one_extension; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Foo extends Message<Foo, Foo.Builder> { public static final ProtoAdapter<Foo> ADAPTER = new ProtoAdapter_Foo(); private static final long serialVersionUID = 0L; public static final String DEFAULT_BAR = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String bar; public Foo(String bar) { this(bar, ByteString.EMPTY); } public Foo(String bar, ByteString unknownFields) { super(ADAPTER, unknownFields); this.bar = bar; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.bar = bar; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Foo)) return false; Foo o = (Foo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(bar, o.bar); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (bar != null ? bar.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (bar != null) builder.append(", bar=").append(Internal.sanitize(bar)); return builder.replace(0, 2, "Foo{").append('}').toString(); } public static final class Builder extends Message.Builder<Foo, Builder> { public String bar; public Builder() { } public Builder bar(String bar) { this.bar = bar; return this; } @Override public Foo build() { return new Foo(bar, super.buildUnknownFields()); } } private static final class ProtoAdapter_Foo extends ProtoAdapter<Foo> { public ProtoAdapter_Foo() { super(FieldEncoding.LENGTH_DELIMITED, Foo.class, "type.googleapis.com/squareup.protos.one_extension.Foo", Syntax.PROTO_2, null, "one_extension.proto"); } @Override public int encodedSize(Foo value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.bar); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Foo value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.bar); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Foo value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.bar); } @Override public Foo 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.bar(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Foo redact(Foo value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,946
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/alltypes/AllTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.alltypes.AllTypes in all_types.proto package com.squareup.wire.protos.alltypes; 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.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.lang.StringBuilder; 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 = new ProtoAdapter_AllTypes(); 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; @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.protos.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum opt_nested_enum; @WireField( tag = 17, adapter = "com.squareup.wire.protos.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.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedEnum req_nested_enum; @WireField( tag = 117, adapter = "com.squareup.wire.protos.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.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> rep_nested_enum; @WireField( tag = 217, adapter = "com.squareup.wire.protos.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.protos.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; /** * Note: protoc doesn't allow some characters of the default value. */ @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.protos.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.protos.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.protos.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final Map<String, NestedEnum> map_string_enum; /** * Extension source: all_types.proto */ @WireField( tag = 1001, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer ext_opt_int32; /** * Extension source: all_types.proto */ @WireField( tag = 1002, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer ext_opt_uint32; /** * Extension source: all_types.proto */ @WireField( tag = 1003, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer ext_opt_sint32; /** * Extension source: all_types.proto */ @WireField( tag = 1004, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer ext_opt_fixed32; /** * Extension source: all_types.proto */ @WireField( tag = 1005, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer ext_opt_sfixed32; /** * Extension source: all_types.proto */ @WireField( tag = 1006, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long ext_opt_int64; /** * Extension source: all_types.proto */ @WireField( tag = 1007, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long ext_opt_uint64; /** * Extension source: all_types.proto */ @WireField( tag = 1008, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long ext_opt_sint64; /** * Extension source: all_types.proto */ @WireField( tag = 1009, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long ext_opt_fixed64; /** * Extension source: all_types.proto */ @WireField( tag = 1010, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long ext_opt_sfixed64; /** * Extension source: all_types.proto */ @WireField( tag = 1011, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean ext_opt_bool; /** * Extension source: all_types.proto */ @WireField( tag = 1012, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float ext_opt_float; /** * Extension source: all_types.proto */ @WireField( tag = 1013, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double ext_opt_double; /** * Extension source: all_types.proto */ @WireField( tag = 1014, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String ext_opt_string; /** * Extension source: all_types.proto */ @WireField( tag = 1015, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString ext_opt_bytes; /** * Extension source: all_types.proto */ @WireField( tag = 1016, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum ext_opt_nested_enum; /** * Extension source: all_types.proto */ @WireField( tag = 1017, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage ext_opt_nested_message; /** * Extension source: all_types.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.proto */ @WireField( tag = 1116, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> ext_rep_nested_enum; /** * Extension source: all_types.proto */ @WireField( tag = 1117, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> ext_rep_nested_message; /** * Extension source: all_types.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.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.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.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.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.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.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.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.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.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.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.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.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.proto */ @WireField( tag = 1216, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> ext_pack_nested_enum; public AllTypes(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); 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); } @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.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); } @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(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (opt_int32 != null) builder.append(", opt_int32=").append(opt_int32); if (opt_uint32 != null) builder.append(", opt_uint32=").append(opt_uint32); if (opt_sint32 != null) builder.append(", opt_sint32=").append(opt_sint32); if (opt_fixed32 != null) builder.append(", opt_fixed32=").append(opt_fixed32); if (opt_sfixed32 != null) builder.append(", opt_sfixed32=").append(opt_sfixed32); if (opt_int64 != null) builder.append(", opt_int64=").append(opt_int64); if (opt_uint64 != null) builder.append(", opt_uint64=").append(opt_uint64); if (opt_sint64 != null) builder.append(", opt_sint64=").append(opt_sint64); if (opt_fixed64 != null) builder.append(", opt_fixed64=").append(opt_fixed64); if (opt_sfixed64 != null) builder.append(", opt_sfixed64=").append(opt_sfixed64); if (opt_bool != null) builder.append(", opt_bool=").append(opt_bool); if (opt_float != null) builder.append(", opt_float=").append(opt_float); if (opt_double != null) builder.append(", opt_double=").append(opt_double); if (opt_string != null) builder.append(", opt_string=").append(Internal.sanitize(opt_string)); if (opt_bytes != null) builder.append(", opt_bytes=").append(opt_bytes); if (opt_nested_enum != null) builder.append(", opt_nested_enum=").append(opt_nested_enum); if (opt_nested_message != null) builder.append(", opt_nested_message=").append(opt_nested_message); builder.append(", req_int32=").append(req_int32); builder.append(", req_uint32=").append(req_uint32); builder.append(", req_sint32=").append(req_sint32); builder.append(", req_fixed32=").append(req_fixed32); builder.append(", req_sfixed32=").append(req_sfixed32); builder.append(", req_int64=").append(req_int64); builder.append(", req_uint64=").append(req_uint64); builder.append(", req_sint64=").append(req_sint64); builder.append(", req_fixed64=").append(req_fixed64); builder.append(", req_sfixed64=").append(req_sfixed64); builder.append(", req_bool=").append(req_bool); builder.append(", req_float=").append(req_float); builder.append(", req_double=").append(req_double); builder.append(", req_string=").append(Internal.sanitize(req_string)); builder.append(", req_bytes=").append(req_bytes); builder.append(", req_nested_enum=").append(req_nested_enum); builder.append(", req_nested_message=").append(req_nested_message); if (!rep_int32.isEmpty()) builder.append(", rep_int32=").append(rep_int32); if (!rep_uint32.isEmpty()) builder.append(", rep_uint32=").append(rep_uint32); if (!rep_sint32.isEmpty()) builder.append(", rep_sint32=").append(rep_sint32); if (!rep_fixed32.isEmpty()) builder.append(", rep_fixed32=").append(rep_fixed32); if (!rep_sfixed32.isEmpty()) builder.append(", rep_sfixed32=").append(rep_sfixed32); if (!rep_int64.isEmpty()) builder.append(", rep_int64=").append(rep_int64); if (!rep_uint64.isEmpty()) builder.append(", rep_uint64=").append(rep_uint64); if (!rep_sint64.isEmpty()) builder.append(", rep_sint64=").append(rep_sint64); if (!rep_fixed64.isEmpty()) builder.append(", rep_fixed64=").append(rep_fixed64); if (!rep_sfixed64.isEmpty()) builder.append(", rep_sfixed64=").append(rep_sfixed64); if (!rep_bool.isEmpty()) builder.append(", rep_bool=").append(rep_bool); if (!rep_float.isEmpty()) builder.append(", rep_float=").append(rep_float); if (!rep_double.isEmpty()) builder.append(", rep_double=").append(rep_double); if (!rep_string.isEmpty()) builder.append(", rep_string=").append(Internal.sanitize(rep_string)); if (!rep_bytes.isEmpty()) builder.append(", rep_bytes=").append(rep_bytes); if (!rep_nested_enum.isEmpty()) builder.append(", rep_nested_enum=").append(rep_nested_enum); if (!rep_nested_message.isEmpty()) builder.append(", rep_nested_message=").append(rep_nested_message); if (!pack_int32.isEmpty()) builder.append(", pack_int32=").append(pack_int32); if (!pack_uint32.isEmpty()) builder.append(", pack_uint32=").append(pack_uint32); if (!pack_sint32.isEmpty()) builder.append(", pack_sint32=").append(pack_sint32); if (!pack_fixed32.isEmpty()) builder.append(", pack_fixed32=").append(pack_fixed32); if (!pack_sfixed32.isEmpty()) builder.append(", pack_sfixed32=").append(pack_sfixed32); if (!pack_int64.isEmpty()) builder.append(", pack_int64=").append(pack_int64); if (!pack_uint64.isEmpty()) builder.append(", pack_uint64=").append(pack_uint64); if (!pack_sint64.isEmpty()) builder.append(", pack_sint64=").append(pack_sint64); if (!pack_fixed64.isEmpty()) builder.append(", pack_fixed64=").append(pack_fixed64); if (!pack_sfixed64.isEmpty()) builder.append(", pack_sfixed64=").append(pack_sfixed64); if (!pack_bool.isEmpty()) builder.append(", pack_bool=").append(pack_bool); if (!pack_float.isEmpty()) builder.append(", pack_float=").append(pack_float); if (!pack_double.isEmpty()) builder.append(", pack_double=").append(pack_double); if (!pack_nested_enum.isEmpty()) builder.append(", pack_nested_enum=").append(pack_nested_enum); if (default_int32 != null) builder.append(", default_int32=").append(default_int32); if (default_uint32 != null) builder.append(", default_uint32=").append(default_uint32); if (default_sint32 != null) builder.append(", default_sint32=").append(default_sint32); if (default_fixed32 != null) builder.append(", default_fixed32=").append(default_fixed32); if (default_sfixed32 != null) builder.append(", default_sfixed32=").append(default_sfixed32); if (default_int64 != null) builder.append(", default_int64=").append(default_int64); if (default_uint64 != null) builder.append(", default_uint64=").append(default_uint64); if (default_sint64 != null) builder.append(", default_sint64=").append(default_sint64); if (default_fixed64 != null) builder.append(", default_fixed64=").append(default_fixed64); if (default_sfixed64 != null) builder.append(", default_sfixed64=").append(default_sfixed64); if (default_bool != null) builder.append(", default_bool=").append(default_bool); if (default_float != null) builder.append(", default_float=").append(default_float); if (default_double != null) builder.append(", default_double=").append(default_double); if (default_string != null) builder.append(", default_string=").append(Internal.sanitize(default_string)); if (default_bytes != null) builder.append(", default_bytes=").append(default_bytes); if (default_nested_enum != null) builder.append(", default_nested_enum=").append(default_nested_enum); if (!map_int32_int32.isEmpty()) builder.append(", map_int32_int32=").append(map_int32_int32); if (!map_string_string.isEmpty()) builder.append(", map_string_string=").append(map_string_string); if (!map_string_message.isEmpty()) builder.append(", map_string_message=").append(map_string_message); if (!map_string_enum.isEmpty()) builder.append(", map_string_enum=").append(map_string_enum); if (ext_opt_int32 != null) builder.append(", ext_opt_int32=").append(ext_opt_int32); if (ext_opt_uint32 != null) builder.append(", ext_opt_uint32=").append(ext_opt_uint32); if (ext_opt_sint32 != null) builder.append(", ext_opt_sint32=").append(ext_opt_sint32); if (ext_opt_fixed32 != null) builder.append(", ext_opt_fixed32=").append(ext_opt_fixed32); if (ext_opt_sfixed32 != null) builder.append(", ext_opt_sfixed32=").append(ext_opt_sfixed32); if (ext_opt_int64 != null) builder.append(", ext_opt_int64=").append(ext_opt_int64); if (ext_opt_uint64 != null) builder.append(", ext_opt_uint64=").append(ext_opt_uint64); if (ext_opt_sint64 != null) builder.append(", ext_opt_sint64=").append(ext_opt_sint64); if (ext_opt_fixed64 != null) builder.append(", ext_opt_fixed64=").append(ext_opt_fixed64); if (ext_opt_sfixed64 != null) builder.append(", ext_opt_sfixed64=").append(ext_opt_sfixed64); if (ext_opt_bool != null) builder.append(", ext_opt_bool=").append(ext_opt_bool); if (ext_opt_float != null) builder.append(", ext_opt_float=").append(ext_opt_float); if (ext_opt_double != null) builder.append(", ext_opt_double=").append(ext_opt_double); if (ext_opt_string != null) builder.append(", ext_opt_string=").append(Internal.sanitize(ext_opt_string)); if (ext_opt_bytes != null) builder.append(", ext_opt_bytes=").append(ext_opt_bytes); if (ext_opt_nested_enum != null) builder.append(", ext_opt_nested_enum=").append(ext_opt_nested_enum); if (ext_opt_nested_message != null) builder.append(", ext_opt_nested_message=").append(ext_opt_nested_message); if (!ext_rep_int32.isEmpty()) builder.append(", ext_rep_int32=").append(ext_rep_int32); if (!ext_rep_uint32.isEmpty()) builder.append(", ext_rep_uint32=").append(ext_rep_uint32); if (!ext_rep_sint32.isEmpty()) builder.append(", ext_rep_sint32=").append(ext_rep_sint32); if (!ext_rep_fixed32.isEmpty()) builder.append(", ext_rep_fixed32=").append(ext_rep_fixed32); if (!ext_rep_sfixed32.isEmpty()) builder.append(", ext_rep_sfixed32=").append(ext_rep_sfixed32); if (!ext_rep_int64.isEmpty()) builder.append(", ext_rep_int64=").append(ext_rep_int64); if (!ext_rep_uint64.isEmpty()) builder.append(", ext_rep_uint64=").append(ext_rep_uint64); if (!ext_rep_sint64.isEmpty()) builder.append(", ext_rep_sint64=").append(ext_rep_sint64); if (!ext_rep_fixed64.isEmpty()) builder.append(", ext_rep_fixed64=").append(ext_rep_fixed64); if (!ext_rep_sfixed64.isEmpty()) builder.append(", ext_rep_sfixed64=").append(ext_rep_sfixed64); if (!ext_rep_bool.isEmpty()) builder.append(", ext_rep_bool=").append(ext_rep_bool); if (!ext_rep_float.isEmpty()) builder.append(", ext_rep_float=").append(ext_rep_float); if (!ext_rep_double.isEmpty()) builder.append(", ext_rep_double=").append(ext_rep_double); if (!ext_rep_string.isEmpty()) builder.append(", ext_rep_string=").append(Internal.sanitize(ext_rep_string)); if (!ext_rep_bytes.isEmpty()) builder.append(", ext_rep_bytes=").append(ext_rep_bytes); if (!ext_rep_nested_enum.isEmpty()) builder.append(", ext_rep_nested_enum=").append(ext_rep_nested_enum); if (!ext_rep_nested_message.isEmpty()) builder.append(", ext_rep_nested_message=").append(ext_rep_nested_message); if (!ext_pack_int32.isEmpty()) builder.append(", ext_pack_int32=").append(ext_pack_int32); if (!ext_pack_uint32.isEmpty()) builder.append(", ext_pack_uint32=").append(ext_pack_uint32); if (!ext_pack_sint32.isEmpty()) builder.append(", ext_pack_sint32=").append(ext_pack_sint32); if (!ext_pack_fixed32.isEmpty()) builder.append(", ext_pack_fixed32=").append(ext_pack_fixed32); if (!ext_pack_sfixed32.isEmpty()) builder.append(", ext_pack_sfixed32=").append(ext_pack_sfixed32); if (!ext_pack_int64.isEmpty()) builder.append(", ext_pack_int64=").append(ext_pack_int64); if (!ext_pack_uint64.isEmpty()) builder.append(", ext_pack_uint64=").append(ext_pack_uint64); if (!ext_pack_sint64.isEmpty()) builder.append(", ext_pack_sint64=").append(ext_pack_sint64); if (!ext_pack_fixed64.isEmpty()) builder.append(", ext_pack_fixed64=").append(ext_pack_fixed64); if (!ext_pack_sfixed64.isEmpty()) builder.append(", ext_pack_sfixed64=").append(ext_pack_sfixed64); if (!ext_pack_bool.isEmpty()) builder.append(", ext_pack_bool=").append(ext_pack_bool); if (!ext_pack_float.isEmpty()) builder.append(", ext_pack_float=").append(ext_pack_float); if (!ext_pack_double.isEmpty()) builder.append(", ext_pack_double=").append(ext_pack_double); if (!ext_pack_nested_enum.isEmpty()) builder.append(", ext_pack_nested_enum=").append(ext_pack_nested_enum); return builder.replace(0, 2, "AllTypes{").append('}').toString(); } 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 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; } /** * Note: protoc doesn't allow some characters of the default value. */ 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; } @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 = new ProtoAdapter_NestedEnum(); 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; } private static final class ProtoAdapter_NestedEnum extends EnumAdapter<NestedEnum> { ProtoAdapter_NestedEnum() { super(NestedEnum.class, Syntax.PROTO_2, NestedEnum.UNKNOWN); } @Override protected NestedEnum fromValue(int value) { return NestedEnum.fromValue(value); } } } public static final class NestedMessage extends Message<NestedMessage, NestedMessage.Builder> { public static final ProtoAdapter<NestedMessage> ADAPTER = new ProtoAdapter_NestedMessage(); 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; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (a != null) builder.append(", a=").append(a); return builder.replace(0, 2, "NestedMessage{").append('}').toString(); } 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()); } } private static final class ProtoAdapter_NestedMessage extends ProtoAdapter<NestedMessage> { public ProtoAdapter_NestedMessage() { super(FieldEncoding.LENGTH_DELIMITED, NestedMessage.class, "type.googleapis.com/squareup.protos.alltypes.AllTypes.NestedMessage", Syntax.PROTO_2, null, "all_types.proto"); } @Override public int encodedSize(NestedMessage value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.a); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, NestedMessage value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.a); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, NestedMessage value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.a); } @Override public NestedMessage 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.a(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public NestedMessage redact(NestedMessage value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_AllTypes extends ProtoAdapter<AllTypes> { private ProtoAdapter<Map<Integer, Integer>> map_int32_int32; private ProtoAdapter<Map<String, String>> map_string_string; private ProtoAdapter<Map<String, NestedMessage>> map_string_message; private ProtoAdapter<Map<String, NestedEnum>> map_string_enum; public ProtoAdapter_AllTypes() { super(FieldEncoding.LENGTH_DELIMITED, AllTypes.class, "type.googleapis.com/squareup.protos.alltypes.AllTypes", Syntax.PROTO_2, null, "all_types.proto"); } @Override public int encodedSize(AllTypes value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.opt_int32); result += ProtoAdapter.UINT32.encodedSizeWithTag(2, value.opt_uint32); result += ProtoAdapter.SINT32.encodedSizeWithTag(3, value.opt_sint32); result += ProtoAdapter.FIXED32.encodedSizeWithTag(4, value.opt_fixed32); result += ProtoAdapter.SFIXED32.encodedSizeWithTag(5, value.opt_sfixed32); result += ProtoAdapter.INT64.encodedSizeWithTag(6, value.opt_int64); result += ProtoAdapter.UINT64.encodedSizeWithTag(7, value.opt_uint64); result += ProtoAdapter.SINT64.encodedSizeWithTag(8, value.opt_sint64); result += ProtoAdapter.FIXED64.encodedSizeWithTag(9, value.opt_fixed64); result += ProtoAdapter.SFIXED64.encodedSizeWithTag(10, value.opt_sfixed64); result += ProtoAdapter.BOOL.encodedSizeWithTag(11, value.opt_bool); result += ProtoAdapter.FLOAT.encodedSizeWithTag(12, value.opt_float); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(13, value.opt_double); result += ProtoAdapter.STRING.encodedSizeWithTag(14, value.opt_string); result += ProtoAdapter.BYTES.encodedSizeWithTag(15, value.opt_bytes); result += NestedEnum.ADAPTER.encodedSizeWithTag(16, value.opt_nested_enum); result += NestedMessage.ADAPTER.encodedSizeWithTag(17, value.opt_nested_message); result += ProtoAdapter.INT32.encodedSizeWithTag(101, value.req_int32); result += ProtoAdapter.UINT32.encodedSizeWithTag(102, value.req_uint32); result += ProtoAdapter.SINT32.encodedSizeWithTag(103, value.req_sint32); result += ProtoAdapter.FIXED32.encodedSizeWithTag(104, value.req_fixed32); result += ProtoAdapter.SFIXED32.encodedSizeWithTag(105, value.req_sfixed32); result += ProtoAdapter.INT64.encodedSizeWithTag(106, value.req_int64); result += ProtoAdapter.UINT64.encodedSizeWithTag(107, value.req_uint64); result += ProtoAdapter.SINT64.encodedSizeWithTag(108, value.req_sint64); result += ProtoAdapter.FIXED64.encodedSizeWithTag(109, value.req_fixed64); result += ProtoAdapter.SFIXED64.encodedSizeWithTag(110, value.req_sfixed64); result += ProtoAdapter.BOOL.encodedSizeWithTag(111, value.req_bool); result += ProtoAdapter.FLOAT.encodedSizeWithTag(112, value.req_float); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(113, value.req_double); result += ProtoAdapter.STRING.encodedSizeWithTag(114, value.req_string); result += ProtoAdapter.BYTES.encodedSizeWithTag(115, value.req_bytes); result += NestedEnum.ADAPTER.encodedSizeWithTag(116, value.req_nested_enum); result += NestedMessage.ADAPTER.encodedSizeWithTag(117, value.req_nested_message); result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(201, value.rep_int32); result += ProtoAdapter.UINT32.asRepeated().encodedSizeWithTag(202, value.rep_uint32); result += ProtoAdapter.SINT32.asRepeated().encodedSizeWithTag(203, value.rep_sint32); result += ProtoAdapter.FIXED32.asRepeated().encodedSizeWithTag(204, value.rep_fixed32); result += ProtoAdapter.SFIXED32.asRepeated().encodedSizeWithTag(205, value.rep_sfixed32); result += ProtoAdapter.INT64.asRepeated().encodedSizeWithTag(206, value.rep_int64); result += ProtoAdapter.UINT64.asRepeated().encodedSizeWithTag(207, value.rep_uint64); result += ProtoAdapter.SINT64.asRepeated().encodedSizeWithTag(208, value.rep_sint64); result += ProtoAdapter.FIXED64.asRepeated().encodedSizeWithTag(209, value.rep_fixed64); result += ProtoAdapter.SFIXED64.asRepeated().encodedSizeWithTag(210, value.rep_sfixed64); result += ProtoAdapter.BOOL.asRepeated().encodedSizeWithTag(211, value.rep_bool); result += ProtoAdapter.FLOAT.asRepeated().encodedSizeWithTag(212, value.rep_float); result += ProtoAdapter.DOUBLE.asRepeated().encodedSizeWithTag(213, value.rep_double); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(214, value.rep_string); result += ProtoAdapter.BYTES.asRepeated().encodedSizeWithTag(215, value.rep_bytes); result += NestedEnum.ADAPTER.asRepeated().encodedSizeWithTag(216, value.rep_nested_enum); result += NestedMessage.ADAPTER.asRepeated().encodedSizeWithTag(217, value.rep_nested_message); result += ProtoAdapter.INT32.asPacked().encodedSizeWithTag(301, value.pack_int32); result += ProtoAdapter.UINT32.asPacked().encodedSizeWithTag(302, value.pack_uint32); result += ProtoAdapter.SINT32.asPacked().encodedSizeWithTag(303, value.pack_sint32); result += ProtoAdapter.FIXED32.asPacked().encodedSizeWithTag(304, value.pack_fixed32); result += ProtoAdapter.SFIXED32.asPacked().encodedSizeWithTag(305, value.pack_sfixed32); result += ProtoAdapter.INT64.asPacked().encodedSizeWithTag(306, value.pack_int64); result += ProtoAdapter.UINT64.asPacked().encodedSizeWithTag(307, value.pack_uint64); result += ProtoAdapter.SINT64.asPacked().encodedSizeWithTag(308, value.pack_sint64); result += ProtoAdapter.FIXED64.asPacked().encodedSizeWithTag(309, value.pack_fixed64); result += ProtoAdapter.SFIXED64.asPacked().encodedSizeWithTag(310, value.pack_sfixed64); result += ProtoAdapter.BOOL.asPacked().encodedSizeWithTag(311, value.pack_bool); result += ProtoAdapter.FLOAT.asPacked().encodedSizeWithTag(312, value.pack_float); result += ProtoAdapter.DOUBLE.asPacked().encodedSizeWithTag(313, value.pack_double); result += NestedEnum.ADAPTER.asPacked().encodedSizeWithTag(316, value.pack_nested_enum); result += ProtoAdapter.INT32.encodedSizeWithTag(401, value.default_int32); result += ProtoAdapter.UINT32.encodedSizeWithTag(402, value.default_uint32); result += ProtoAdapter.SINT32.encodedSizeWithTag(403, value.default_sint32); result += ProtoAdapter.FIXED32.encodedSizeWithTag(404, value.default_fixed32); result += ProtoAdapter.SFIXED32.encodedSizeWithTag(405, value.default_sfixed32); result += ProtoAdapter.INT64.encodedSizeWithTag(406, value.default_int64); result += ProtoAdapter.UINT64.encodedSizeWithTag(407, value.default_uint64); result += ProtoAdapter.SINT64.encodedSizeWithTag(408, value.default_sint64); result += ProtoAdapter.FIXED64.encodedSizeWithTag(409, value.default_fixed64); result += ProtoAdapter.SFIXED64.encodedSizeWithTag(410, value.default_sfixed64); result += ProtoAdapter.BOOL.encodedSizeWithTag(411, value.default_bool); result += ProtoAdapter.FLOAT.encodedSizeWithTag(412, value.default_float); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(413, value.default_double); result += ProtoAdapter.STRING.encodedSizeWithTag(414, value.default_string); result += ProtoAdapter.BYTES.encodedSizeWithTag(415, value.default_bytes); result += NestedEnum.ADAPTER.encodedSizeWithTag(416, value.default_nested_enum); result += map_int32_int32Adapter().encodedSizeWithTag(501, value.map_int32_int32); result += map_string_stringAdapter().encodedSizeWithTag(502, value.map_string_string); result += map_string_messageAdapter().encodedSizeWithTag(503, value.map_string_message); result += map_string_enumAdapter().encodedSizeWithTag(504, value.map_string_enum); result += ProtoAdapter.INT32.encodedSizeWithTag(1001, value.ext_opt_int32); result += ProtoAdapter.UINT32.encodedSizeWithTag(1002, value.ext_opt_uint32); result += ProtoAdapter.SINT32.encodedSizeWithTag(1003, value.ext_opt_sint32); result += ProtoAdapter.FIXED32.encodedSizeWithTag(1004, value.ext_opt_fixed32); result += ProtoAdapter.SFIXED32.encodedSizeWithTag(1005, value.ext_opt_sfixed32); result += ProtoAdapter.INT64.encodedSizeWithTag(1006, value.ext_opt_int64); result += ProtoAdapter.UINT64.encodedSizeWithTag(1007, value.ext_opt_uint64); result += ProtoAdapter.SINT64.encodedSizeWithTag(1008, value.ext_opt_sint64); result += ProtoAdapter.FIXED64.encodedSizeWithTag(1009, value.ext_opt_fixed64); result += ProtoAdapter.SFIXED64.encodedSizeWithTag(1010, value.ext_opt_sfixed64); result += ProtoAdapter.BOOL.encodedSizeWithTag(1011, value.ext_opt_bool); result += ProtoAdapter.FLOAT.encodedSizeWithTag(1012, value.ext_opt_float); result += ProtoAdapter.DOUBLE.encodedSizeWithTag(1013, value.ext_opt_double); result += ProtoAdapter.STRING.encodedSizeWithTag(1014, value.ext_opt_string); result += ProtoAdapter.BYTES.encodedSizeWithTag(1015, value.ext_opt_bytes); result += NestedEnum.ADAPTER.encodedSizeWithTag(1016, value.ext_opt_nested_enum); result += NestedMessage.ADAPTER.encodedSizeWithTag(1017, value.ext_opt_nested_message); result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(1101, value.ext_rep_int32); result += ProtoAdapter.UINT32.asRepeated().encodedSizeWithTag(1102, value.ext_rep_uint32); result += ProtoAdapter.SINT32.asRepeated().encodedSizeWithTag(1103, value.ext_rep_sint32); result += ProtoAdapter.FIXED32.asRepeated().encodedSizeWithTag(1104, value.ext_rep_fixed32); result += ProtoAdapter.SFIXED32.asRepeated().encodedSizeWithTag(1105, value.ext_rep_sfixed32); result += ProtoAdapter.INT64.asRepeated().encodedSizeWithTag(1106, value.ext_rep_int64); result += ProtoAdapter.UINT64.asRepeated().encodedSizeWithTag(1107, value.ext_rep_uint64); result += ProtoAdapter.SINT64.asRepeated().encodedSizeWithTag(1108, value.ext_rep_sint64); result += ProtoAdapter.FIXED64.asRepeated().encodedSizeWithTag(1109, value.ext_rep_fixed64); result += ProtoAdapter.SFIXED64.asRepeated().encodedSizeWithTag(1110, value.ext_rep_sfixed64); result += ProtoAdapter.BOOL.asRepeated().encodedSizeWithTag(1111, value.ext_rep_bool); result += ProtoAdapter.FLOAT.asRepeated().encodedSizeWithTag(1112, value.ext_rep_float); result += ProtoAdapter.DOUBLE.asRepeated().encodedSizeWithTag(1113, value.ext_rep_double); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(1114, value.ext_rep_string); result += ProtoAdapter.BYTES.asRepeated().encodedSizeWithTag(1115, value.ext_rep_bytes); result += NestedEnum.ADAPTER.asRepeated().encodedSizeWithTag(1116, value.ext_rep_nested_enum); result += NestedMessage.ADAPTER.asRepeated().encodedSizeWithTag(1117, value.ext_rep_nested_message); result += ProtoAdapter.INT32.asPacked().encodedSizeWithTag(1201, value.ext_pack_int32); result += ProtoAdapter.UINT32.asPacked().encodedSizeWithTag(1202, value.ext_pack_uint32); result += ProtoAdapter.SINT32.asPacked().encodedSizeWithTag(1203, value.ext_pack_sint32); result += ProtoAdapter.FIXED32.asPacked().encodedSizeWithTag(1204, value.ext_pack_fixed32); result += ProtoAdapter.SFIXED32.asPacked().encodedSizeWithTag(1205, value.ext_pack_sfixed32); result += ProtoAdapter.INT64.asPacked().encodedSizeWithTag(1206, value.ext_pack_int64); result += ProtoAdapter.UINT64.asPacked().encodedSizeWithTag(1207, value.ext_pack_uint64); result += ProtoAdapter.SINT64.asPacked().encodedSizeWithTag(1208, value.ext_pack_sint64); result += ProtoAdapter.FIXED64.asPacked().encodedSizeWithTag(1209, value.ext_pack_fixed64); result += ProtoAdapter.SFIXED64.asPacked().encodedSizeWithTag(1210, value.ext_pack_sfixed64); result += ProtoAdapter.BOOL.asPacked().encodedSizeWithTag(1211, value.ext_pack_bool); result += ProtoAdapter.FLOAT.asPacked().encodedSizeWithTag(1212, value.ext_pack_float); result += ProtoAdapter.DOUBLE.asPacked().encodedSizeWithTag(1213, value.ext_pack_double); result += NestedEnum.ADAPTER.asPacked().encodedSizeWithTag(1216, value.ext_pack_nested_enum); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, AllTypes value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.opt_int32); ProtoAdapter.UINT32.encodeWithTag(writer, 2, value.opt_uint32); ProtoAdapter.SINT32.encodeWithTag(writer, 3, value.opt_sint32); ProtoAdapter.FIXED32.encodeWithTag(writer, 4, value.opt_fixed32); ProtoAdapter.SFIXED32.encodeWithTag(writer, 5, value.opt_sfixed32); ProtoAdapter.INT64.encodeWithTag(writer, 6, value.opt_int64); ProtoAdapter.UINT64.encodeWithTag(writer, 7, value.opt_uint64); ProtoAdapter.SINT64.encodeWithTag(writer, 8, value.opt_sint64); ProtoAdapter.FIXED64.encodeWithTag(writer, 9, value.opt_fixed64); ProtoAdapter.SFIXED64.encodeWithTag(writer, 10, value.opt_sfixed64); ProtoAdapter.BOOL.encodeWithTag(writer, 11, value.opt_bool); ProtoAdapter.FLOAT.encodeWithTag(writer, 12, value.opt_float); ProtoAdapter.DOUBLE.encodeWithTag(writer, 13, value.opt_double); ProtoAdapter.STRING.encodeWithTag(writer, 14, value.opt_string); ProtoAdapter.BYTES.encodeWithTag(writer, 15, value.opt_bytes); NestedEnum.ADAPTER.encodeWithTag(writer, 16, value.opt_nested_enum); NestedMessage.ADAPTER.encodeWithTag(writer, 17, value.opt_nested_message); ProtoAdapter.INT32.encodeWithTag(writer, 101, value.req_int32); ProtoAdapter.UINT32.encodeWithTag(writer, 102, value.req_uint32); ProtoAdapter.SINT32.encodeWithTag(writer, 103, value.req_sint32); ProtoAdapter.FIXED32.encodeWithTag(writer, 104, value.req_fixed32); ProtoAdapter.SFIXED32.encodeWithTag(writer, 105, value.req_sfixed32); ProtoAdapter.INT64.encodeWithTag(writer, 106, value.req_int64); ProtoAdapter.UINT64.encodeWithTag(writer, 107, value.req_uint64); ProtoAdapter.SINT64.encodeWithTag(writer, 108, value.req_sint64); ProtoAdapter.FIXED64.encodeWithTag(writer, 109, value.req_fixed64); ProtoAdapter.SFIXED64.encodeWithTag(writer, 110, value.req_sfixed64); ProtoAdapter.BOOL.encodeWithTag(writer, 111, value.req_bool); ProtoAdapter.FLOAT.encodeWithTag(writer, 112, value.req_float); ProtoAdapter.DOUBLE.encodeWithTag(writer, 113, value.req_double); ProtoAdapter.STRING.encodeWithTag(writer, 114, value.req_string); ProtoAdapter.BYTES.encodeWithTag(writer, 115, value.req_bytes); NestedEnum.ADAPTER.encodeWithTag(writer, 116, value.req_nested_enum); NestedMessage.ADAPTER.encodeWithTag(writer, 117, value.req_nested_message); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 201, value.rep_int32); ProtoAdapter.UINT32.asRepeated().encodeWithTag(writer, 202, value.rep_uint32); ProtoAdapter.SINT32.asRepeated().encodeWithTag(writer, 203, value.rep_sint32); ProtoAdapter.FIXED32.asRepeated().encodeWithTag(writer, 204, value.rep_fixed32); ProtoAdapter.SFIXED32.asRepeated().encodeWithTag(writer, 205, value.rep_sfixed32); ProtoAdapter.INT64.asRepeated().encodeWithTag(writer, 206, value.rep_int64); ProtoAdapter.UINT64.asRepeated().encodeWithTag(writer, 207, value.rep_uint64); ProtoAdapter.SINT64.asRepeated().encodeWithTag(writer, 208, value.rep_sint64); ProtoAdapter.FIXED64.asRepeated().encodeWithTag(writer, 209, value.rep_fixed64); ProtoAdapter.SFIXED64.asRepeated().encodeWithTag(writer, 210, value.rep_sfixed64); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 211, value.rep_bool); ProtoAdapter.FLOAT.asRepeated().encodeWithTag(writer, 212, value.rep_float); ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 213, value.rep_double); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 214, value.rep_string); ProtoAdapter.BYTES.asRepeated().encodeWithTag(writer, 215, value.rep_bytes); NestedEnum.ADAPTER.asRepeated().encodeWithTag(writer, 216, value.rep_nested_enum); NestedMessage.ADAPTER.asRepeated().encodeWithTag(writer, 217, value.rep_nested_message); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 301, value.pack_int32); ProtoAdapter.UINT32.asPacked().encodeWithTag(writer, 302, value.pack_uint32); ProtoAdapter.SINT32.asPacked().encodeWithTag(writer, 303, value.pack_sint32); ProtoAdapter.FIXED32.asPacked().encodeWithTag(writer, 304, value.pack_fixed32); ProtoAdapter.SFIXED32.asPacked().encodeWithTag(writer, 305, value.pack_sfixed32); ProtoAdapter.INT64.asPacked().encodeWithTag(writer, 306, value.pack_int64); ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 307, value.pack_uint64); ProtoAdapter.SINT64.asPacked().encodeWithTag(writer, 308, value.pack_sint64); ProtoAdapter.FIXED64.asPacked().encodeWithTag(writer, 309, value.pack_fixed64); ProtoAdapter.SFIXED64.asPacked().encodeWithTag(writer, 310, value.pack_sfixed64); ProtoAdapter.BOOL.asPacked().encodeWithTag(writer, 311, value.pack_bool); ProtoAdapter.FLOAT.asPacked().encodeWithTag(writer, 312, value.pack_float); ProtoAdapter.DOUBLE.asPacked().encodeWithTag(writer, 313, value.pack_double); NestedEnum.ADAPTER.asPacked().encodeWithTag(writer, 316, value.pack_nested_enum); ProtoAdapter.INT32.encodeWithTag(writer, 401, value.default_int32); ProtoAdapter.UINT32.encodeWithTag(writer, 402, value.default_uint32); ProtoAdapter.SINT32.encodeWithTag(writer, 403, value.default_sint32); ProtoAdapter.FIXED32.encodeWithTag(writer, 404, value.default_fixed32); ProtoAdapter.SFIXED32.encodeWithTag(writer, 405, value.default_sfixed32); ProtoAdapter.INT64.encodeWithTag(writer, 406, value.default_int64); ProtoAdapter.UINT64.encodeWithTag(writer, 407, value.default_uint64); ProtoAdapter.SINT64.encodeWithTag(writer, 408, value.default_sint64); ProtoAdapter.FIXED64.encodeWithTag(writer, 409, value.default_fixed64); ProtoAdapter.SFIXED64.encodeWithTag(writer, 410, value.default_sfixed64); ProtoAdapter.BOOL.encodeWithTag(writer, 411, value.default_bool); ProtoAdapter.FLOAT.encodeWithTag(writer, 412, value.default_float); ProtoAdapter.DOUBLE.encodeWithTag(writer, 413, value.default_double); ProtoAdapter.STRING.encodeWithTag(writer, 414, value.default_string); ProtoAdapter.BYTES.encodeWithTag(writer, 415, value.default_bytes); NestedEnum.ADAPTER.encodeWithTag(writer, 416, value.default_nested_enum); map_int32_int32Adapter().encodeWithTag(writer, 501, value.map_int32_int32); map_string_stringAdapter().encodeWithTag(writer, 502, value.map_string_string); map_string_messageAdapter().encodeWithTag(writer, 503, value.map_string_message); map_string_enumAdapter().encodeWithTag(writer, 504, value.map_string_enum); ProtoAdapter.INT32.encodeWithTag(writer, 1001, value.ext_opt_int32); ProtoAdapter.UINT32.encodeWithTag(writer, 1002, value.ext_opt_uint32); ProtoAdapter.SINT32.encodeWithTag(writer, 1003, value.ext_opt_sint32); ProtoAdapter.FIXED32.encodeWithTag(writer, 1004, value.ext_opt_fixed32); ProtoAdapter.SFIXED32.encodeWithTag(writer, 1005, value.ext_opt_sfixed32); ProtoAdapter.INT64.encodeWithTag(writer, 1006, value.ext_opt_int64); ProtoAdapter.UINT64.encodeWithTag(writer, 1007, value.ext_opt_uint64); ProtoAdapter.SINT64.encodeWithTag(writer, 1008, value.ext_opt_sint64); ProtoAdapter.FIXED64.encodeWithTag(writer, 1009, value.ext_opt_fixed64); ProtoAdapter.SFIXED64.encodeWithTag(writer, 1010, value.ext_opt_sfixed64); ProtoAdapter.BOOL.encodeWithTag(writer, 1011, value.ext_opt_bool); ProtoAdapter.FLOAT.encodeWithTag(writer, 1012, value.ext_opt_float); ProtoAdapter.DOUBLE.encodeWithTag(writer, 1013, value.ext_opt_double); ProtoAdapter.STRING.encodeWithTag(writer, 1014, value.ext_opt_string); ProtoAdapter.BYTES.encodeWithTag(writer, 1015, value.ext_opt_bytes); NestedEnum.ADAPTER.encodeWithTag(writer, 1016, value.ext_opt_nested_enum); NestedMessage.ADAPTER.encodeWithTag(writer, 1017, value.ext_opt_nested_message); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 1101, value.ext_rep_int32); ProtoAdapter.UINT32.asRepeated().encodeWithTag(writer, 1102, value.ext_rep_uint32); ProtoAdapter.SINT32.asRepeated().encodeWithTag(writer, 1103, value.ext_rep_sint32); ProtoAdapter.FIXED32.asRepeated().encodeWithTag(writer, 1104, value.ext_rep_fixed32); ProtoAdapter.SFIXED32.asRepeated().encodeWithTag(writer, 1105, value.ext_rep_sfixed32); ProtoAdapter.INT64.asRepeated().encodeWithTag(writer, 1106, value.ext_rep_int64); ProtoAdapter.UINT64.asRepeated().encodeWithTag(writer, 1107, value.ext_rep_uint64); ProtoAdapter.SINT64.asRepeated().encodeWithTag(writer, 1108, value.ext_rep_sint64); ProtoAdapter.FIXED64.asRepeated().encodeWithTag(writer, 1109, value.ext_rep_fixed64); ProtoAdapter.SFIXED64.asRepeated().encodeWithTag(writer, 1110, value.ext_rep_sfixed64); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 1111, value.ext_rep_bool); ProtoAdapter.FLOAT.asRepeated().encodeWithTag(writer, 1112, value.ext_rep_float); ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 1113, value.ext_rep_double); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 1114, value.ext_rep_string); ProtoAdapter.BYTES.asRepeated().encodeWithTag(writer, 1115, value.ext_rep_bytes); NestedEnum.ADAPTER.asRepeated().encodeWithTag(writer, 1116, value.ext_rep_nested_enum); NestedMessage.ADAPTER.asRepeated().encodeWithTag(writer, 1117, value.ext_rep_nested_message); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 1201, value.ext_pack_int32); ProtoAdapter.UINT32.asPacked().encodeWithTag(writer, 1202, value.ext_pack_uint32); ProtoAdapter.SINT32.asPacked().encodeWithTag(writer, 1203, value.ext_pack_sint32); ProtoAdapter.FIXED32.asPacked().encodeWithTag(writer, 1204, value.ext_pack_fixed32); ProtoAdapter.SFIXED32.asPacked().encodeWithTag(writer, 1205, value.ext_pack_sfixed32); ProtoAdapter.INT64.asPacked().encodeWithTag(writer, 1206, value.ext_pack_int64); ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 1207, value.ext_pack_uint64); ProtoAdapter.SINT64.asPacked().encodeWithTag(writer, 1208, value.ext_pack_sint64); ProtoAdapter.FIXED64.asPacked().encodeWithTag(writer, 1209, value.ext_pack_fixed64); ProtoAdapter.SFIXED64.asPacked().encodeWithTag(writer, 1210, value.ext_pack_sfixed64); ProtoAdapter.BOOL.asPacked().encodeWithTag(writer, 1211, value.ext_pack_bool); ProtoAdapter.FLOAT.asPacked().encodeWithTag(writer, 1212, value.ext_pack_float); ProtoAdapter.DOUBLE.asPacked().encodeWithTag(writer, 1213, value.ext_pack_double); NestedEnum.ADAPTER.asPacked().encodeWithTag(writer, 1216, value.ext_pack_nested_enum); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, AllTypes value) throws IOException { writer.writeBytes(value.unknownFields()); NestedEnum.ADAPTER.asPacked().encodeWithTag(writer, 1216, value.ext_pack_nested_enum); ProtoAdapter.DOUBLE.asPacked().encodeWithTag(writer, 1213, value.ext_pack_double); ProtoAdapter.FLOAT.asPacked().encodeWithTag(writer, 1212, value.ext_pack_float); ProtoAdapter.BOOL.asPacked().encodeWithTag(writer, 1211, value.ext_pack_bool); ProtoAdapter.SFIXED64.asPacked().encodeWithTag(writer, 1210, value.ext_pack_sfixed64); ProtoAdapter.FIXED64.asPacked().encodeWithTag(writer, 1209, value.ext_pack_fixed64); ProtoAdapter.SINT64.asPacked().encodeWithTag(writer, 1208, value.ext_pack_sint64); ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 1207, value.ext_pack_uint64); ProtoAdapter.INT64.asPacked().encodeWithTag(writer, 1206, value.ext_pack_int64); ProtoAdapter.SFIXED32.asPacked().encodeWithTag(writer, 1205, value.ext_pack_sfixed32); ProtoAdapter.FIXED32.asPacked().encodeWithTag(writer, 1204, value.ext_pack_fixed32); ProtoAdapter.SINT32.asPacked().encodeWithTag(writer, 1203, value.ext_pack_sint32); ProtoAdapter.UINT32.asPacked().encodeWithTag(writer, 1202, value.ext_pack_uint32); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 1201, value.ext_pack_int32); NestedMessage.ADAPTER.asRepeated().encodeWithTag(writer, 1117, value.ext_rep_nested_message); NestedEnum.ADAPTER.asRepeated().encodeWithTag(writer, 1116, value.ext_rep_nested_enum); ProtoAdapter.BYTES.asRepeated().encodeWithTag(writer, 1115, value.ext_rep_bytes); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 1114, value.ext_rep_string); ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 1113, value.ext_rep_double); ProtoAdapter.FLOAT.asRepeated().encodeWithTag(writer, 1112, value.ext_rep_float); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 1111, value.ext_rep_bool); ProtoAdapter.SFIXED64.asRepeated().encodeWithTag(writer, 1110, value.ext_rep_sfixed64); ProtoAdapter.FIXED64.asRepeated().encodeWithTag(writer, 1109, value.ext_rep_fixed64); ProtoAdapter.SINT64.asRepeated().encodeWithTag(writer, 1108, value.ext_rep_sint64); ProtoAdapter.UINT64.asRepeated().encodeWithTag(writer, 1107, value.ext_rep_uint64); ProtoAdapter.INT64.asRepeated().encodeWithTag(writer, 1106, value.ext_rep_int64); ProtoAdapter.SFIXED32.asRepeated().encodeWithTag(writer, 1105, value.ext_rep_sfixed32); ProtoAdapter.FIXED32.asRepeated().encodeWithTag(writer, 1104, value.ext_rep_fixed32); ProtoAdapter.SINT32.asRepeated().encodeWithTag(writer, 1103, value.ext_rep_sint32); ProtoAdapter.UINT32.asRepeated().encodeWithTag(writer, 1102, value.ext_rep_uint32); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 1101, value.ext_rep_int32); NestedMessage.ADAPTER.encodeWithTag(writer, 1017, value.ext_opt_nested_message); NestedEnum.ADAPTER.encodeWithTag(writer, 1016, value.ext_opt_nested_enum); ProtoAdapter.BYTES.encodeWithTag(writer, 1015, value.ext_opt_bytes); ProtoAdapter.STRING.encodeWithTag(writer, 1014, value.ext_opt_string); ProtoAdapter.DOUBLE.encodeWithTag(writer, 1013, value.ext_opt_double); ProtoAdapter.FLOAT.encodeWithTag(writer, 1012, value.ext_opt_float); ProtoAdapter.BOOL.encodeWithTag(writer, 1011, value.ext_opt_bool); ProtoAdapter.SFIXED64.encodeWithTag(writer, 1010, value.ext_opt_sfixed64); ProtoAdapter.FIXED64.encodeWithTag(writer, 1009, value.ext_opt_fixed64); ProtoAdapter.SINT64.encodeWithTag(writer, 1008, value.ext_opt_sint64); ProtoAdapter.UINT64.encodeWithTag(writer, 1007, value.ext_opt_uint64); ProtoAdapter.INT64.encodeWithTag(writer, 1006, value.ext_opt_int64); ProtoAdapter.SFIXED32.encodeWithTag(writer, 1005, value.ext_opt_sfixed32); ProtoAdapter.FIXED32.encodeWithTag(writer, 1004, value.ext_opt_fixed32); ProtoAdapter.SINT32.encodeWithTag(writer, 1003, value.ext_opt_sint32); ProtoAdapter.UINT32.encodeWithTag(writer, 1002, value.ext_opt_uint32); ProtoAdapter.INT32.encodeWithTag(writer, 1001, value.ext_opt_int32); map_string_enumAdapter().encodeWithTag(writer, 504, value.map_string_enum); map_string_messageAdapter().encodeWithTag(writer, 503, value.map_string_message); map_string_stringAdapter().encodeWithTag(writer, 502, value.map_string_string); map_int32_int32Adapter().encodeWithTag(writer, 501, value.map_int32_int32); NestedEnum.ADAPTER.encodeWithTag(writer, 416, value.default_nested_enum); ProtoAdapter.BYTES.encodeWithTag(writer, 415, value.default_bytes); ProtoAdapter.STRING.encodeWithTag(writer, 414, value.default_string); ProtoAdapter.DOUBLE.encodeWithTag(writer, 413, value.default_double); ProtoAdapter.FLOAT.encodeWithTag(writer, 412, value.default_float); ProtoAdapter.BOOL.encodeWithTag(writer, 411, value.default_bool); ProtoAdapter.SFIXED64.encodeWithTag(writer, 410, value.default_sfixed64); ProtoAdapter.FIXED64.encodeWithTag(writer, 409, value.default_fixed64); ProtoAdapter.SINT64.encodeWithTag(writer, 408, value.default_sint64); ProtoAdapter.UINT64.encodeWithTag(writer, 407, value.default_uint64); ProtoAdapter.INT64.encodeWithTag(writer, 406, value.default_int64); ProtoAdapter.SFIXED32.encodeWithTag(writer, 405, value.default_sfixed32); ProtoAdapter.FIXED32.encodeWithTag(writer, 404, value.default_fixed32); ProtoAdapter.SINT32.encodeWithTag(writer, 403, value.default_sint32); ProtoAdapter.UINT32.encodeWithTag(writer, 402, value.default_uint32); ProtoAdapter.INT32.encodeWithTag(writer, 401, value.default_int32); NestedEnum.ADAPTER.asPacked().encodeWithTag(writer, 316, value.pack_nested_enum); ProtoAdapter.DOUBLE.asPacked().encodeWithTag(writer, 313, value.pack_double); ProtoAdapter.FLOAT.asPacked().encodeWithTag(writer, 312, value.pack_float); ProtoAdapter.BOOL.asPacked().encodeWithTag(writer, 311, value.pack_bool); ProtoAdapter.SFIXED64.asPacked().encodeWithTag(writer, 310, value.pack_sfixed64); ProtoAdapter.FIXED64.asPacked().encodeWithTag(writer, 309, value.pack_fixed64); ProtoAdapter.SINT64.asPacked().encodeWithTag(writer, 308, value.pack_sint64); ProtoAdapter.UINT64.asPacked().encodeWithTag(writer, 307, value.pack_uint64); ProtoAdapter.INT64.asPacked().encodeWithTag(writer, 306, value.pack_int64); ProtoAdapter.SFIXED32.asPacked().encodeWithTag(writer, 305, value.pack_sfixed32); ProtoAdapter.FIXED32.asPacked().encodeWithTag(writer, 304, value.pack_fixed32); ProtoAdapter.SINT32.asPacked().encodeWithTag(writer, 303, value.pack_sint32); ProtoAdapter.UINT32.asPacked().encodeWithTag(writer, 302, value.pack_uint32); ProtoAdapter.INT32.asPacked().encodeWithTag(writer, 301, value.pack_int32); NestedMessage.ADAPTER.asRepeated().encodeWithTag(writer, 217, value.rep_nested_message); NestedEnum.ADAPTER.asRepeated().encodeWithTag(writer, 216, value.rep_nested_enum); ProtoAdapter.BYTES.asRepeated().encodeWithTag(writer, 215, value.rep_bytes); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 214, value.rep_string); ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 213, value.rep_double); ProtoAdapter.FLOAT.asRepeated().encodeWithTag(writer, 212, value.rep_float); ProtoAdapter.BOOL.asRepeated().encodeWithTag(writer, 211, value.rep_bool); ProtoAdapter.SFIXED64.asRepeated().encodeWithTag(writer, 210, value.rep_sfixed64); ProtoAdapter.FIXED64.asRepeated().encodeWithTag(writer, 209, value.rep_fixed64); ProtoAdapter.SINT64.asRepeated().encodeWithTag(writer, 208, value.rep_sint64); ProtoAdapter.UINT64.asRepeated().encodeWithTag(writer, 207, value.rep_uint64); ProtoAdapter.INT64.asRepeated().encodeWithTag(writer, 206, value.rep_int64); ProtoAdapter.SFIXED32.asRepeated().encodeWithTag(writer, 205, value.rep_sfixed32); ProtoAdapter.FIXED32.asRepeated().encodeWithTag(writer, 204, value.rep_fixed32); ProtoAdapter.SINT32.asRepeated().encodeWithTag(writer, 203, value.rep_sint32); ProtoAdapter.UINT32.asRepeated().encodeWithTag(writer, 202, value.rep_uint32); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 201, value.rep_int32); NestedMessage.ADAPTER.encodeWithTag(writer, 117, value.req_nested_message); NestedEnum.ADAPTER.encodeWithTag(writer, 116, value.req_nested_enum); ProtoAdapter.BYTES.encodeWithTag(writer, 115, value.req_bytes); ProtoAdapter.STRING.encodeWithTag(writer, 114, value.req_string); ProtoAdapter.DOUBLE.encodeWithTag(writer, 113, value.req_double); ProtoAdapter.FLOAT.encodeWithTag(writer, 112, value.req_float); ProtoAdapter.BOOL.encodeWithTag(writer, 111, value.req_bool); ProtoAdapter.SFIXED64.encodeWithTag(writer, 110, value.req_sfixed64); ProtoAdapter.FIXED64.encodeWithTag(writer, 109, value.req_fixed64); ProtoAdapter.SINT64.encodeWithTag(writer, 108, value.req_sint64); ProtoAdapter.UINT64.encodeWithTag(writer, 107, value.req_uint64); ProtoAdapter.INT64.encodeWithTag(writer, 106, value.req_int64); ProtoAdapter.SFIXED32.encodeWithTag(writer, 105, value.req_sfixed32); ProtoAdapter.FIXED32.encodeWithTag(writer, 104, value.req_fixed32); ProtoAdapter.SINT32.encodeWithTag(writer, 103, value.req_sint32); ProtoAdapter.UINT32.encodeWithTag(writer, 102, value.req_uint32); ProtoAdapter.INT32.encodeWithTag(writer, 101, value.req_int32); NestedMessage.ADAPTER.encodeWithTag(writer, 17, value.opt_nested_message); NestedEnum.ADAPTER.encodeWithTag(writer, 16, value.opt_nested_enum); ProtoAdapter.BYTES.encodeWithTag(writer, 15, value.opt_bytes); ProtoAdapter.STRING.encodeWithTag(writer, 14, value.opt_string); ProtoAdapter.DOUBLE.encodeWithTag(writer, 13, value.opt_double); ProtoAdapter.FLOAT.encodeWithTag(writer, 12, value.opt_float); ProtoAdapter.BOOL.encodeWithTag(writer, 11, value.opt_bool); ProtoAdapter.SFIXED64.encodeWithTag(writer, 10, value.opt_sfixed64); ProtoAdapter.FIXED64.encodeWithTag(writer, 9, value.opt_fixed64); ProtoAdapter.SINT64.encodeWithTag(writer, 8, value.opt_sint64); ProtoAdapter.UINT64.encodeWithTag(writer, 7, value.opt_uint64); ProtoAdapter.INT64.encodeWithTag(writer, 6, value.opt_int64); ProtoAdapter.SFIXED32.encodeWithTag(writer, 5, value.opt_sfixed32); ProtoAdapter.FIXED32.encodeWithTag(writer, 4, value.opt_fixed32); ProtoAdapter.SINT32.encodeWithTag(writer, 3, value.opt_sint32); ProtoAdapter.UINT32.encodeWithTag(writer, 2, value.opt_uint32); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.opt_int32); } @Override public AllTypes 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.opt_int32(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.opt_uint32(ProtoAdapter.UINT32.decode(reader)); break; case 3: builder.opt_sint32(ProtoAdapter.SINT32.decode(reader)); break; case 4: builder.opt_fixed32(ProtoAdapter.FIXED32.decode(reader)); break; case 5: builder.opt_sfixed32(ProtoAdapter.SFIXED32.decode(reader)); break; case 6: builder.opt_int64(ProtoAdapter.INT64.decode(reader)); break; case 7: builder.opt_uint64(ProtoAdapter.UINT64.decode(reader)); break; case 8: builder.opt_sint64(ProtoAdapter.SINT64.decode(reader)); break; case 9: builder.opt_fixed64(ProtoAdapter.FIXED64.decode(reader)); break; case 10: builder.opt_sfixed64(ProtoAdapter.SFIXED64.decode(reader)); break; case 11: builder.opt_bool(ProtoAdapter.BOOL.decode(reader)); break; case 12: builder.opt_float(ProtoAdapter.FLOAT.decode(reader)); break; case 13: builder.opt_double(ProtoAdapter.DOUBLE.decode(reader)); break; case 14: builder.opt_string(ProtoAdapter.STRING.decode(reader)); break; case 15: builder.opt_bytes(ProtoAdapter.BYTES.decode(reader)); break; case 16: { try { builder.opt_nested_enum(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 17: builder.opt_nested_message(NestedMessage.ADAPTER.decode(reader)); break; case 101: builder.req_int32(ProtoAdapter.INT32.decode(reader)); break; case 102: builder.req_uint32(ProtoAdapter.UINT32.decode(reader)); break; case 103: builder.req_sint32(ProtoAdapter.SINT32.decode(reader)); break; case 104: builder.req_fixed32(ProtoAdapter.FIXED32.decode(reader)); break; case 105: builder.req_sfixed32(ProtoAdapter.SFIXED32.decode(reader)); break; case 106: builder.req_int64(ProtoAdapter.INT64.decode(reader)); break; case 107: builder.req_uint64(ProtoAdapter.UINT64.decode(reader)); break; case 108: builder.req_sint64(ProtoAdapter.SINT64.decode(reader)); break; case 109: builder.req_fixed64(ProtoAdapter.FIXED64.decode(reader)); break; case 110: builder.req_sfixed64(ProtoAdapter.SFIXED64.decode(reader)); break; case 111: builder.req_bool(ProtoAdapter.BOOL.decode(reader)); break; case 112: builder.req_float(ProtoAdapter.FLOAT.decode(reader)); break; case 113: builder.req_double(ProtoAdapter.DOUBLE.decode(reader)); break; case 114: builder.req_string(ProtoAdapter.STRING.decode(reader)); break; case 115: builder.req_bytes(ProtoAdapter.BYTES.decode(reader)); break; case 116: { try { builder.req_nested_enum(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 117: builder.req_nested_message(NestedMessage.ADAPTER.decode(reader)); break; case 201: builder.rep_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 202: builder.rep_uint32.add(ProtoAdapter.UINT32.decode(reader)); break; case 203: builder.rep_sint32.add(ProtoAdapter.SINT32.decode(reader)); break; case 204: builder.rep_fixed32.add(ProtoAdapter.FIXED32.decode(reader)); break; case 205: builder.rep_sfixed32.add(ProtoAdapter.SFIXED32.decode(reader)); break; case 206: builder.rep_int64.add(ProtoAdapter.INT64.decode(reader)); break; case 207: builder.rep_uint64.add(ProtoAdapter.UINT64.decode(reader)); break; case 208: builder.rep_sint64.add(ProtoAdapter.SINT64.decode(reader)); break; case 209: builder.rep_fixed64.add(ProtoAdapter.FIXED64.decode(reader)); break; case 210: builder.rep_sfixed64.add(ProtoAdapter.SFIXED64.decode(reader)); break; case 211: builder.rep_bool.add(ProtoAdapter.BOOL.decode(reader)); break; case 212: builder.rep_float.add(ProtoAdapter.FLOAT.decode(reader)); break; case 213: builder.rep_double.add(ProtoAdapter.DOUBLE.decode(reader)); break; case 214: builder.rep_string.add(ProtoAdapter.STRING.decode(reader)); break; case 215: builder.rep_bytes.add(ProtoAdapter.BYTES.decode(reader)); break; case 216: { try { builder.rep_nested_enum.add(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 217: builder.rep_nested_message.add(NestedMessage.ADAPTER.decode(reader)); break; case 301: builder.pack_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 302: builder.pack_uint32.add(ProtoAdapter.UINT32.decode(reader)); break; case 303: builder.pack_sint32.add(ProtoAdapter.SINT32.decode(reader)); break; case 304: builder.pack_fixed32.add(ProtoAdapter.FIXED32.decode(reader)); break; case 305: builder.pack_sfixed32.add(ProtoAdapter.SFIXED32.decode(reader)); break; case 306: builder.pack_int64.add(ProtoAdapter.INT64.decode(reader)); break; case 307: builder.pack_uint64.add(ProtoAdapter.UINT64.decode(reader)); break; case 308: builder.pack_sint64.add(ProtoAdapter.SINT64.decode(reader)); break; case 309: builder.pack_fixed64.add(ProtoAdapter.FIXED64.decode(reader)); break; case 310: builder.pack_sfixed64.add(ProtoAdapter.SFIXED64.decode(reader)); break; case 311: builder.pack_bool.add(ProtoAdapter.BOOL.decode(reader)); break; case 312: builder.pack_float.add(ProtoAdapter.FLOAT.decode(reader)); break; case 313: builder.pack_double.add(ProtoAdapter.DOUBLE.decode(reader)); break; case 316: { try { builder.pack_nested_enum.add(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 401: builder.default_int32(ProtoAdapter.INT32.decode(reader)); break; case 402: builder.default_uint32(ProtoAdapter.UINT32.decode(reader)); break; case 403: builder.default_sint32(ProtoAdapter.SINT32.decode(reader)); break; case 404: builder.default_fixed32(ProtoAdapter.FIXED32.decode(reader)); break; case 405: builder.default_sfixed32(ProtoAdapter.SFIXED32.decode(reader)); break; case 406: builder.default_int64(ProtoAdapter.INT64.decode(reader)); break; case 407: builder.default_uint64(ProtoAdapter.UINT64.decode(reader)); break; case 408: builder.default_sint64(ProtoAdapter.SINT64.decode(reader)); break; case 409: builder.default_fixed64(ProtoAdapter.FIXED64.decode(reader)); break; case 410: builder.default_sfixed64(ProtoAdapter.SFIXED64.decode(reader)); break; case 411: builder.default_bool(ProtoAdapter.BOOL.decode(reader)); break; case 412: builder.default_float(ProtoAdapter.FLOAT.decode(reader)); break; case 413: builder.default_double(ProtoAdapter.DOUBLE.decode(reader)); break; case 414: builder.default_string(ProtoAdapter.STRING.decode(reader)); break; case 415: builder.default_bytes(ProtoAdapter.BYTES.decode(reader)); break; case 416: { try { builder.default_nested_enum(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 501: builder.map_int32_int32.putAll(map_int32_int32Adapter().decode(reader)); break; case 502: builder.map_string_string.putAll(map_string_stringAdapter().decode(reader)); break; case 503: builder.map_string_message.putAll(map_string_messageAdapter().decode(reader)); break; case 504: builder.map_string_enum.putAll(map_string_enumAdapter().decode(reader)); break; case 1001: builder.ext_opt_int32(ProtoAdapter.INT32.decode(reader)); break; case 1002: builder.ext_opt_uint32(ProtoAdapter.UINT32.decode(reader)); break; case 1003: builder.ext_opt_sint32(ProtoAdapter.SINT32.decode(reader)); break; case 1004: builder.ext_opt_fixed32(ProtoAdapter.FIXED32.decode(reader)); break; case 1005: builder.ext_opt_sfixed32(ProtoAdapter.SFIXED32.decode(reader)); break; case 1006: builder.ext_opt_int64(ProtoAdapter.INT64.decode(reader)); break; case 1007: builder.ext_opt_uint64(ProtoAdapter.UINT64.decode(reader)); break; case 1008: builder.ext_opt_sint64(ProtoAdapter.SINT64.decode(reader)); break; case 1009: builder.ext_opt_fixed64(ProtoAdapter.FIXED64.decode(reader)); break; case 1010: builder.ext_opt_sfixed64(ProtoAdapter.SFIXED64.decode(reader)); break; case 1011: builder.ext_opt_bool(ProtoAdapter.BOOL.decode(reader)); break; case 1012: builder.ext_opt_float(ProtoAdapter.FLOAT.decode(reader)); break; case 1013: builder.ext_opt_double(ProtoAdapter.DOUBLE.decode(reader)); break; case 1014: builder.ext_opt_string(ProtoAdapter.STRING.decode(reader)); break; case 1015: builder.ext_opt_bytes(ProtoAdapter.BYTES.decode(reader)); break; case 1016: { try { builder.ext_opt_nested_enum(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 1017: builder.ext_opt_nested_message(NestedMessage.ADAPTER.decode(reader)); break; case 1101: builder.ext_rep_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 1102: builder.ext_rep_uint32.add(ProtoAdapter.UINT32.decode(reader)); break; case 1103: builder.ext_rep_sint32.add(ProtoAdapter.SINT32.decode(reader)); break; case 1104: builder.ext_rep_fixed32.add(ProtoAdapter.FIXED32.decode(reader)); break; case 1105: builder.ext_rep_sfixed32.add(ProtoAdapter.SFIXED32.decode(reader)); break; case 1106: builder.ext_rep_int64.add(ProtoAdapter.INT64.decode(reader)); break; case 1107: builder.ext_rep_uint64.add(ProtoAdapter.UINT64.decode(reader)); break; case 1108: builder.ext_rep_sint64.add(ProtoAdapter.SINT64.decode(reader)); break; case 1109: builder.ext_rep_fixed64.add(ProtoAdapter.FIXED64.decode(reader)); break; case 1110: builder.ext_rep_sfixed64.add(ProtoAdapter.SFIXED64.decode(reader)); break; case 1111: builder.ext_rep_bool.add(ProtoAdapter.BOOL.decode(reader)); break; case 1112: builder.ext_rep_float.add(ProtoAdapter.FLOAT.decode(reader)); break; case 1113: builder.ext_rep_double.add(ProtoAdapter.DOUBLE.decode(reader)); break; case 1114: builder.ext_rep_string.add(ProtoAdapter.STRING.decode(reader)); break; case 1115: builder.ext_rep_bytes.add(ProtoAdapter.BYTES.decode(reader)); break; case 1116: { try { builder.ext_rep_nested_enum.add(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 1117: builder.ext_rep_nested_message.add(NestedMessage.ADAPTER.decode(reader)); break; case 1201: builder.ext_pack_int32.add(ProtoAdapter.INT32.decode(reader)); break; case 1202: builder.ext_pack_uint32.add(ProtoAdapter.UINT32.decode(reader)); break; case 1203: builder.ext_pack_sint32.add(ProtoAdapter.SINT32.decode(reader)); break; case 1204: builder.ext_pack_fixed32.add(ProtoAdapter.FIXED32.decode(reader)); break; case 1205: builder.ext_pack_sfixed32.add(ProtoAdapter.SFIXED32.decode(reader)); break; case 1206: builder.ext_pack_int64.add(ProtoAdapter.INT64.decode(reader)); break; case 1207: builder.ext_pack_uint64.add(ProtoAdapter.UINT64.decode(reader)); break; case 1208: builder.ext_pack_sint64.add(ProtoAdapter.SINT64.decode(reader)); break; case 1209: builder.ext_pack_fixed64.add(ProtoAdapter.FIXED64.decode(reader)); break; case 1210: builder.ext_pack_sfixed64.add(ProtoAdapter.SFIXED64.decode(reader)); break; case 1211: builder.ext_pack_bool.add(ProtoAdapter.BOOL.decode(reader)); break; case 1212: builder.ext_pack_float.add(ProtoAdapter.FLOAT.decode(reader)); break; case 1213: builder.ext_pack_double.add(ProtoAdapter.DOUBLE.decode(reader)); break; case 1216: { try { builder.ext_pack_nested_enum.add(NestedEnum.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 AllTypes redact(AllTypes value) { Builder builder = value.newBuilder(); if (builder.opt_nested_message != null) builder.opt_nested_message = NestedMessage.ADAPTER.redact(builder.opt_nested_message); builder.req_nested_message = NestedMessage.ADAPTER.redact(builder.req_nested_message); Internal.redactElements(builder.rep_nested_message, NestedMessage.ADAPTER); Internal.redactElements(builder.map_string_message, NestedMessage.ADAPTER); if (builder.ext_opt_nested_message != null) builder.ext_opt_nested_message = NestedMessage.ADAPTER.redact(builder.ext_opt_nested_message); Internal.redactElements(builder.ext_rep_nested_message, NestedMessage.ADAPTER); 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; } private ProtoAdapter<Map<String, String>> map_string_stringAdapter() { ProtoAdapter<Map<String, String>> result = map_string_string; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.STRING); map_string_string = result; } return result; } private ProtoAdapter<Map<String, NestedMessage>> map_string_messageAdapter() { ProtoAdapter<Map<String, NestedMessage>> result = map_string_message; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, NestedMessage.ADAPTER); map_string_message = result; } return result; } private ProtoAdapter<Map<String, NestedEnum>> map_string_enumAdapter() { ProtoAdapter<Map<String, NestedEnum>> result = map_string_enum; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, NestedEnum.ADAPTER); map_string_enum = result; } return result; } } }
6,947
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/person/Person.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.person.Person in person.proto package com.squareup.wire.protos.person; 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; 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 Integer DEFAULT_ID = 0; public static final String DEFAULT_NAME = ""; public static final String DEFAULT_EMAIL = ""; /** * The customer's ID number. */ @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer id; /** * The customer's full name. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String name; /** * 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.protos.person.Person$PhoneNumber#ADAPTER", label = WireField.Label.REPEATED ) public final List<PhoneNumber> phone; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> aliases; public Person(Integer id, String name, String email, List<PhoneNumber> phone, List<String> aliases) { this(id, name, email, phone, aliases, ByteString.EMPTY); } public Person(Integer id, String name, String email, List<PhoneNumber> phone, List<String> aliases, ByteString unknownFields) { super(ADAPTER, unknownFields); this.id = id; this.name = name; this.email = email; this.phone = Internal.immutableCopyOf("phone", phone); this.aliases = Internal.immutableCopyOf("aliases", aliases); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.id = id; builder.name = name; builder.email = email; builder.phone = Internal.copyOf(phone); builder.aliases = Internal.copyOf(aliases); 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()) && id.equals(o.id) && name.equals(o.name) && Internal.equals(email, o.email) && phone.equals(o.phone) && aliases.equals(o.aliases); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + id.hashCode(); result = result * 37 + name.hashCode(); result = result * 37 + (email != null ? email.hashCode() : 0); result = result * 37 + phone.hashCode(); result = result * 37 + aliases.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(", id=").append(id); builder.append(", name=").append(Internal.sanitize(name)); if (email != null) builder.append(", email=").append(Internal.sanitize(email)); if (!phone.isEmpty()) builder.append(", phone=").append(phone); if (!aliases.isEmpty()) builder.append(", aliases=").append(Internal.sanitize(aliases)); return builder.replace(0, 2, "Person{").append('}').toString(); } public static final class Builder extends Message.Builder<Person, Builder> { public Integer id; public String name; public String email; public List<PhoneNumber> phone; public List<String> aliases; public Builder() { phone = Internal.newMutableList(); aliases = Internal.newMutableList(); } /** * The customer's ID number. */ public Builder id(Integer id) { this.id = id; return this; } /** * The customer's full name. */ public Builder name(String name) { this.name = name; 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; } public Builder aliases(List<String> aliases) { Internal.checkElementsNotNull(aliases); this.aliases = aliases; return this; } @Override public Person build() { if (id == null || name == null) { throw Internal.missingRequiredFields(id, "id", name, "name"); } return new Person(id, name, email, phone, aliases, super.buildUnknownFields()); } } 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.protos.person.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.protos.person.Person.PhoneNumber", Syntax.PROTO_2, null, "person.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.protos.person.Person", Syntax.PROTO_2, null, "person.proto"); } @Override public int encodedSize(Person value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(2, value.id); result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.email); result += PhoneNumber.ADAPTER.asRepeated().encodedSizeWithTag(4, value.phone); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(5, value.aliases); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Person value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 2, value.id); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.email); PhoneNumber.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.phone); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 5, value.aliases); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Person value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 5, value.aliases); PhoneNumber.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.phone); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.email); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.id); } @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; case 5: builder.aliases.add(ProtoAdapter.STRING.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(); } } }
6,948
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/unknownfields/VersionTwo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.unknownfields.VersionTwo in unknown_fields.proto package com.squareup.wire.protos.unknownfields; 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.Long; 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 VersionTwo extends Message<VersionTwo, VersionTwo.Builder> { public static final ProtoAdapter<VersionTwo> ADAPTER = new ProtoAdapter_VersionTwo(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; public static final Integer DEFAULT_V2_I = 0; public static final String DEFAULT_V2_S = ""; public static final Integer DEFAULT_V2_F32 = 0; public static final Long DEFAULT_V2_F64 = 0L; public static final EnumVersionTwo DEFAULT_EN = EnumVersionTwo.SHREK_V2; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer v2_i; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String v2_s; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer v2_f32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long v2_f64; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> v2_rs; @WireField( tag = 7, adapter = "com.squareup.wire.protos.unknownfields.NestedVersionTwo#ADAPTER" ) public final NestedVersionTwo obj; @WireField( tag = 8, adapter = "com.squareup.wire.protos.unknownfields.EnumVersionTwo#ADAPTER" ) public final EnumVersionTwo en; public VersionTwo(Integer i, Integer v2_i, String v2_s, Integer v2_f32, Long v2_f64, List<String> v2_rs, NestedVersionTwo obj, EnumVersionTwo en) { this(i, v2_i, v2_s, v2_f32, v2_f64, v2_rs, obj, en, ByteString.EMPTY); } public VersionTwo(Integer i, Integer v2_i, String v2_s, Integer v2_f32, Long v2_f64, List<String> v2_rs, NestedVersionTwo obj, EnumVersionTwo en, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; this.v2_i = v2_i; this.v2_s = v2_s; this.v2_f32 = v2_f32; this.v2_f64 = v2_f64; this.v2_rs = Internal.immutableCopyOf("v2_rs", v2_rs); this.obj = obj; this.en = en; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.v2_i = v2_i; builder.v2_s = v2_s; builder.v2_f32 = v2_f32; builder.v2_f64 = v2_f64; builder.v2_rs = Internal.copyOf(v2_rs); builder.obj = obj; builder.en = en; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof VersionTwo)) return false; VersionTwo o = (VersionTwo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i) && Internal.equals(v2_i, o.v2_i) && Internal.equals(v2_s, o.v2_s) && Internal.equals(v2_f32, o.v2_f32) && Internal.equals(v2_f64, o.v2_f64) && v2_rs.equals(o.v2_rs) && Internal.equals(obj, o.obj) && Internal.equals(en, o.en); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); result = result * 37 + (v2_i != null ? v2_i.hashCode() : 0); result = result * 37 + (v2_s != null ? v2_s.hashCode() : 0); result = result * 37 + (v2_f32 != null ? v2_f32.hashCode() : 0); result = result * 37 + (v2_f64 != null ? v2_f64.hashCode() : 0); result = result * 37 + v2_rs.hashCode(); result = result * 37 + (obj != null ? obj.hashCode() : 0); result = result * 37 + (en != null ? en.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); if (v2_i != null) builder.append(", v2_i=").append(v2_i); if (v2_s != null) builder.append(", v2_s=").append(Internal.sanitize(v2_s)); if (v2_f32 != null) builder.append(", v2_f32=").append(v2_f32); if (v2_f64 != null) builder.append(", v2_f64=").append(v2_f64); if (!v2_rs.isEmpty()) builder.append(", v2_rs=").append(Internal.sanitize(v2_rs)); if (obj != null) builder.append(", obj=").append(obj); if (en != null) builder.append(", en=").append(en); return builder.replace(0, 2, "VersionTwo{").append('}').toString(); } public static final class Builder extends Message.Builder<VersionTwo, Builder> { public Integer i; public Integer v2_i; public String v2_s; public Integer v2_f32; public Long v2_f64; public List<String> v2_rs; public NestedVersionTwo obj; public EnumVersionTwo en; public Builder() { v2_rs = Internal.newMutableList(); } public Builder i(Integer i) { this.i = i; return this; } public Builder v2_i(Integer v2_i) { this.v2_i = v2_i; return this; } public Builder v2_s(String v2_s) { this.v2_s = v2_s; return this; } public Builder v2_f32(Integer v2_f32) { this.v2_f32 = v2_f32; return this; } public Builder v2_f64(Long v2_f64) { this.v2_f64 = v2_f64; return this; } public Builder v2_rs(List<String> v2_rs) { Internal.checkElementsNotNull(v2_rs); this.v2_rs = v2_rs; return this; } public Builder obj(NestedVersionTwo obj) { this.obj = obj; return this; } public Builder en(EnumVersionTwo en) { this.en = en; return this; } @Override public VersionTwo build() { return new VersionTwo(i, v2_i, v2_s, v2_f32, v2_f64, v2_rs, obj, en, super.buildUnknownFields()); } } private static final class ProtoAdapter_VersionTwo extends ProtoAdapter<VersionTwo> { public ProtoAdapter_VersionTwo() { super(FieldEncoding.LENGTH_DELIMITED, VersionTwo.class, "type.googleapis.com/squareup.protos.unknownfields.VersionTwo", Syntax.PROTO_2, null, "unknown_fields.proto"); } @Override public int encodedSize(VersionTwo value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += ProtoAdapter.INT32.encodedSizeWithTag(2, value.v2_i); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.v2_s); result += ProtoAdapter.FIXED32.encodedSizeWithTag(4, value.v2_f32); result += ProtoAdapter.FIXED64.encodedSizeWithTag(5, value.v2_f64); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(6, value.v2_rs); result += NestedVersionTwo.ADAPTER.encodedSizeWithTag(7, value.obj); result += EnumVersionTwo.ADAPTER.encodedSizeWithTag(8, value.en); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, VersionTwo value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.v2_i); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.v2_s); ProtoAdapter.FIXED32.encodeWithTag(writer, 4, value.v2_f32); ProtoAdapter.FIXED64.encodeWithTag(writer, 5, value.v2_f64); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 6, value.v2_rs); NestedVersionTwo.ADAPTER.encodeWithTag(writer, 7, value.obj); EnumVersionTwo.ADAPTER.encodeWithTag(writer, 8, value.en); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, VersionTwo value) throws IOException { writer.writeBytes(value.unknownFields()); EnumVersionTwo.ADAPTER.encodeWithTag(writer, 8, value.en); NestedVersionTwo.ADAPTER.encodeWithTag(writer, 7, value.obj); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 6, value.v2_rs); ProtoAdapter.FIXED64.encodeWithTag(writer, 5, value.v2_f64); ProtoAdapter.FIXED32.encodeWithTag(writer, 4, value.v2_f32); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.v2_s); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.v2_i); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public VersionTwo 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.i(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.v2_i(ProtoAdapter.INT32.decode(reader)); break; case 3: builder.v2_s(ProtoAdapter.STRING.decode(reader)); break; case 4: builder.v2_f32(ProtoAdapter.FIXED32.decode(reader)); break; case 5: builder.v2_f64(ProtoAdapter.FIXED64.decode(reader)); break; case 6: builder.v2_rs.add(ProtoAdapter.STRING.decode(reader)); break; case 7: builder.obj(NestedVersionTwo.ADAPTER.decode(reader)); break; case 8: { try { builder.en(EnumVersionTwo.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 VersionTwo redact(VersionTwo value) { Builder builder = value.newBuilder(); if (builder.obj != null) builder.obj = NestedVersionTwo.ADAPTER.redact(builder.obj); builder.clearUnknownFields(); return builder.build(); } } }
6,949
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/unknownfields/EnumVersionTwo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.unknownfields.EnumVersionTwo in unknown_fields.proto package com.squareup.wire.protos.unknownfields; 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 EnumVersionTwo implements WireEnum { SHREK_V2(1), DONKEY_V2(2), FIONA_V2(3), PUSS_IN_BOOTS_V2(4); public static final ProtoAdapter<EnumVersionTwo> ADAPTER = new ProtoAdapter_EnumVersionTwo(); private final int value; EnumVersionTwo(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static EnumVersionTwo fromValue(int value) { switch (value) { case 1: return SHREK_V2; case 2: return DONKEY_V2; case 3: return FIONA_V2; case 4: return PUSS_IN_BOOTS_V2; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_EnumVersionTwo extends EnumAdapter<EnumVersionTwo> { ProtoAdapter_EnumVersionTwo() { super(EnumVersionTwo.class, Syntax.PROTO_2, null); } @Override protected EnumVersionTwo fromValue(int value) { return EnumVersionTwo.fromValue(value); } } }
6,950
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/unknownfields/NestedVersionTwo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.unknownfields.NestedVersionTwo in unknown_fields.proto package com.squareup.wire.protos.unknownfields; 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.Long; 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 NestedVersionTwo extends Message<NestedVersionTwo, NestedVersionTwo.Builder> { public static final ProtoAdapter<NestedVersionTwo> ADAPTER = new ProtoAdapter_NestedVersionTwo(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; public static final Integer DEFAULT_V2_I = 0; public static final String DEFAULT_V2_S = ""; public static final Integer DEFAULT_V2_F32 = 0; public static final Long DEFAULT_V2_F64 = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer v2_i; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String v2_s; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer v2_f32; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long v2_f64; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> v2_rs; public NestedVersionTwo(Integer i, Integer v2_i, String v2_s, Integer v2_f32, Long v2_f64, List<String> v2_rs) { this(i, v2_i, v2_s, v2_f32, v2_f64, v2_rs, ByteString.EMPTY); } public NestedVersionTwo(Integer i, Integer v2_i, String v2_s, Integer v2_f32, Long v2_f64, List<String> v2_rs, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; this.v2_i = v2_i; this.v2_s = v2_s; this.v2_f32 = v2_f32; this.v2_f64 = v2_f64; this.v2_rs = Internal.immutableCopyOf("v2_rs", v2_rs); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.v2_i = v2_i; builder.v2_s = v2_s; builder.v2_f32 = v2_f32; builder.v2_f64 = v2_f64; builder.v2_rs = Internal.copyOf(v2_rs); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedVersionTwo)) return false; NestedVersionTwo o = (NestedVersionTwo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i) && Internal.equals(v2_i, o.v2_i) && Internal.equals(v2_s, o.v2_s) && Internal.equals(v2_f32, o.v2_f32) && Internal.equals(v2_f64, o.v2_f64) && v2_rs.equals(o.v2_rs); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); result = result * 37 + (v2_i != null ? v2_i.hashCode() : 0); result = result * 37 + (v2_s != null ? v2_s.hashCode() : 0); result = result * 37 + (v2_f32 != null ? v2_f32.hashCode() : 0); result = result * 37 + (v2_f64 != null ? v2_f64.hashCode() : 0); result = result * 37 + v2_rs.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); if (v2_i != null) builder.append(", v2_i=").append(v2_i); if (v2_s != null) builder.append(", v2_s=").append(Internal.sanitize(v2_s)); if (v2_f32 != null) builder.append(", v2_f32=").append(v2_f32); if (v2_f64 != null) builder.append(", v2_f64=").append(v2_f64); if (!v2_rs.isEmpty()) builder.append(", v2_rs=").append(Internal.sanitize(v2_rs)); return builder.replace(0, 2, "NestedVersionTwo{").append('}').toString(); } public static final class Builder extends Message.Builder<NestedVersionTwo, Builder> { public Integer i; public Integer v2_i; public String v2_s; public Integer v2_f32; public Long v2_f64; public List<String> v2_rs; public Builder() { v2_rs = Internal.newMutableList(); } public Builder i(Integer i) { this.i = i; return this; } public Builder v2_i(Integer v2_i) { this.v2_i = v2_i; return this; } public Builder v2_s(String v2_s) { this.v2_s = v2_s; return this; } public Builder v2_f32(Integer v2_f32) { this.v2_f32 = v2_f32; return this; } public Builder v2_f64(Long v2_f64) { this.v2_f64 = v2_f64; return this; } public Builder v2_rs(List<String> v2_rs) { Internal.checkElementsNotNull(v2_rs); this.v2_rs = v2_rs; return this; } @Override public NestedVersionTwo build() { return new NestedVersionTwo(i, v2_i, v2_s, v2_f32, v2_f64, v2_rs, super.buildUnknownFields()); } } private static final class ProtoAdapter_NestedVersionTwo extends ProtoAdapter<NestedVersionTwo> { public ProtoAdapter_NestedVersionTwo() { super(FieldEncoding.LENGTH_DELIMITED, NestedVersionTwo.class, "type.googleapis.com/squareup.protos.unknownfields.NestedVersionTwo", Syntax.PROTO_2, null, "unknown_fields.proto"); } @Override public int encodedSize(NestedVersionTwo value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += ProtoAdapter.INT32.encodedSizeWithTag(2, value.v2_i); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.v2_s); result += ProtoAdapter.FIXED32.encodedSizeWithTag(4, value.v2_f32); result += ProtoAdapter.FIXED64.encodedSizeWithTag(5, value.v2_f64); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(6, value.v2_rs); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, NestedVersionTwo value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.v2_i); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.v2_s); ProtoAdapter.FIXED32.encodeWithTag(writer, 4, value.v2_f32); ProtoAdapter.FIXED64.encodeWithTag(writer, 5, value.v2_f64); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 6, value.v2_rs); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, NestedVersionTwo value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 6, value.v2_rs); ProtoAdapter.FIXED64.encodeWithTag(writer, 5, value.v2_f64); ProtoAdapter.FIXED32.encodeWithTag(writer, 4, value.v2_f32); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.v2_s); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.v2_i); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public NestedVersionTwo 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.i(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.v2_i(ProtoAdapter.INT32.decode(reader)); break; case 3: builder.v2_s(ProtoAdapter.STRING.decode(reader)); break; case 4: builder.v2_f32(ProtoAdapter.FIXED32.decode(reader)); break; case 5: builder.v2_f64(ProtoAdapter.FIXED64.decode(reader)); break; case 6: builder.v2_rs.add(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public NestedVersionTwo redact(NestedVersionTwo value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,951
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/unknownfields/NestedVersionOne.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.unknownfields.NestedVersionOne in unknown_fields.proto package com.squareup.wire.protos.unknownfields; 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 okio.ByteString; public final class NestedVersionOne extends Message<NestedVersionOne, NestedVersionOne.Builder> { public static final ProtoAdapter<NestedVersionOne> ADAPTER = new ProtoAdapter_NestedVersionOne(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; public NestedVersionOne(Integer i) { this(i, ByteString.EMPTY); } public NestedVersionOne(Integer i, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NestedVersionOne)) return false; NestedVersionOne o = (NestedVersionOne) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); return builder.replace(0, 2, "NestedVersionOne{").append('}').toString(); } public static final class Builder extends Message.Builder<NestedVersionOne, Builder> { public Integer i; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } @Override public NestedVersionOne build() { return new NestedVersionOne(i, super.buildUnknownFields()); } } private static final class ProtoAdapter_NestedVersionOne extends ProtoAdapter<NestedVersionOne> { public ProtoAdapter_NestedVersionOne() { super(FieldEncoding.LENGTH_DELIMITED, NestedVersionOne.class, "type.googleapis.com/squareup.protos.unknownfields.NestedVersionOne", Syntax.PROTO_2, null, "unknown_fields.proto"); } @Override public int encodedSize(NestedVersionOne value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, NestedVersionOne value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, NestedVersionOne value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public NestedVersionOne 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.i(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public NestedVersionOne redact(NestedVersionOne value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,952
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/unknownfields/EnumVersionOne.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.unknownfields.EnumVersionOne in unknown_fields.proto package com.squareup.wire.protos.unknownfields; 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 EnumVersionOne implements WireEnum { SHREK_V1(1), DONKEY_V1(2), FIONA_V1(3); public static final ProtoAdapter<EnumVersionOne> ADAPTER = new ProtoAdapter_EnumVersionOne(); private final int value; EnumVersionOne(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static EnumVersionOne fromValue(int value) { switch (value) { case 1: return SHREK_V1; case 2: return DONKEY_V1; case 3: return FIONA_V1; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_EnumVersionOne extends EnumAdapter<EnumVersionOne> { ProtoAdapter_EnumVersionOne() { super(EnumVersionOne.class, Syntax.PROTO_2, null); } @Override protected EnumVersionOne fromValue(int value) { return EnumVersionOne.fromValue(value); } } }
6,953
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/unknownfields/VersionOne.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.unknownfields.VersionOne in unknown_fields.proto package com.squareup.wire.protos.unknownfields; 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 okio.ByteString; public final class VersionOne extends Message<VersionOne, VersionOne.Builder> { public static final ProtoAdapter<VersionOne> ADAPTER = new ProtoAdapter_VersionOne(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; public static final EnumVersionOne DEFAULT_EN = EnumVersionOne.SHREK_V1; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; @WireField( tag = 7, adapter = "com.squareup.wire.protos.unknownfields.NestedVersionOne#ADAPTER" ) public final NestedVersionOne obj; @WireField( tag = 8, adapter = "com.squareup.wire.protos.unknownfields.EnumVersionOne#ADAPTER" ) public final EnumVersionOne en; public VersionOne(Integer i, NestedVersionOne obj, EnumVersionOne en) { this(i, obj, en, ByteString.EMPTY); } public VersionOne(Integer i, NestedVersionOne obj, EnumVersionOne en, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; this.obj = obj; this.en = en; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.obj = obj; builder.en = en; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof VersionOne)) return false; VersionOne o = (VersionOne) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i) && Internal.equals(obj, o.obj) && Internal.equals(en, o.en); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); result = result * 37 + (obj != null ? obj.hashCode() : 0); result = result * 37 + (en != null ? en.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); if (obj != null) builder.append(", obj=").append(obj); if (en != null) builder.append(", en=").append(en); return builder.replace(0, 2, "VersionOne{").append('}').toString(); } public static final class Builder extends Message.Builder<VersionOne, Builder> { public Integer i; public NestedVersionOne obj; public EnumVersionOne en; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } public Builder obj(NestedVersionOne obj) { this.obj = obj; return this; } public Builder en(EnumVersionOne en) { this.en = en; return this; } @Override public VersionOne build() { return new VersionOne(i, obj, en, super.buildUnknownFields()); } } private static final class ProtoAdapter_VersionOne extends ProtoAdapter<VersionOne> { public ProtoAdapter_VersionOne() { super(FieldEncoding.LENGTH_DELIMITED, VersionOne.class, "type.googleapis.com/squareup.protos.unknownfields.VersionOne", Syntax.PROTO_2, null, "unknown_fields.proto"); } @Override public int encodedSize(VersionOne value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += NestedVersionOne.ADAPTER.encodedSizeWithTag(7, value.obj); result += EnumVersionOne.ADAPTER.encodedSizeWithTag(8, value.en); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, VersionOne value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); NestedVersionOne.ADAPTER.encodeWithTag(writer, 7, value.obj); EnumVersionOne.ADAPTER.encodeWithTag(writer, 8, value.en); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, VersionOne value) throws IOException { writer.writeBytes(value.unknownFields()); EnumVersionOne.ADAPTER.encodeWithTag(writer, 8, value.en); NestedVersionOne.ADAPTER.encodeWithTag(writer, 7, value.obj); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public VersionOne 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.i(ProtoAdapter.INT32.decode(reader)); break; case 7: builder.obj(NestedVersionOne.ADAPTER.decode(reader)); break; case 8: { try { builder.en(EnumVersionOne.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 VersionOne redact(VersionOne value) { Builder builder = value.newBuilder(); if (builder.obj != null) builder.obj = NestedVersionOne.ADAPTER.redact(builder.obj); builder.clearUnknownFields(); return builder.build(); } } }
6,954
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/depend_on_kotlin_option/Letter.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.depend_on_kotlin_option.Letter in depend_on_kotlin_option.proto package com.squareup.wire.protos.depend_on_kotlin_option; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Letter extends Message<Letter, Letter.Builder> { public static final ProtoAdapter<Letter> ADAPTER = new ProtoAdapter_Letter(); private static final long serialVersionUID = 0L; public static final String DEFAULT_SUBJECT = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String subject; public Letter(String subject) { this(subject, ByteString.EMPTY); } public Letter(String subject, ByteString unknownFields) { super(ADAPTER, unknownFields); this.subject = subject; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.subject = subject; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Letter)) return false; Letter o = (Letter) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(subject, o.subject); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (subject != null ? subject.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (subject != null) builder.append(", subject=").append(Internal.sanitize(subject)); return builder.replace(0, 2, "Letter{").append('}').toString(); } public static final class Builder extends Message.Builder<Letter, Builder> { public String subject; public Builder() { } public Builder subject(String subject) { this.subject = subject; return this; } @Override public Letter build() { return new Letter(subject, super.buildUnknownFields()); } } private static final class ProtoAdapter_Letter extends ProtoAdapter<Letter> { public ProtoAdapter_Letter() { super(FieldEncoding.LENGTH_DELIMITED, Letter.class, "type.googleapis.com/squareup.protos.depend_on_kotlin_option.Letter", Syntax.PROTO_2, null, "depend_on_kotlin_option.proto"); } @Override public int encodedSize(Letter value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.subject); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Letter value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.subject); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Letter value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.subject); } @Override public Letter 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.subject(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Letter redact(Letter value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,955
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/simple/SimpleMessage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.simple.SimpleMessage in simple_message.proto package com.squareup.wire.protos.simple; 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 com.squareup.wire.protos.foreign.ForeignEnum; import java.io.IOException; import java.lang.Deprecated; import java.lang.Double; 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; /** * A message for testing. */ public final class SimpleMessage extends Message<SimpleMessage, SimpleMessage.Builder> { public static final ProtoAdapter<SimpleMessage> ADAPTER = new ProtoAdapter_SimpleMessage(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OPTIONAL_INT32 = 123; public static final NestedEnum DEFAULT_DEFAULT_NESTED_ENUM = NestedEnum.BAZ; public static final Integer DEFAULT_REQUIRED_INT32 = 456; public static final ForeignEnum DEFAULT_DEFAULT_FOREIGN_ENUM = ForeignEnum.BAX; public static final ForeignEnum DEFAULT_NO_DEFAULT_FOREIGN_ENUM = ForeignEnum.BAV; public static final String DEFAULT_PACKAGE_ = ""; public static final String DEFAULT_RESULT = ""; public static final String DEFAULT_OTHER = ""; public static final String DEFAULT_O = ""; /** * An optional int32 */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer optional_int32; /** * An optional NestedMessage, deprecated */ @WireField( tag = 2, adapter = "com.squareup.wire.protos.simple.SimpleMessage$NestedMessage#ADAPTER" ) @Deprecated public final NestedMessage optional_nested_msg; /** * An optional ExternalMessage */ @WireField( tag = 3, adapter = "com.squareup.wire.protos.simple.ExternalMessage#ADAPTER" ) public final ExternalMessage optional_external_msg; @WireField( tag = 4, adapter = "com.squareup.wire.protos.simple.SimpleMessage$NestedEnum#ADAPTER" ) public final NestedEnum default_nested_enum; /** * A required int32 */ @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer required_int32; /** * A repeated double, deprecated */ @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", label = WireField.Label.REPEATED ) @Deprecated public final List<Double> repeated_double; /** * enum from another package with an explicit default */ @WireField( tag = 7, adapter = "com.squareup.wire.protos.foreign.ForeignEnum#ADAPTER" ) public final ForeignEnum default_foreign_enum; /** * enum from another package without an explicit default */ @WireField( tag = 8, adapter = "com.squareup.wire.protos.foreign.ForeignEnum#ADAPTER" ) public final ForeignEnum no_default_foreign_enum; /** * field with the same name as a Java keyword */ @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "package" ) public final String package_; /** * field with the name "result" */ @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String result; /** * field with the name "other" */ @WireField( tag = 11, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String other; /** * field with the name "o" */ @WireField( tag = 12, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String o; public SimpleMessage(Integer optional_int32, NestedMessage optional_nested_msg, ExternalMessage optional_external_msg, NestedEnum default_nested_enum, Integer required_int32, List<Double> repeated_double, ForeignEnum default_foreign_enum, ForeignEnum no_default_foreign_enum, String package_, String result, String other, String o) { this(optional_int32, optional_nested_msg, optional_external_msg, default_nested_enum, required_int32, repeated_double, default_foreign_enum, no_default_foreign_enum, package_, result, other, o, ByteString.EMPTY); } public SimpleMessage(Integer optional_int32, NestedMessage optional_nested_msg, ExternalMessage optional_external_msg, NestedEnum default_nested_enum, Integer required_int32, List<Double> repeated_double, ForeignEnum default_foreign_enum, ForeignEnum no_default_foreign_enum, String package_, String result, String other, String o, ByteString unknownFields) { super(ADAPTER, unknownFields); this.optional_int32 = optional_int32; this.optional_nested_msg = optional_nested_msg; this.optional_external_msg = optional_external_msg; this.default_nested_enum = default_nested_enum; this.required_int32 = required_int32; this.repeated_double = Internal.immutableCopyOf("repeated_double", repeated_double); this.default_foreign_enum = default_foreign_enum; this.no_default_foreign_enum = no_default_foreign_enum; this.package_ = package_; this.result = result; this.other = other; this.o = o; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.optional_int32 = optional_int32; builder.optional_nested_msg = optional_nested_msg; builder.optional_external_msg = optional_external_msg; builder.default_nested_enum = default_nested_enum; builder.required_int32 = required_int32; builder.repeated_double = Internal.copyOf(repeated_double); builder.default_foreign_enum = default_foreign_enum; builder.no_default_foreign_enum = no_default_foreign_enum; builder.package_ = package_; builder.result = result; builder.other = other; builder.o = o; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other_) { if (other_ == this) return true; if (!(other_ instanceof SimpleMessage)) return false; SimpleMessage o_ = (SimpleMessage) other_; return unknownFields().equals(o_.unknownFields()) && Internal.equals(optional_int32, o_.optional_int32) && Internal.equals(optional_nested_msg, o_.optional_nested_msg) && Internal.equals(optional_external_msg, o_.optional_external_msg) && Internal.equals(default_nested_enum, o_.default_nested_enum) && required_int32.equals(o_.required_int32) && repeated_double.equals(o_.repeated_double) && Internal.equals(default_foreign_enum, o_.default_foreign_enum) && Internal.equals(no_default_foreign_enum, o_.no_default_foreign_enum) && Internal.equals(package_, o_.package_) && Internal.equals(result, o_.result) && Internal.equals(other, o_.other) && Internal.equals(o, o_.o); } @Override public int hashCode() { int result_ = super.hashCode; if (result_ == 0) { result_ = unknownFields().hashCode(); result_ = result_ * 37 + (optional_int32 != null ? optional_int32.hashCode() : 0); result_ = result_ * 37 + (optional_nested_msg != null ? optional_nested_msg.hashCode() : 0); result_ = result_ * 37 + (optional_external_msg != null ? optional_external_msg.hashCode() : 0); result_ = result_ * 37 + (default_nested_enum != null ? default_nested_enum.hashCode() : 0); result_ = result_ * 37 + required_int32.hashCode(); result_ = result_ * 37 + repeated_double.hashCode(); result_ = result_ * 37 + (default_foreign_enum != null ? default_foreign_enum.hashCode() : 0); result_ = result_ * 37 + (no_default_foreign_enum != null ? no_default_foreign_enum.hashCode() : 0); result_ = result_ * 37 + (package_ != null ? package_.hashCode() : 0); result_ = result_ * 37 + (result != null ? result.hashCode() : 0); result_ = result_ * 37 + (other != null ? other.hashCode() : 0); result_ = result_ * 37 + (o != null ? o.hashCode() : 0); super.hashCode = result_; } return result_; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (optional_int32 != null) builder.append(", optional_int32=").append(optional_int32); if (optional_nested_msg != null) builder.append(", optional_nested_msg=").append(optional_nested_msg); if (optional_external_msg != null) builder.append(", optional_external_msg=").append(optional_external_msg); if (default_nested_enum != null) builder.append(", default_nested_enum=").append(default_nested_enum); builder.append(", required_int32=").append(required_int32); if (!repeated_double.isEmpty()) builder.append(", repeated_double=").append(repeated_double); if (default_foreign_enum != null) builder.append(", default_foreign_enum=").append(default_foreign_enum); if (no_default_foreign_enum != null) builder.append(", no_default_foreign_enum=").append(no_default_foreign_enum); if (package_ != null) builder.append(", package=").append(Internal.sanitize(package_)); if (result != null) builder.append(", result=").append(Internal.sanitize(result)); if (other != null) builder.append(", other=").append(Internal.sanitize(other)); if (o != null) builder.append(", o=").append(Internal.sanitize(o)); return builder.replace(0, 2, "SimpleMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<SimpleMessage, Builder> { public Integer optional_int32; public NestedMessage optional_nested_msg; public ExternalMessage optional_external_msg; public NestedEnum default_nested_enum; public Integer required_int32; public List<Double> repeated_double; public ForeignEnum default_foreign_enum; public ForeignEnum no_default_foreign_enum; public String package_; public String result; public String other; public String o; public Builder() { repeated_double = Internal.newMutableList(); } /** * An optional int32 */ public Builder optional_int32(Integer optional_int32) { this.optional_int32 = optional_int32; return this; } /** * An optional NestedMessage, deprecated */ @Deprecated public Builder optional_nested_msg(NestedMessage optional_nested_msg) { this.optional_nested_msg = optional_nested_msg; return this; } /** * An optional ExternalMessage */ public Builder optional_external_msg(ExternalMessage optional_external_msg) { this.optional_external_msg = optional_external_msg; return this; } public Builder default_nested_enum(NestedEnum default_nested_enum) { this.default_nested_enum = default_nested_enum; return this; } /** * A required int32 */ public Builder required_int32(Integer required_int32) { this.required_int32 = required_int32; return this; } /** * A repeated double, deprecated */ @Deprecated public Builder repeated_double(List<Double> repeated_double) { Internal.checkElementsNotNull(repeated_double); this.repeated_double = repeated_double; return this; } /** * enum from another package with an explicit default */ public Builder default_foreign_enum(ForeignEnum default_foreign_enum) { this.default_foreign_enum = default_foreign_enum; return this; } /** * enum from another package without an explicit default */ public Builder no_default_foreign_enum(ForeignEnum no_default_foreign_enum) { this.no_default_foreign_enum = no_default_foreign_enum; return this; } /** * field with the same name as a Java keyword */ public Builder package_(String package_) { this.package_ = package_; return this; } /** * field with the name "result" */ public Builder result(String result) { this.result = result; return this; } /** * field with the name "other" */ public Builder other(String other) { this.other = other; return this; } /** * field with the name "o" */ public Builder o(String o) { this.o = o; return this; } @Override public SimpleMessage build() { if (required_int32 == null) { throw Internal.missingRequiredFields(required_int32, "required_int32"); } return new SimpleMessage(optional_int32, optional_nested_msg, optional_external_msg, default_nested_enum, required_int32, repeated_double, default_foreign_enum, no_default_foreign_enum, package_, result, other, o, super.buildUnknownFields()); } } public static final class NestedMessage extends Message<NestedMessage, NestedMessage.Builder> { public static final ProtoAdapter<NestedMessage> ADAPTER = new ProtoAdapter_NestedMessage(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_BB = 0; /** * An optional int32 */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer bb; public NestedMessage(Integer bb) { this(bb, ByteString.EMPTY); } public NestedMessage(Integer bb, ByteString unknownFields) { super(ADAPTER, unknownFields); this.bb = bb; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.bb = bb; 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(bb, o.bb); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (bb != null ? bb.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (bb != null) builder.append(", bb=").append(bb); return builder.replace(0, 2, "NestedMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<NestedMessage, Builder> { public Integer bb; public Builder() { } /** * An optional int32 */ public Builder bb(Integer bb) { this.bb = bb; return this; } @Override public NestedMessage build() { return new NestedMessage(bb, super.buildUnknownFields()); } } private static final class ProtoAdapter_NestedMessage extends ProtoAdapter<NestedMessage> { public ProtoAdapter_NestedMessage() { super(FieldEncoding.LENGTH_DELIMITED, NestedMessage.class, "type.googleapis.com/squareup.protos.simple.SimpleMessage.NestedMessage", Syntax.PROTO_2, null, "simple_message.proto"); } @Override public int encodedSize(NestedMessage value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.bb); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, NestedMessage value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.bb); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, NestedMessage value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.bb); } @Override public NestedMessage 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.bb(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public NestedMessage redact(NestedMessage value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } public enum NestedEnum implements WireEnum { FOO(1), BAR(2), BAZ(3), @Deprecated BUZ(3); public static final ProtoAdapter<NestedEnum> ADAPTER = new ProtoAdapter_NestedEnum(); 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 1: return FOO; case 2: return BAR; case 3: return BAZ; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_NestedEnum extends EnumAdapter<NestedEnum> { ProtoAdapter_NestedEnum() { super(NestedEnum.class, Syntax.PROTO_2, null); } @Override protected NestedEnum fromValue(int value) { return NestedEnum.fromValue(value); } } } private static final class ProtoAdapter_SimpleMessage extends ProtoAdapter<SimpleMessage> { public ProtoAdapter_SimpleMessage() { super(FieldEncoding.LENGTH_DELIMITED, SimpleMessage.class, "type.googleapis.com/squareup.protos.simple.SimpleMessage", Syntax.PROTO_2, null, "simple_message.proto"); } @Override public int encodedSize(SimpleMessage value) { int result_ = 0; result_ += ProtoAdapter.INT32.encodedSizeWithTag(1, value.optional_int32); result_ += NestedMessage.ADAPTER.encodedSizeWithTag(2, value.optional_nested_msg); result_ += ExternalMessage.ADAPTER.encodedSizeWithTag(3, value.optional_external_msg); result_ += NestedEnum.ADAPTER.encodedSizeWithTag(4, value.default_nested_enum); result_ += ProtoAdapter.INT32.encodedSizeWithTag(5, value.required_int32); result_ += ProtoAdapter.DOUBLE.asRepeated().encodedSizeWithTag(6, value.repeated_double); result_ += ForeignEnum.ADAPTER.encodedSizeWithTag(7, value.default_foreign_enum); result_ += ForeignEnum.ADAPTER.encodedSizeWithTag(8, value.no_default_foreign_enum); result_ += ProtoAdapter.STRING.encodedSizeWithTag(9, value.package_); result_ += ProtoAdapter.STRING.encodedSizeWithTag(10, value.result); result_ += ProtoAdapter.STRING.encodedSizeWithTag(11, value.other); result_ += ProtoAdapter.STRING.encodedSizeWithTag(12, value.o); result_ += value.unknownFields().size(); return result_; } @Override public void encode(ProtoWriter writer, SimpleMessage value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.optional_int32); NestedMessage.ADAPTER.encodeWithTag(writer, 2, value.optional_nested_msg); ExternalMessage.ADAPTER.encodeWithTag(writer, 3, value.optional_external_msg); NestedEnum.ADAPTER.encodeWithTag(writer, 4, value.default_nested_enum); ProtoAdapter.INT32.encodeWithTag(writer, 5, value.required_int32); ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 6, value.repeated_double); ForeignEnum.ADAPTER.encodeWithTag(writer, 7, value.default_foreign_enum); ForeignEnum.ADAPTER.encodeWithTag(writer, 8, value.no_default_foreign_enum); ProtoAdapter.STRING.encodeWithTag(writer, 9, value.package_); ProtoAdapter.STRING.encodeWithTag(writer, 10, value.result); ProtoAdapter.STRING.encodeWithTag(writer, 11, value.other); ProtoAdapter.STRING.encodeWithTag(writer, 12, value.o); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, SimpleMessage value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 12, value.o); ProtoAdapter.STRING.encodeWithTag(writer, 11, value.other); ProtoAdapter.STRING.encodeWithTag(writer, 10, value.result); ProtoAdapter.STRING.encodeWithTag(writer, 9, value.package_); ForeignEnum.ADAPTER.encodeWithTag(writer, 8, value.no_default_foreign_enum); ForeignEnum.ADAPTER.encodeWithTag(writer, 7, value.default_foreign_enum); ProtoAdapter.DOUBLE.asRepeated().encodeWithTag(writer, 6, value.repeated_double); ProtoAdapter.INT32.encodeWithTag(writer, 5, value.required_int32); NestedEnum.ADAPTER.encodeWithTag(writer, 4, value.default_nested_enum); ExternalMessage.ADAPTER.encodeWithTag(writer, 3, value.optional_external_msg); NestedMessage.ADAPTER.encodeWithTag(writer, 2, value.optional_nested_msg); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.optional_int32); } @Override public SimpleMessage 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.optional_int32(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.optional_nested_msg(NestedMessage.ADAPTER.decode(reader)); break; case 3: builder.optional_external_msg(ExternalMessage.ADAPTER.decode(reader)); break; case 4: { try { builder.default_nested_enum(NestedEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 5: builder.required_int32(ProtoAdapter.INT32.decode(reader)); break; case 6: builder.repeated_double.add(ProtoAdapter.DOUBLE.decode(reader)); break; case 7: { try { builder.default_foreign_enum(ForeignEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 8: { try { builder.no_default_foreign_enum(ForeignEnum.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 9: builder.package_(ProtoAdapter.STRING.decode(reader)); break; case 10: builder.result(ProtoAdapter.STRING.decode(reader)); break; case 11: builder.other(ProtoAdapter.STRING.decode(reader)); break; case 12: builder.o(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public SimpleMessage redact(SimpleMessage value) { Builder builder = value.newBuilder(); if (builder.optional_nested_msg != null) builder.optional_nested_msg = NestedMessage.ADAPTER.redact(builder.optional_nested_msg); if (builder.optional_external_msg != null) builder.optional_external_msg = ExternalMessage.ADAPTER.redact(builder.optional_external_msg); builder.clearUnknownFields(); return builder.build(); } } }
6,956
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/simple/ExternalMessage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.simple.ExternalMessage in external_message.proto package com.squareup.wire.protos.simple; 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.Float; 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; public final class ExternalMessage extends Message<ExternalMessage, ExternalMessage.Builder> { public static final ProtoAdapter<ExternalMessage> ADAPTER = new ProtoAdapter_ExternalMessage(); private static final long serialVersionUID = 0L; public static final Float DEFAULT_F = 20f; public static final Integer DEFAULT_BAREXT = 0; public static final Integer DEFAULT_BAZEXT = 0; public static final SimpleMessage.NestedEnum DEFAULT_NESTED_ENUM_EXT = SimpleMessage.NestedEnum.FOO; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float f; /** * Extension source: simple_message.proto */ @WireField( tag = 125, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REPEATED ) public final List<Integer> fooext; /** * Extension source: simple_message.proto */ @WireField( tag = 126, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer barext; /** * Extension source: simple_message.proto */ @WireField( tag = 127, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer bazext; /** * Extension source: simple_message.proto */ @WireField( tag = 128, adapter = "com.squareup.wire.protos.simple.SimpleMessage$NestedMessage#ADAPTER" ) public final SimpleMessage.NestedMessage nested_message_ext; /** * Extension source: simple_message.proto */ @WireField( tag = 129, adapter = "com.squareup.wire.protos.simple.SimpleMessage$NestedEnum#ADAPTER" ) public final SimpleMessage.NestedEnum nested_enum_ext; public ExternalMessage(Float f, List<Integer> fooext, Integer barext, Integer bazext, SimpleMessage.NestedMessage nested_message_ext, SimpleMessage.NestedEnum nested_enum_ext) { this(f, fooext, barext, bazext, nested_message_ext, nested_enum_ext, ByteString.EMPTY); } public ExternalMessage(Float f, List<Integer> fooext, Integer barext, Integer bazext, SimpleMessage.NestedMessage nested_message_ext, SimpleMessage.NestedEnum nested_enum_ext, ByteString unknownFields) { super(ADAPTER, unknownFields); this.f = f; this.fooext = Internal.immutableCopyOf("fooext", fooext); this.barext = barext; this.bazext = bazext; this.nested_message_ext = nested_message_ext; this.nested_enum_ext = nested_enum_ext; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.f = f; builder.fooext = Internal.copyOf(fooext); builder.barext = barext; builder.bazext = bazext; builder.nested_message_ext = nested_message_ext; builder.nested_enum_ext = nested_enum_ext; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof ExternalMessage)) return false; ExternalMessage o = (ExternalMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(f, o.f) && fooext.equals(o.fooext) && Internal.equals(barext, o.barext) && Internal.equals(bazext, o.bazext) && Internal.equals(nested_message_ext, o.nested_message_ext) && Internal.equals(nested_enum_ext, o.nested_enum_ext); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (f != null ? f.hashCode() : 0); result = result * 37 + fooext.hashCode(); result = result * 37 + (barext != null ? barext.hashCode() : 0); result = result * 37 + (bazext != null ? bazext.hashCode() : 0); result = result * 37 + (nested_message_ext != null ? nested_message_ext.hashCode() : 0); result = result * 37 + (nested_enum_ext != null ? nested_enum_ext.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (f != null) builder.append(", f=").append(f); if (!fooext.isEmpty()) builder.append(", fooext=").append(fooext); if (barext != null) builder.append(", barext=").append(barext); if (bazext != null) builder.append(", bazext=").append(bazext); if (nested_message_ext != null) builder.append(", nested_message_ext=").append(nested_message_ext); if (nested_enum_ext != null) builder.append(", nested_enum_ext=").append(nested_enum_ext); return builder.replace(0, 2, "ExternalMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<ExternalMessage, Builder> { public Float f; public List<Integer> fooext; public Integer barext; public Integer bazext; public SimpleMessage.NestedMessage nested_message_ext; public SimpleMessage.NestedEnum nested_enum_ext; public Builder() { fooext = Internal.newMutableList(); } public Builder f(Float f) { this.f = f; return this; } public Builder fooext(List<Integer> fooext) { Internal.checkElementsNotNull(fooext); this.fooext = fooext; return this; } public Builder barext(Integer barext) { this.barext = barext; return this; } public Builder bazext(Integer bazext) { this.bazext = bazext; return this; } public Builder nested_message_ext(SimpleMessage.NestedMessage nested_message_ext) { this.nested_message_ext = nested_message_ext; return this; } public Builder nested_enum_ext(SimpleMessage.NestedEnum nested_enum_ext) { this.nested_enum_ext = nested_enum_ext; return this; } @Override public ExternalMessage build() { return new ExternalMessage(f, fooext, barext, bazext, nested_message_ext, nested_enum_ext, super.buildUnknownFields()); } } private static final class ProtoAdapter_ExternalMessage extends ProtoAdapter<ExternalMessage> { public ProtoAdapter_ExternalMessage() { super(FieldEncoding.LENGTH_DELIMITED, ExternalMessage.class, "type.googleapis.com/squareup.protos.simple.ExternalMessage", Syntax.PROTO_2, null, "external_message.proto"); } @Override public int encodedSize(ExternalMessage value) { int result = 0; result += ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.f); result += ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(125, value.fooext); result += ProtoAdapter.INT32.encodedSizeWithTag(126, value.barext); result += ProtoAdapter.INT32.encodedSizeWithTag(127, value.bazext); result += SimpleMessage.NestedMessage.ADAPTER.encodedSizeWithTag(128, value.nested_message_ext); result += SimpleMessage.NestedEnum.ADAPTER.encodedSizeWithTag(129, value.nested_enum_ext); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, ExternalMessage value) throws IOException { ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.f); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 125, value.fooext); ProtoAdapter.INT32.encodeWithTag(writer, 126, value.barext); ProtoAdapter.INT32.encodeWithTag(writer, 127, value.bazext); SimpleMessage.NestedMessage.ADAPTER.encodeWithTag(writer, 128, value.nested_message_ext); SimpleMessage.NestedEnum.ADAPTER.encodeWithTag(writer, 129, value.nested_enum_ext); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, ExternalMessage value) throws IOException { writer.writeBytes(value.unknownFields()); SimpleMessage.NestedEnum.ADAPTER.encodeWithTag(writer, 129, value.nested_enum_ext); SimpleMessage.NestedMessage.ADAPTER.encodeWithTag(writer, 128, value.nested_message_ext); ProtoAdapter.INT32.encodeWithTag(writer, 127, value.bazext); ProtoAdapter.INT32.encodeWithTag(writer, 126, value.barext); ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 125, value.fooext); ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.f); } @Override public ExternalMessage 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.f(ProtoAdapter.FLOAT.decode(reader)); break; case 125: builder.fooext.add(ProtoAdapter.INT32.decode(reader)); break; case 126: builder.barext(ProtoAdapter.INT32.decode(reader)); break; case 127: builder.bazext(ProtoAdapter.INT32.decode(reader)); break; case 128: builder.nested_message_ext(SimpleMessage.NestedMessage.ADAPTER.decode(reader)); break; case 129: { try { builder.nested_enum_ext(SimpleMessage.NestedEnum.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 ExternalMessage redact(ExternalMessage value) { Builder builder = value.newBuilder(); if (builder.nested_message_ext != null) builder.nested_message_ext = SimpleMessage.NestedMessage.ADAPTER.redact(builder.nested_message_ext); builder.clearUnknownFields(); return builder.build(); } } }
6,957
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/edgecases/OneField.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.edgecases.OneField in edge_cases.proto package com.squareup.wire.protos.edgecases; 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 okio.ByteString; public final class OneField extends Message<OneField, OneField.Builder> { public static final ProtoAdapter<OneField> ADAPTER = new ProtoAdapter_OneField(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_OPT_INT32 = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer opt_int32; public OneField(Integer opt_int32) { this(opt_int32, ByteString.EMPTY); } public OneField(Integer opt_int32, ByteString unknownFields) { super(ADAPTER, unknownFields); this.opt_int32 = opt_int32; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.opt_int32 = opt_int32; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof OneField)) return false; OneField o = (OneField) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(opt_int32, o.opt_int32); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (opt_int32 != null ? opt_int32.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (opt_int32 != null) builder.append(", opt_int32=").append(opt_int32); return builder.replace(0, 2, "OneField{").append('}').toString(); } public static final class Builder extends Message.Builder<OneField, Builder> { public Integer opt_int32; public Builder() { } public Builder opt_int32(Integer opt_int32) { this.opt_int32 = opt_int32; return this; } @Override public OneField build() { return new OneField(opt_int32, super.buildUnknownFields()); } } private static final class ProtoAdapter_OneField extends ProtoAdapter<OneField> { public ProtoAdapter_OneField() { super(FieldEncoding.LENGTH_DELIMITED, OneField.class, "type.googleapis.com/squareup.protos.edgecases.OneField", Syntax.PROTO_2, null, "edge_cases.proto"); } @Override public int encodedSize(OneField value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.opt_int32); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, OneField value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.opt_int32); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, OneField value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.opt_int32); } @Override public OneField 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.opt_int32(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public OneField redact(OneField value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,958
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/edgecases/NoFields.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.edgecases.NoFields in edge_cases.proto package com.squareup.wire.protos.edgecases; 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 java.io.IOException; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class NoFields extends Message<NoFields, NoFields.Builder> { public static final ProtoAdapter<NoFields> ADAPTER = new ProtoAdapter_NoFields(); private static final long serialVersionUID = 0L; public NoFields() { this(ByteString.EMPTY); } public NoFields(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NoFields)) return false; NoFields o = (NoFields) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "NoFields{").append('}').toString(); } public static final class Builder extends Message.Builder<NoFields, Builder> { public Builder() { } @Override public NoFields build() { return new NoFields(super.buildUnknownFields()); } } private static final class ProtoAdapter_NoFields extends ProtoAdapter<NoFields> { public ProtoAdapter_NoFields() { super(FieldEncoding.LENGTH_DELIMITED, NoFields.class, "type.googleapis.com/squareup.protos.edgecases.NoFields", Syntax.PROTO_2, null, "edge_cases.proto"); } @Override public int encodedSize(NoFields value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, NoFields value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, NoFields value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public NoFields decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public NoFields redact(NoFields value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,959
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/edgecases/OneBytesField.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.edgecases.OneBytesField in edge_cases.proto package com.squareup.wire.protos.edgecases; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class OneBytesField extends Message<OneBytesField, OneBytesField.Builder> { public static final ProtoAdapter<OneBytesField> ADAPTER = new ProtoAdapter_OneBytesField(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_OPT_BYTES = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString opt_bytes; public OneBytesField(ByteString opt_bytes) { this(opt_bytes, ByteString.EMPTY); } public OneBytesField(ByteString opt_bytes, ByteString unknownFields) { super(ADAPTER, unknownFields); this.opt_bytes = opt_bytes; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.opt_bytes = opt_bytes; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof OneBytesField)) return false; OneBytesField o = (OneBytesField) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(opt_bytes, o.opt_bytes); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (opt_bytes != null ? opt_bytes.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (opt_bytes != null) builder.append(", opt_bytes=").append(opt_bytes); return builder.replace(0, 2, "OneBytesField{").append('}').toString(); } public static final class Builder extends Message.Builder<OneBytesField, Builder> { public ByteString opt_bytes; public Builder() { } public Builder opt_bytes(ByteString opt_bytes) { this.opt_bytes = opt_bytes; return this; } @Override public OneBytesField build() { return new OneBytesField(opt_bytes, super.buildUnknownFields()); } } private static final class ProtoAdapter_OneBytesField extends ProtoAdapter<OneBytesField> { public ProtoAdapter_OneBytesField() { super(FieldEncoding.LENGTH_DELIMITED, OneBytesField.class, "type.googleapis.com/squareup.protos.edgecases.OneBytesField", Syntax.PROTO_2, null, "edge_cases.proto"); } @Override public int encodedSize(OneBytesField value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.opt_bytes); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, OneBytesField value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.opt_bytes); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, OneBytesField value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.opt_bytes); } @Override public OneBytesField 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.opt_bytes(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public OneBytesField redact(OneBytesField value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,960
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/edgecases/Recursive.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.edgecases.Recursive in edge_cases.proto package com.squareup.wire.protos.edgecases; 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 okio.ByteString; public final class Recursive extends Message<Recursive, Recursive.Builder> { public static final ProtoAdapter<Recursive> ADAPTER = new ProtoAdapter_Recursive(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_VALUE = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer value; @WireField( tag = 2, adapter = "com.squareup.wire.protos.edgecases.Recursive#ADAPTER" ) public final Recursive recursive; public Recursive(Integer value, Recursive recursive) { this(value, recursive, ByteString.EMPTY); } public Recursive(Integer value, Recursive recursive, ByteString unknownFields) { super(ADAPTER, unknownFields); this.value = value; this.recursive = recursive; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.value = value; builder.recursive = recursive; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Recursive)) return false; Recursive o = (Recursive) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(value, o.value) && Internal.equals(recursive, o.recursive); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (value != null ? value.hashCode() : 0); result = result * 37 + (recursive != null ? recursive.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (value != null) builder.append(", value=").append(value); if (recursive != null) builder.append(", recursive=").append(recursive); return builder.replace(0, 2, "Recursive{").append('}').toString(); } public static final class Builder extends Message.Builder<Recursive, Builder> { public Integer value; public Recursive recursive; public Builder() { } public Builder value(Integer value) { this.value = value; return this; } public Builder recursive(Recursive recursive) { this.recursive = recursive; return this; } @Override public Recursive build() { return new Recursive(value, recursive, super.buildUnknownFields()); } } private static final class ProtoAdapter_Recursive extends ProtoAdapter<Recursive> { public ProtoAdapter_Recursive() { super(FieldEncoding.LENGTH_DELIMITED, Recursive.class, "type.googleapis.com/squareup.protos.edgecases.Recursive", Syntax.PROTO_2, null, "edge_cases.proto"); } @Override public int encodedSize(Recursive value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.value); result += Recursive.ADAPTER.encodedSizeWithTag(2, value.recursive); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Recursive value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.value); Recursive.ADAPTER.encodeWithTag(writer, 2, value.recursive); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Recursive value) throws IOException { writer.writeBytes(value.unknownFields()); Recursive.ADAPTER.encodeWithTag(writer, 2, value.recursive); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.value); } @Override public Recursive 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.value(ProtoAdapter.INT32.decode(reader)); break; case 2: builder.recursive(Recursive.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Recursive redact(Recursive value) { Builder builder = value.newBuilder(); if (builder.recursive != null) builder.recursive = Recursive.ADAPTER.redact(builder.recursive); builder.clearUnknownFields(); return builder.build(); } } }
6,961
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/single_level/Foos.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: single_level.Foos in single_level.proto package com.squareup.wire.protos.single_level; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import okio.ByteString; public final class Foos extends Message<Foos, Foos.Builder> { public static final ProtoAdapter<Foos> ADAPTER = new ProtoAdapter_Foos(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.single_level.Foo#ADAPTER", label = WireField.Label.REPEATED ) public final List<Foo> foos; public Foos(List<Foo> foos) { this(foos, ByteString.EMPTY); } public Foos(List<Foo> foos, ByteString unknownFields) { super(ADAPTER, unknownFields); this.foos = Internal.immutableCopyOf("foos", foos); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.foos = Internal.copyOf(foos); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Foos)) return false; Foos o = (Foos) other; return unknownFields().equals(o.unknownFields()) && foos.equals(o.foos); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + foos.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!foos.isEmpty()) builder.append(", foos=").append(foos); return builder.replace(0, 2, "Foos{").append('}').toString(); } public static final class Builder extends Message.Builder<Foos, Builder> { public List<Foo> foos; public Builder() { foos = Internal.newMutableList(); } public Builder foos(List<Foo> foos) { Internal.checkElementsNotNull(foos); this.foos = foos; return this; } @Override public Foos build() { return new Foos(foos, super.buildUnknownFields()); } } private static final class ProtoAdapter_Foos extends ProtoAdapter<Foos> { public ProtoAdapter_Foos() { super(FieldEncoding.LENGTH_DELIMITED, Foos.class, "type.googleapis.com/single_level.Foos", Syntax.PROTO_2, null, "single_level.proto"); } @Override public int encodedSize(Foos value) { int result = 0; result += Foo.ADAPTER.asRepeated().encodedSizeWithTag(1, value.foos); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Foos value) throws IOException { Foo.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.foos); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Foos value) throws IOException { writer.writeBytes(value.unknownFields()); Foo.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.foos); } @Override public Foos 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.foos.add(Foo.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Foos redact(Foos value) { Builder builder = value.newBuilder(); Internal.redactElements(builder.foos, Foo.ADAPTER); builder.clearUnknownFields(); return builder.build(); } } }
6,962
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/single_level/Bar.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: samebasename.single_level.Bar in samebasename/single_level.proto package com.squareup.wire.protos.single_level; 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 okio.ByteString; public final class Bar extends Message<Bar, Bar.Builder> { public static final ProtoAdapter<Bar> ADAPTER = new ProtoAdapter_Bar(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_BAZ = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer baz; public Bar(Integer baz) { this(baz, ByteString.EMPTY); } public Bar(Integer baz, ByteString unknownFields) { super(ADAPTER, unknownFields); this.baz = baz; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.baz = baz; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Bar)) return false; Bar o = (Bar) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(baz, o.baz); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (baz != null ? baz.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (baz != null) builder.append(", baz=").append(baz); return builder.replace(0, 2, "Bar{").append('}').toString(); } public static final class Builder extends Message.Builder<Bar, Builder> { public Integer baz; public Builder() { } public Builder baz(Integer baz) { this.baz = baz; return this; } @Override public Bar build() { return new Bar(baz, super.buildUnknownFields()); } } private static final class ProtoAdapter_Bar extends ProtoAdapter<Bar> { public ProtoAdapter_Bar() { super(FieldEncoding.LENGTH_DELIMITED, Bar.class, "type.googleapis.com/samebasename.single_level.Bar", Syntax.PROTO_2, null, "samebasename/single_level.proto"); } @Override public int encodedSize(Bar value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.baz); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Bar value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.baz); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Bar value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.baz); } @Override public Bar 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.baz(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Bar redact(Bar value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,963
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/single_level/Foo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: single_level.Foo in single_level.proto package com.squareup.wire.protos.single_level; 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 okio.ByteString; public final class Foo extends Message<Foo, Foo.Builder> { public static final ProtoAdapter<Foo> ADAPTER = new ProtoAdapter_Foo(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_BAR = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer bar; public Foo(Integer bar) { this(bar, ByteString.EMPTY); } public Foo(Integer bar, ByteString unknownFields) { super(ADAPTER, unknownFields); this.bar = bar; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.bar = bar; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Foo)) return false; Foo o = (Foo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(bar, o.bar); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (bar != null ? bar.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (bar != null) builder.append(", bar=").append(bar); return builder.replace(0, 2, "Foo{").append('}').toString(); } public static final class Builder extends Message.Builder<Foo, Builder> { public Integer bar; public Builder() { } public Builder bar(Integer bar) { this.bar = bar; return this; } @Override public Foo build() { return new Foo(bar, super.buildUnknownFields()); } } private static final class ProtoAdapter_Foo extends ProtoAdapter<Foo> { public ProtoAdapter_Foo() { super(FieldEncoding.LENGTH_DELIMITED, Foo.class, "type.googleapis.com/single_level.Foo", Syntax.PROTO_2, null, "single_level.proto"); } @Override public int encodedSize(Foo value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.bar); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Foo value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.bar); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Foo value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.bar); } @Override public Foo 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.bar(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Foo redact(Foo value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,964
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/single_level/Bars.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: samebasename.single_level.Bars in samebasename/single_level.proto package com.squareup.wire.protos.single_level; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.List; import okio.ByteString; public final class Bars extends Message<Bars, Bars.Builder> { public static final ProtoAdapter<Bars> ADAPTER = new ProtoAdapter_Bars(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.single_level.Bar#ADAPTER", label = WireField.Label.REPEATED ) public final List<Bar> bars; public Bars(List<Bar> bars) { this(bars, ByteString.EMPTY); } public Bars(List<Bar> bars, ByteString unknownFields) { super(ADAPTER, unknownFields); this.bars = Internal.immutableCopyOf("bars", bars); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.bars = Internal.copyOf(bars); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Bars)) return false; Bars o = (Bars) other; return unknownFields().equals(o.unknownFields()) && bars.equals(o.bars); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + bars.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!bars.isEmpty()) builder.append(", bars=").append(bars); return builder.replace(0, 2, "Bars{").append('}').toString(); } public static final class Builder extends Message.Builder<Bars, Builder> { public List<Bar> bars; public Builder() { bars = Internal.newMutableList(); } public Builder bars(List<Bar> bars) { Internal.checkElementsNotNull(bars); this.bars = bars; return this; } @Override public Bars build() { return new Bars(bars, super.buildUnknownFields()); } } private static final class ProtoAdapter_Bars extends ProtoAdapter<Bars> { public ProtoAdapter_Bars() { super(FieldEncoding.LENGTH_DELIMITED, Bars.class, "type.googleapis.com/samebasename.single_level.Bars", Syntax.PROTO_2, null, "samebasename/single_level.proto"); } @Override public int encodedSize(Bars value) { int result = 0; result += Bar.ADAPTER.asRepeated().encodedSizeWithTag(1, value.bars); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Bars value) throws IOException { Bar.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.bars); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Bars value) throws IOException { writer.writeBytes(value.unknownFields()); Bar.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.bars); } @Override public Bars 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.bars.add(Bar.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Bars redact(Bars value) { Builder builder = value.newBuilder(); Internal.redactElements(builder.bars, Bar.ADAPTER); builder.clearUnknownFields(); return builder.build(); } } }
6,965
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedFields.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedFields in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class RedactedFields extends Message<RedactedFields, RedactedFields.Builder> { public static final ProtoAdapter<RedactedFields> ADAPTER = new ProtoAdapter_RedactedFields(); private static final long serialVersionUID = 0L; public static final String DEFAULT_A = ""; public static final String DEFAULT_B = ""; public static final String DEFAULT_C = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", redacted = true ) public final String a; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String b; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String c; /** * Extension source: redacted_test.proto */ @WireField( tag = 10, adapter = "com.squareup.wire.protos.redacted.RedactedExtension#ADAPTER" ) public final RedactedExtension extension; public RedactedFields(String a, String b, String c, RedactedExtension extension) { this(a, b, c, extension, ByteString.EMPTY); } public RedactedFields(String a, String b, String c, RedactedExtension extension, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; this.b = b; this.c = c; this.extension = extension; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.b = b; builder.c = c; builder.extension = extension; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedFields)) return false; RedactedFields o = (RedactedFields) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a) && Internal.equals(b, o.b) && Internal.equals(c, o.c) && Internal.equals(extension, o.extension); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (a != null ? a.hashCode() : 0); result = result * 37 + (b != null ? b.hashCode() : 0); result = result * 37 + (c != null ? c.hashCode() : 0); result = result * 37 + (extension != null ? extension.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (a != null) builder.append(", a=██"); if (b != null) builder.append(", b=").append(Internal.sanitize(b)); if (c != null) builder.append(", c=").append(Internal.sanitize(c)); if (extension != null) builder.append(", extension=").append(extension); return builder.replace(0, 2, "RedactedFields{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedFields, Builder> { public String a; public String b; public String c; public RedactedExtension extension; public Builder() { } public Builder a(String a) { this.a = a; return this; } public Builder b(String b) { this.b = b; return this; } public Builder c(String c) { this.c = c; return this; } public Builder extension(RedactedExtension extension) { this.extension = extension; return this; } @Override public RedactedFields build() { return new RedactedFields(a, b, c, extension, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedFields extends ProtoAdapter<RedactedFields> { public ProtoAdapter_RedactedFields() { super(FieldEncoding.LENGTH_DELIMITED, RedactedFields.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedFields", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedFields value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.a); result += ProtoAdapter.STRING.encodedSizeWithTag(2, value.b); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.c); result += RedactedExtension.ADAPTER.encodedSizeWithTag(10, value.extension); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedFields value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.b); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.c); RedactedExtension.ADAPTER.encodeWithTag(writer, 10, value.extension); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedFields value) throws IOException { writer.writeBytes(value.unknownFields()); RedactedExtension.ADAPTER.encodeWithTag(writer, 10, value.extension); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.c); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.b); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); } @Override public RedactedFields 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.a(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.b(ProtoAdapter.STRING.decode(reader)); break; case 3: builder.c(ProtoAdapter.STRING.decode(reader)); break; case 10: builder.extension(RedactedExtension.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedFields redact(RedactedFields value) { Builder builder = value.newBuilder(); builder.a = null; if (builder.extension != null) builder.extension = RedactedExtension.ADAPTER.redact(builder.extension); builder.clearUnknownFields(); return builder.build(); } } }
6,966
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedExtension.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedExtension in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class RedactedExtension extends Message<RedactedExtension, RedactedExtension.Builder> { public static final ProtoAdapter<RedactedExtension> ADAPTER = new ProtoAdapter_RedactedExtension(); private static final long serialVersionUID = 0L; public static final String DEFAULT_D = ""; public static final String DEFAULT_E = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", redacted = true ) public final String d; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String e; public RedactedExtension(String d, String e) { this(d, e, ByteString.EMPTY); } public RedactedExtension(String d, String e, ByteString unknownFields) { super(ADAPTER, unknownFields); this.d = d; this.e = e; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.d = d; builder.e = e; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedExtension)) return false; RedactedExtension o = (RedactedExtension) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(d, o.d) && Internal.equals(e, o.e); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (d != null ? d.hashCode() : 0); result = result * 37 + (e != null ? e.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (d != null) builder.append(", d=██"); if (e != null) builder.append(", e=").append(Internal.sanitize(e)); return builder.replace(0, 2, "RedactedExtension{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedExtension, Builder> { public String d; public String e; public Builder() { } public Builder d(String d) { this.d = d; return this; } public Builder e(String e) { this.e = e; return this; } @Override public RedactedExtension build() { return new RedactedExtension(d, e, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedExtension extends ProtoAdapter<RedactedExtension> { public ProtoAdapter_RedactedExtension() { super(FieldEncoding.LENGTH_DELIMITED, RedactedExtension.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedExtension", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedExtension value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.d); result += ProtoAdapter.STRING.encodedSizeWithTag(2, value.e); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedExtension value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.d); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.e); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedExtension value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.e); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.d); } @Override public RedactedExtension 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.d(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.e(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedExtension redact(RedactedExtension value) { Builder builder = value.newBuilder(); builder.d = null; builder.clearUnknownFields(); return builder.build(); } } }
6,967
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedChild.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedChild in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class RedactedChild extends Message<RedactedChild, RedactedChild.Builder> { public static final ProtoAdapter<RedactedChild> ADAPTER = new ProtoAdapter_RedactedChild(); private static final long serialVersionUID = 0L; public static final String DEFAULT_A = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String a; @WireField( tag = 2, adapter = "com.squareup.wire.protos.redacted.RedactedFields#ADAPTER" ) public final RedactedFields b; @WireField( tag = 3, adapter = "com.squareup.wire.protos.redacted.NotRedacted#ADAPTER" ) public final NotRedacted c; public RedactedChild(String a, RedactedFields b, NotRedacted c) { this(a, b, c, ByteString.EMPTY); } public RedactedChild(String a, RedactedFields b, NotRedacted c, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; this.b = b; this.c = c; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.b = b; builder.c = c; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedChild)) return false; RedactedChild o = (RedactedChild) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a) && Internal.equals(b, o.b) && Internal.equals(c, o.c); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (a != null ? a.hashCode() : 0); result = result * 37 + (b != null ? b.hashCode() : 0); result = result * 37 + (c != null ? c.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (a != null) builder.append(", a=").append(Internal.sanitize(a)); if (b != null) builder.append(", b=").append(b); if (c != null) builder.append(", c=").append(c); return builder.replace(0, 2, "RedactedChild{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedChild, Builder> { public String a; public RedactedFields b; public NotRedacted c; public Builder() { } public Builder a(String a) { this.a = a; return this; } public Builder b(RedactedFields b) { this.b = b; return this; } public Builder c(NotRedacted c) { this.c = c; return this; } @Override public RedactedChild build() { return new RedactedChild(a, b, c, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedChild extends ProtoAdapter<RedactedChild> { public ProtoAdapter_RedactedChild() { super(FieldEncoding.LENGTH_DELIMITED, RedactedChild.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedChild", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedChild value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.a); result += RedactedFields.ADAPTER.encodedSizeWithTag(2, value.b); result += NotRedacted.ADAPTER.encodedSizeWithTag(3, value.c); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedChild value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); RedactedFields.ADAPTER.encodeWithTag(writer, 2, value.b); NotRedacted.ADAPTER.encodeWithTag(writer, 3, value.c); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedChild value) throws IOException { writer.writeBytes(value.unknownFields()); NotRedacted.ADAPTER.encodeWithTag(writer, 3, value.c); RedactedFields.ADAPTER.encodeWithTag(writer, 2, value.b); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); } @Override public RedactedChild 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.a(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.b(RedactedFields.ADAPTER.decode(reader)); break; case 3: builder.c(NotRedacted.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedChild redact(RedactedChild value) { Builder builder = value.newBuilder(); if (builder.b != null) builder.b = RedactedFields.ADAPTER.redact(builder.b); if (builder.c != null) builder.c = NotRedacted.ADAPTER.redact(builder.c); builder.clearUnknownFields(); return builder.build(); } } }
6,968
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedRequired.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedRequired in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.lang.UnsupportedOperationException; import okio.ByteString; public final class RedactedRequired extends Message<RedactedRequired, RedactedRequired.Builder> { public static final ProtoAdapter<RedactedRequired> ADAPTER = new ProtoAdapter_RedactedRequired(); private static final long serialVersionUID = 0L; public static final String DEFAULT_A = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED, redacted = true ) public final String a; public RedactedRequired(String a) { this(a, ByteString.EMPTY); } public RedactedRequired(String 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 RedactedRequired)) return false; RedactedRequired o = (RedactedRequired) other; return unknownFields().equals(o.unknownFields()) && a.equals(o.a); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + a.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(", a=██"); return builder.replace(0, 2, "RedactedRequired{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedRequired, Builder> { public String a; public Builder() { } public Builder a(String a) { this.a = a; return this; } @Override public RedactedRequired build() { if (a == null) { throw Internal.missingRequiredFields(a, "a"); } return new RedactedRequired(a, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedRequired extends ProtoAdapter<RedactedRequired> { public ProtoAdapter_RedactedRequired() { super(FieldEncoding.LENGTH_DELIMITED, RedactedRequired.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedRequired", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedRequired value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.a); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedRequired value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedRequired value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); } @Override public RedactedRequired 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.a(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedRequired redact(RedactedRequired value) { throw new UnsupportedOperationException("Field 'a' is required and cannot be redacted."); } } }
6,969
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedCycleB.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedCycleB in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class RedactedCycleB extends Message<RedactedCycleB, RedactedCycleB.Builder> { public static final ProtoAdapter<RedactedCycleB> ADAPTER = new ProtoAdapter_RedactedCycleB(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.redacted.RedactedCycleA#ADAPTER" ) public final RedactedCycleA a; public RedactedCycleB(RedactedCycleA a) { this(a, ByteString.EMPTY); } public RedactedCycleB(RedactedCycleA 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 RedactedCycleB)) return false; RedactedCycleB o = (RedactedCycleB) 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; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (a != null) builder.append(", a=").append(a); return builder.replace(0, 2, "RedactedCycleB{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedCycleB, Builder> { public RedactedCycleA a; public Builder() { } public Builder a(RedactedCycleA a) { this.a = a; return this; } @Override public RedactedCycleB build() { return new RedactedCycleB(a, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedCycleB extends ProtoAdapter<RedactedCycleB> { public ProtoAdapter_RedactedCycleB() { super(FieldEncoding.LENGTH_DELIMITED, RedactedCycleB.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedCycleB", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedCycleB value) { int result = 0; result += RedactedCycleA.ADAPTER.encodedSizeWithTag(1, value.a); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedCycleB value) throws IOException { RedactedCycleA.ADAPTER.encodeWithTag(writer, 1, value.a); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedCycleB value) throws IOException { writer.writeBytes(value.unknownFields()); RedactedCycleA.ADAPTER.encodeWithTag(writer, 1, value.a); } @Override public RedactedCycleB 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.a(RedactedCycleA.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedCycleB redact(RedactedCycleB value) { Builder builder = value.newBuilder(); if (builder.a != null) builder.a = RedactedCycleA.ADAPTER.redact(builder.a); builder.clearUnknownFields(); return builder.build(); } } }
6,970
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedCycleA.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedCycleA in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class RedactedCycleA extends Message<RedactedCycleA, RedactedCycleA.Builder> { public static final ProtoAdapter<RedactedCycleA> ADAPTER = new ProtoAdapter_RedactedCycleA(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.protos.redacted.RedactedCycleB#ADAPTER" ) public final RedactedCycleB b; public RedactedCycleA(RedactedCycleB b) { this(b, ByteString.EMPTY); } public RedactedCycleA(RedactedCycleB b, ByteString unknownFields) { super(ADAPTER, unknownFields); this.b = b; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.b = b; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedCycleA)) return false; RedactedCycleA o = (RedactedCycleA) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(b, o.b); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (b != null ? b.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (b != null) builder.append(", b=").append(b); return builder.replace(0, 2, "RedactedCycleA{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedCycleA, Builder> { public RedactedCycleB b; public Builder() { } public Builder b(RedactedCycleB b) { this.b = b; return this; } @Override public RedactedCycleA build() { return new RedactedCycleA(b, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedCycleA extends ProtoAdapter<RedactedCycleA> { public ProtoAdapter_RedactedCycleA() { super(FieldEncoding.LENGTH_DELIMITED, RedactedCycleA.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedCycleA", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedCycleA value) { int result = 0; result += RedactedCycleB.ADAPTER.encodedSizeWithTag(1, value.b); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedCycleA value) throws IOException { RedactedCycleB.ADAPTER.encodeWithTag(writer, 1, value.b); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedCycleA value) throws IOException { writer.writeBytes(value.unknownFields()); RedactedCycleB.ADAPTER.encodeWithTag(writer, 1, value.b); } @Override public RedactedCycleA 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.b(RedactedCycleB.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedCycleA redact(RedactedCycleA value) { Builder builder = value.newBuilder(); if (builder.b != null) builder.b = RedactedCycleB.ADAPTER.redact(builder.b); builder.clearUnknownFields(); return builder.build(); } } }
6,971
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/RedactedRepeated.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.RedactedRepeated in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.Collections; import java.util.List; import okio.ByteString; public final class RedactedRepeated extends Message<RedactedRepeated, RedactedRepeated.Builder> { public static final ProtoAdapter<RedactedRepeated> ADAPTER = new ProtoAdapter_RedactedRepeated(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED, redacted = true ) public final List<String> a; /** * Values in the repeated type need redacting. */ @WireField( tag = 2, adapter = "com.squareup.wire.protos.redacted.RedactedFields#ADAPTER", label = WireField.Label.REPEATED ) public final List<RedactedFields> b; public RedactedRepeated(List<String> a, List<RedactedFields> b) { this(a, b, ByteString.EMPTY); } public RedactedRepeated(List<String> a, List<RedactedFields> b, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = Internal.immutableCopyOf("a", a); this.b = Internal.immutableCopyOf("b", b); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = Internal.copyOf(a); builder.b = Internal.copyOf(b); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof RedactedRepeated)) return false; RedactedRepeated o = (RedactedRepeated) other; return unknownFields().equals(o.unknownFields()) && a.equals(o.a) && b.equals(o.b); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + a.hashCode(); result = result * 37 + b.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!a.isEmpty()) builder.append(", a=██"); if (!b.isEmpty()) builder.append(", b=").append(b); return builder.replace(0, 2, "RedactedRepeated{").append('}').toString(); } public static final class Builder extends Message.Builder<RedactedRepeated, Builder> { public List<String> a; public List<RedactedFields> b; public Builder() { a = Internal.newMutableList(); b = Internal.newMutableList(); } public Builder a(List<String> a) { Internal.checkElementsNotNull(a); this.a = a; return this; } /** * Values in the repeated type need redacting. */ public Builder b(List<RedactedFields> b) { Internal.checkElementsNotNull(b); this.b = b; return this; } @Override public RedactedRepeated build() { return new RedactedRepeated(a, b, super.buildUnknownFields()); } } private static final class ProtoAdapter_RedactedRepeated extends ProtoAdapter<RedactedRepeated> { public ProtoAdapter_RedactedRepeated() { super(FieldEncoding.LENGTH_DELIMITED, RedactedRepeated.class, "type.googleapis.com/squareup.protos.redacted_test.RedactedRepeated", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(RedactedRepeated value) { int result = 0; result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(1, value.a); result += RedactedFields.ADAPTER.asRepeated().encodedSizeWithTag(2, value.b); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, RedactedRepeated value) throws IOException { ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 1, value.a); RedactedFields.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.b); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, RedactedRepeated value) throws IOException { writer.writeBytes(value.unknownFields()); RedactedFields.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.b); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 1, value.a); } @Override public RedactedRepeated 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.a.add(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.b.add(RedactedFields.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public RedactedRepeated redact(RedactedRepeated value) { Builder builder = value.newBuilder(); builder.a = Collections.emptyList(); Internal.redactElements(builder.b, RedactedFields.ADAPTER); builder.clearUnknownFields(); return builder.build(); } } }
6,972
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/redacted/NotRedacted.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.redacted_test.NotRedacted in redacted_test.proto package com.squareup.wire.protos.redacted; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class NotRedacted extends Message<NotRedacted, NotRedacted.Builder> { public static final ProtoAdapter<NotRedacted> ADAPTER = new ProtoAdapter_NotRedacted(); private static final long serialVersionUID = 0L; public static final String DEFAULT_A = ""; public static final String DEFAULT_B = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String a; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String b; public NotRedacted(String a, String b) { this(a, b, ByteString.EMPTY); } public NotRedacted(String a, String b, ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; this.b = b; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.a = a; builder.b = b; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NotRedacted)) return false; NotRedacted o = (NotRedacted) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(a, o.a) && Internal.equals(b, o.b); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (a != null ? a.hashCode() : 0); result = result * 37 + (b != null ? b.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (a != null) builder.append(", a=").append(Internal.sanitize(a)); if (b != null) builder.append(", b=").append(Internal.sanitize(b)); return builder.replace(0, 2, "NotRedacted{").append('}').toString(); } public static final class Builder extends Message.Builder<NotRedacted, Builder> { public String a; public String b; public Builder() { } public Builder a(String a) { this.a = a; return this; } public Builder b(String b) { this.b = b; return this; } @Override public NotRedacted build() { return new NotRedacted(a, b, super.buildUnknownFields()); } } private static final class ProtoAdapter_NotRedacted extends ProtoAdapter<NotRedacted> { public ProtoAdapter_NotRedacted() { super(FieldEncoding.LENGTH_DELIMITED, NotRedacted.class, "type.googleapis.com/squareup.protos.redacted_test.NotRedacted", Syntax.PROTO_2, null, "redacted_test.proto"); } @Override public int encodedSize(NotRedacted value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.a); result += ProtoAdapter.STRING.encodedSizeWithTag(2, value.b); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, NotRedacted value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.b); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, NotRedacted value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.b); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.a); } @Override public NotRedacted 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.a(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.b(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public NotRedacted redact(NotRedacted value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,973
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/oneof/OneOfMessage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.oneof.OneOfMessage in one_of.proto package com.squareup.wire.protos.oneof; 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 okio.ByteString; public final class OneOfMessage extends Message<OneOfMessage, OneOfMessage.Builder> { public static final ProtoAdapter<OneOfMessage> ADAPTER = new ProtoAdapter_OneOfMessage(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_FOO = 0; public static final String DEFAULT_BAR = ""; public static final String DEFAULT_BAZ = ""; /** * What foo. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32", oneofName = "choice" ) public final Integer foo; /** * Such bar. */ @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING", oneofName = "choice" ) public final String bar; /** * Nice baz. */ @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#STRING", oneofName = "choice" ) public final String baz; public OneOfMessage(Integer foo, String bar, String baz) { this(foo, bar, baz, ByteString.EMPTY); } public OneOfMessage(Integer foo, String bar, String baz, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(foo, bar, baz) > 1) { throw new IllegalArgumentException("at most one of foo, bar, baz may be non-null"); } this.foo = foo; this.bar = bar; this.baz = baz; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.foo = foo; builder.bar = bar; builder.baz = baz; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof OneOfMessage)) return false; OneOfMessage o = (OneOfMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(foo, o.foo) && Internal.equals(bar, o.bar) && Internal.equals(baz, o.baz); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (foo != null ? foo.hashCode() : 0); result = result * 37 + (bar != null ? bar.hashCode() : 0); result = result * 37 + (baz != null ? baz.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (foo != null) builder.append(", foo=").append(foo); if (bar != null) builder.append(", bar=").append(Internal.sanitize(bar)); if (baz != null) builder.append(", baz=").append(Internal.sanitize(baz)); return builder.replace(0, 2, "OneOfMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<OneOfMessage, Builder> { public Integer foo; public String bar; public String baz; public Builder() { } /** * What foo. */ public Builder foo(Integer foo) { this.foo = foo; this.bar = null; this.baz = null; return this; } /** * Such bar. */ public Builder bar(String bar) { this.bar = bar; this.foo = null; this.baz = null; return this; } /** * Nice baz. */ public Builder baz(String baz) { this.baz = baz; this.foo = null; this.bar = null; return this; } @Override public OneOfMessage build() { return new OneOfMessage(foo, bar, baz, super.buildUnknownFields()); } } private static final class ProtoAdapter_OneOfMessage extends ProtoAdapter<OneOfMessage> { public ProtoAdapter_OneOfMessage() { super(FieldEncoding.LENGTH_DELIMITED, OneOfMessage.class, "type.googleapis.com/squareup.protos.oneof.OneOfMessage", Syntax.PROTO_2, null, "one_of.proto"); } @Override public int encodedSize(OneOfMessage value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.foo); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.bar); result += ProtoAdapter.STRING.encodedSizeWithTag(4, value.baz); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, OneOfMessage value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.foo); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.bar); ProtoAdapter.STRING.encodeWithTag(writer, 4, value.baz); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, OneOfMessage value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 4, value.baz); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.bar); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.foo); } @Override public OneOfMessage 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.foo(ProtoAdapter.INT32.decode(reader)); break; case 3: builder.bar(ProtoAdapter.STRING.decode(reader)); break; case 4: builder.baz(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public OneOfMessage redact(OneOfMessage value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,974
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/namecollisions/Message.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.namecollisions.Message in name_collisions.proto package com.squareup.wire.protos.namecollisions; import com.squareup.wire.FieldEncoding; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Message extends com.squareup.wire.Message<Message, Message.Builder> { public static final ProtoAdapter<Message> ADAPTER = new ProtoAdapter_Message(); private static final long serialVersionUID = 0L; public static final String DEFAULT_UNKNOWNFIELDS = ""; public static final String DEFAULT_OTHER = ""; public static final String DEFAULT_O = ""; public static final String DEFAULT_RESULT = ""; public static final String DEFAULT_HASHCODE = ""; public static final String DEFAULT_SERIALVERSIONUID_ = ""; public static final String DEFAULT_ADAPTER_ = ""; public static final String DEFAULT_MESSAGE_OPTIONS_ = ""; public static final String DEFAULT_THIS_ = ""; public static final String DEFAULT_MESSAGE = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String unknownFields; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String other; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String o; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String result; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String hashCode; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "serialVersionUID" ) public final String serialVersionUID_; @WireField( tag = 7, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "ADAPTER" ) public final String ADAPTER_; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "MESSAGE_OPTIONS" ) public final String MESSAGE_OPTIONS_; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#STRING", declaredName = "this" ) public final String this_; @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String message; public Message(String unknownFields, String other, String o, String result, String hashCode, String serialVersionUID_, String ADAPTER_, String MESSAGE_OPTIONS_, String this_, String message) { this(unknownFields, other, o, result, hashCode, serialVersionUID_, ADAPTER_, MESSAGE_OPTIONS_, this_, message, ByteString.EMPTY); } public Message(String unknownFields, String other, String o, String result, String hashCode, String serialVersionUID_, String ADAPTER_, String MESSAGE_OPTIONS_, String this_, String message, ByteString unknownFields_) { super(ADAPTER, unknownFields_); this.unknownFields = unknownFields; this.other = other; this.o = o; this.result = result; this.hashCode = hashCode; this.serialVersionUID_ = serialVersionUID_; this.ADAPTER_ = ADAPTER_; this.MESSAGE_OPTIONS_ = MESSAGE_OPTIONS_; this.this_ = this_; this.message = message; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.unknownFields = unknownFields; builder.other = other; builder.o = o; builder.result = result; builder.hashCode = hashCode; builder.serialVersionUID_ = serialVersionUID_; builder.ADAPTER_ = ADAPTER_; builder.MESSAGE_OPTIONS_ = MESSAGE_OPTIONS_; builder.this_ = this_; builder.message = message; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other_) { if (other_ == this) return true; if (!(other_ instanceof Message)) return false; Message o_ = (Message) other_; return unknownFields().equals(o_.unknownFields()) && Internal.equals(unknownFields, o_.unknownFields) && Internal.equals(other, o_.other) && Internal.equals(o, o_.o) && Internal.equals(result, o_.result) && Internal.equals(hashCode, o_.hashCode) && Internal.equals(serialVersionUID_, o_.serialVersionUID_) && Internal.equals(ADAPTER_, o_.ADAPTER_) && Internal.equals(MESSAGE_OPTIONS_, o_.MESSAGE_OPTIONS_) && Internal.equals(this_, o_.this_) && Internal.equals(message, o_.message); } @Override public int hashCode() { int result_ = super.hashCode; if (result_ == 0) { result_ = unknownFields().hashCode(); result_ = result_ * 37 + (unknownFields != null ? unknownFields.hashCode() : 0); result_ = result_ * 37 + (other != null ? other.hashCode() : 0); result_ = result_ * 37 + (o != null ? o.hashCode() : 0); result_ = result_ * 37 + (result != null ? result.hashCode() : 0); result_ = result_ * 37 + (hashCode != null ? hashCode.hashCode() : 0); result_ = result_ * 37 + (serialVersionUID_ != null ? serialVersionUID_.hashCode() : 0); result_ = result_ * 37 + (ADAPTER_ != null ? ADAPTER_.hashCode() : 0); result_ = result_ * 37 + (MESSAGE_OPTIONS_ != null ? MESSAGE_OPTIONS_.hashCode() : 0); result_ = result_ * 37 + (this_ != null ? this_.hashCode() : 0); result_ = result_ * 37 + (message != null ? message.hashCode() : 0); super.hashCode = result_; } return result_; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (unknownFields != null) builder.append(", unknownFields=").append(Internal.sanitize(unknownFields)); if (other != null) builder.append(", other=").append(Internal.sanitize(other)); if (o != null) builder.append(", o=").append(Internal.sanitize(o)); if (result != null) builder.append(", result=").append(Internal.sanitize(result)); if (hashCode != null) builder.append(", hashCode=").append(Internal.sanitize(hashCode)); if (serialVersionUID_ != null) builder.append(", serialVersionUID=").append(Internal.sanitize(serialVersionUID_)); if (ADAPTER_ != null) builder.append(", ADAPTER=").append(Internal.sanitize(ADAPTER_)); if (MESSAGE_OPTIONS_ != null) builder.append(", MESSAGE_OPTIONS=").append(Internal.sanitize(MESSAGE_OPTIONS_)); if (this_ != null) builder.append(", this=").append(Internal.sanitize(this_)); if (message != null) builder.append(", message=").append(Internal.sanitize(message)); return builder.replace(0, 2, "Message{").append('}').toString(); } public static final class Builder extends com.squareup.wire.Message.Builder<Message, Builder> { public String unknownFields; public String other; public String o; public String result; public String hashCode; public String serialVersionUID_; public String ADAPTER_; public String MESSAGE_OPTIONS_; public String this_; public String message; public Builder() { } public Builder unknownFields(String unknownFields) { this.unknownFields = unknownFields; return this; } public Builder other(String other) { this.other = other; return this; } public Builder o(String o) { this.o = o; return this; } public Builder result(String result) { this.result = result; return this; } public Builder hashCode(String hashCode) { this.hashCode = hashCode; return this; } public Builder serialVersionUID_(String serialVersionUID_) { this.serialVersionUID_ = serialVersionUID_; return this; } public Builder ADAPTER_(String ADAPTER_) { this.ADAPTER_ = ADAPTER_; return this; } public Builder MESSAGE_OPTIONS_(String MESSAGE_OPTIONS_) { this.MESSAGE_OPTIONS_ = MESSAGE_OPTIONS_; return this; } public Builder this_(String this_) { this.this_ = this_; return this; } public Builder message(String message) { this.message = message; return this; } @Override public Message build() { return new Message(unknownFields, other, o, result, hashCode, serialVersionUID_, ADAPTER_, MESSAGE_OPTIONS_, this_, message, super.buildUnknownFields()); } } private static final class ProtoAdapter_Message extends ProtoAdapter<Message> { public ProtoAdapter_Message() { super(FieldEncoding.LENGTH_DELIMITED, Message.class, "type.googleapis.com/squareup.protos.namecollisions.Message", Syntax.PROTO_2, null, "name_collisions.proto"); } @Override public int encodedSize(Message value) { int result_ = 0; result_ += ProtoAdapter.STRING.encodedSizeWithTag(1, value.unknownFields); result_ += ProtoAdapter.STRING.encodedSizeWithTag(2, value.other); result_ += ProtoAdapter.STRING.encodedSizeWithTag(3, value.o); result_ += ProtoAdapter.STRING.encodedSizeWithTag(4, value.result); result_ += ProtoAdapter.STRING.encodedSizeWithTag(5, value.hashCode); result_ += ProtoAdapter.STRING.encodedSizeWithTag(6, value.serialVersionUID_); result_ += ProtoAdapter.STRING.encodedSizeWithTag(7, value.ADAPTER_); result_ += ProtoAdapter.STRING.encodedSizeWithTag(8, value.MESSAGE_OPTIONS_); result_ += ProtoAdapter.STRING.encodedSizeWithTag(9, value.this_); result_ += ProtoAdapter.STRING.encodedSizeWithTag(10, value.message); result_ += value.unknownFields().size(); return result_; } @Override public void encode(ProtoWriter writer, Message value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.unknownFields); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.other); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.o); ProtoAdapter.STRING.encodeWithTag(writer, 4, value.result); ProtoAdapter.STRING.encodeWithTag(writer, 5, value.hashCode); ProtoAdapter.STRING.encodeWithTag(writer, 6, value.serialVersionUID_); ProtoAdapter.STRING.encodeWithTag(writer, 7, value.ADAPTER_); ProtoAdapter.STRING.encodeWithTag(writer, 8, value.MESSAGE_OPTIONS_); ProtoAdapter.STRING.encodeWithTag(writer, 9, value.this_); ProtoAdapter.STRING.encodeWithTag(writer, 10, value.message); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Message value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 10, value.message); ProtoAdapter.STRING.encodeWithTag(writer, 9, value.this_); ProtoAdapter.STRING.encodeWithTag(writer, 8, value.MESSAGE_OPTIONS_); ProtoAdapter.STRING.encodeWithTag(writer, 7, value.ADAPTER_); ProtoAdapter.STRING.encodeWithTag(writer, 6, value.serialVersionUID_); ProtoAdapter.STRING.encodeWithTag(writer, 5, value.hashCode); ProtoAdapter.STRING.encodeWithTag(writer, 4, value.result); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.o); ProtoAdapter.STRING.encodeWithTag(writer, 2, value.other); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.unknownFields); } @Override public Message 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.unknownFields(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.other(ProtoAdapter.STRING.decode(reader)); break; case 3: builder.o(ProtoAdapter.STRING.decode(reader)); break; case 4: builder.result(ProtoAdapter.STRING.decode(reader)); break; case 5: builder.hashCode(ProtoAdapter.STRING.decode(reader)); break; case 6: builder.serialVersionUID_(ProtoAdapter.STRING.decode(reader)); break; case 7: builder.ADAPTER_(ProtoAdapter.STRING.decode(reader)); break; case 8: builder.MESSAGE_OPTIONS_(ProtoAdapter.STRING.decode(reader)); break; case 9: builder.this_(ProtoAdapter.STRING.decode(reader)); break; case 10: builder.message(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Message redact(Message value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,975
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/foreign/ForeignMessage.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.foreign.ForeignMessage in foreign.proto package com.squareup.wire.protos.foreign; 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 okio.ByteString; public final class ForeignMessage extends Message<ForeignMessage, ForeignMessage.Builder> { public static final ProtoAdapter<ForeignMessage> ADAPTER = new ProtoAdapter_ForeignMessage(); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_I = 0; public static final Integer DEFAULT_J = 0; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer i; /** * Extension source: simple_message.proto */ @WireField( tag = 100, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer j; public ForeignMessage(Integer i, Integer j) { this(i, j, ByteString.EMPTY); } public ForeignMessage(Integer i, Integer j, ByteString unknownFields) { super(ADAPTER, unknownFields); this.i = i; this.j = j; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.i = i; builder.j = j; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof ForeignMessage)) return false; ForeignMessage o = (ForeignMessage) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(i, o.i) && Internal.equals(j, o.j); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (i != null ? i.hashCode() : 0); result = result * 37 + (j != null ? j.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (i != null) builder.append(", i=").append(i); if (j != null) builder.append(", j=").append(j); return builder.replace(0, 2, "ForeignMessage{").append('}').toString(); } public static final class Builder extends Message.Builder<ForeignMessage, Builder> { public Integer i; public Integer j; public Builder() { } public Builder i(Integer i) { this.i = i; return this; } public Builder j(Integer j) { this.j = j; return this; } @Override public ForeignMessage build() { return new ForeignMessage(i, j, super.buildUnknownFields()); } } private static final class ProtoAdapter_ForeignMessage extends ProtoAdapter<ForeignMessage> { public ProtoAdapter_ForeignMessage() { super(FieldEncoding.LENGTH_DELIMITED, ForeignMessage.class, "type.googleapis.com/squareup.protos.foreign.ForeignMessage", Syntax.PROTO_2, null, "foreign.proto"); } @Override public int encodedSize(ForeignMessage value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(1, value.i); result += ProtoAdapter.INT32.encodedSizeWithTag(100, value.j); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, ForeignMessage value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); ProtoAdapter.INT32.encodeWithTag(writer, 100, value.j); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, ForeignMessage value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.INT32.encodeWithTag(writer, 100, value.j); ProtoAdapter.INT32.encodeWithTag(writer, 1, value.i); } @Override public ForeignMessage 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.i(ProtoAdapter.INT32.decode(reader)); break; case 100: builder.j(ProtoAdapter.INT32.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public ForeignMessage redact(ForeignMessage value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,976
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/protos/foreign/ForeignEnum.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.foreign.ForeignEnum in foreign.proto package com.squareup.wire.protos.foreign; 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 ForeignEnum implements WireEnum { BAV(0), BAX(1); public static final ProtoAdapter<ForeignEnum> ADAPTER = new ProtoAdapter_ForeignEnum(); private final int value; ForeignEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static ForeignEnum fromValue(int value) { switch (value) { case 0: return BAV; case 1: return BAX; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_ForeignEnum extends EnumAdapter<ForeignEnum> { ProtoAdapter_ForeignEnum() { super(ForeignEnum.class, Syntax.PROTO_2, ForeignEnum.BAV); } @Override protected ForeignEnum fromValue(int value) { return ForeignEnum.fromValue(value); } } }
6,977
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/map/Thing.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.wire.map.Thing in map.proto package com.squareup.wire.map; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Thing extends Message<Thing, Thing.Builder> { public static final ProtoAdapter<Thing> ADAPTER = new ProtoAdapter_Thing(); private static final long serialVersionUID = 0L; public static final String DEFAULT_NAME = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String name; public Thing(String name) { this(name, ByteString.EMPTY); } public Thing(String name, ByteString unknownFields) { super(ADAPTER, unknownFields); this.name = name; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.name = name; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Thing)) return false; Thing o = (Thing) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(name, o.name); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (name != null ? name.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)); return builder.replace(0, 2, "Thing{").append('}').toString(); } public static final class Builder extends Message.Builder<Thing, Builder> { public String name; public Builder() { } public Builder name(String name) { this.name = name; return this; } @Override public Thing build() { return new Thing(name, super.buildUnknownFields()); } } private static final class ProtoAdapter_Thing extends ProtoAdapter<Thing> { public ProtoAdapter_Thing() { super(FieldEncoding.LENGTH_DELIMITED, Thing.class, "type.googleapis.com/com.squareup.wire.map.Thing", Syntax.PROTO_2, null, "map.proto"); } @Override public int encodedSize(Thing value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Thing value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Thing value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); } @Override public Thing 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; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Thing redact(Thing value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,978
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/map/MappyTwo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.wire.map.MappyTwo in map.proto package com.squareup.wire.map; 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.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.Map; import okio.ByteString; public final class MappyTwo extends Message<MappyTwo, MappyTwo.Builder> { public static final ProtoAdapter<MappyTwo> ADAPTER = new ProtoAdapter_MappyTwo(); private static final long serialVersionUID = 0L; @WireField( tag = 1, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.map.MappyTwo$ValueEnum#ADAPTER" ) public final Map<String, ValueEnum> string_enums; @WireField( tag = 2, keyAdapter = "com.squareup.wire.ProtoAdapter#SINT64", adapter = "com.squareup.wire.map.Thing#ADAPTER" ) public final Map<Long, Thing> int_things; @WireField( tag = 3, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Map<String, Long> string_ints; @WireField( tag = 4, keyAdapter = "com.squareup.wire.ProtoAdapter#SINT32", adapter = "com.squareup.wire.map.Thing#ADAPTER" ) public final Map<Integer, Thing> int_things_two; public MappyTwo(Map<String, ValueEnum> string_enums, Map<Long, Thing> int_things, Map<String, Long> string_ints, Map<Integer, Thing> int_things_two) { this(string_enums, int_things, string_ints, int_things_two, ByteString.EMPTY); } public MappyTwo(Map<String, ValueEnum> string_enums, Map<Long, Thing> int_things, Map<String, Long> string_ints, Map<Integer, Thing> int_things_two, ByteString unknownFields) { super(ADAPTER, unknownFields); this.string_enums = Internal.immutableCopyOf("string_enums", string_enums); this.int_things = Internal.immutableCopyOf("int_things", int_things); this.string_ints = Internal.immutableCopyOf("string_ints", string_ints); this.int_things_two = Internal.immutableCopyOf("int_things_two", int_things_two); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.string_enums = Internal.copyOf(string_enums); builder.int_things = Internal.copyOf(int_things); builder.string_ints = Internal.copyOf(string_ints); builder.int_things_two = Internal.copyOf(int_things_two); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof MappyTwo)) return false; MappyTwo o = (MappyTwo) other; return unknownFields().equals(o.unknownFields()) && string_enums.equals(o.string_enums) && int_things.equals(o.int_things) && string_ints.equals(o.string_ints) && int_things_two.equals(o.int_things_two); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + string_enums.hashCode(); result = result * 37 + int_things.hashCode(); result = result * 37 + string_ints.hashCode(); result = result * 37 + int_things_two.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!string_enums.isEmpty()) builder.append(", string_enums=").append(string_enums); if (!int_things.isEmpty()) builder.append(", int_things=").append(int_things); if (!string_ints.isEmpty()) builder.append(", string_ints=").append(string_ints); if (!int_things_two.isEmpty()) builder.append(", int_things_two=").append(int_things_two); return builder.replace(0, 2, "MappyTwo{").append('}').toString(); } public static final class Builder extends Message.Builder<MappyTwo, Builder> { public Map<String, ValueEnum> string_enums; public Map<Long, Thing> int_things; public Map<String, Long> string_ints; public Map<Integer, Thing> int_things_two; public Builder() { string_enums = Internal.newMutableMap(); int_things = Internal.newMutableMap(); string_ints = Internal.newMutableMap(); int_things_two = Internal.newMutableMap(); } public Builder string_enums(Map<String, ValueEnum> string_enums) { Internal.checkElementsNotNull(string_enums); this.string_enums = string_enums; return this; } public Builder int_things(Map<Long, Thing> int_things) { Internal.checkElementsNotNull(int_things); this.int_things = int_things; return this; } public Builder string_ints(Map<String, Long> string_ints) { Internal.checkElementsNotNull(string_ints); this.string_ints = string_ints; return this; } public Builder int_things_two(Map<Integer, Thing> int_things_two) { Internal.checkElementsNotNull(int_things_two); this.int_things_two = int_things_two; return this; } @Override public MappyTwo build() { return new MappyTwo(string_enums, int_things, string_ints, int_things_two, super.buildUnknownFields()); } } public enum ValueEnum implements WireEnum { DEFAULT(0), FOO(1), BAR(2); public static final ProtoAdapter<ValueEnum> ADAPTER = new ProtoAdapter_ValueEnum(); private final int value; ValueEnum(int value) { this.value = value; } /** * Return the constant for {@code value} or null. */ public static ValueEnum fromValue(int value) { switch (value) { case 0: return DEFAULT; case 1: return FOO; case 2: return BAR; default: return null; } } @Override public int getValue() { return value; } private static final class ProtoAdapter_ValueEnum extends EnumAdapter<ValueEnum> { ProtoAdapter_ValueEnum() { super(ValueEnum.class, Syntax.PROTO_2, ValueEnum.DEFAULT); } @Override protected ValueEnum fromValue(int value) { return ValueEnum.fromValue(value); } } } private static final class ProtoAdapter_MappyTwo extends ProtoAdapter<MappyTwo> { private ProtoAdapter<Map<String, ValueEnum>> string_enums; private ProtoAdapter<Map<Long, Thing>> int_things; private ProtoAdapter<Map<String, Long>> string_ints; private ProtoAdapter<Map<Integer, Thing>> int_things_two; public ProtoAdapter_MappyTwo() { super(FieldEncoding.LENGTH_DELIMITED, MappyTwo.class, "type.googleapis.com/com.squareup.wire.map.MappyTwo", Syntax.PROTO_2, null, "map.proto"); } @Override public int encodedSize(MappyTwo value) { int result = 0; result += string_enumsAdapter().encodedSizeWithTag(1, value.string_enums); result += int_thingsAdapter().encodedSizeWithTag(2, value.int_things); result += string_intsAdapter().encodedSizeWithTag(3, value.string_ints); result += int_things_twoAdapter().encodedSizeWithTag(4, value.int_things_two); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, MappyTwo value) throws IOException { string_enumsAdapter().encodeWithTag(writer, 1, value.string_enums); int_thingsAdapter().encodeWithTag(writer, 2, value.int_things); string_intsAdapter().encodeWithTag(writer, 3, value.string_ints); int_things_twoAdapter().encodeWithTag(writer, 4, value.int_things_two); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, MappyTwo value) throws IOException { writer.writeBytes(value.unknownFields()); int_things_twoAdapter().encodeWithTag(writer, 4, value.int_things_two); string_intsAdapter().encodeWithTag(writer, 3, value.string_ints); int_thingsAdapter().encodeWithTag(writer, 2, value.int_things); string_enumsAdapter().encodeWithTag(writer, 1, value.string_enums); } @Override public MappyTwo 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.string_enums.putAll(string_enumsAdapter().decode(reader)); break; case 2: builder.int_things.putAll(int_thingsAdapter().decode(reader)); break; case 3: builder.string_ints.putAll(string_intsAdapter().decode(reader)); break; case 4: builder.int_things_two.putAll(int_things_twoAdapter().decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public MappyTwo redact(MappyTwo value) { Builder builder = value.newBuilder(); Internal.redactElements(builder.int_things, Thing.ADAPTER); Internal.redactElements(builder.int_things_two, Thing.ADAPTER); builder.clearUnknownFields(); return builder.build(); } private ProtoAdapter<Map<String, ValueEnum>> string_enumsAdapter() { ProtoAdapter<Map<String, ValueEnum>> result = string_enums; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ValueEnum.ADAPTER); string_enums = result; } return result; } private ProtoAdapter<Map<Long, Thing>> int_thingsAdapter() { ProtoAdapter<Map<Long, Thing>> result = int_things; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.SINT64, Thing.ADAPTER); int_things = result; } return result; } private ProtoAdapter<Map<String, Long>> string_intsAdapter() { ProtoAdapter<Map<String, Long>> result = string_ints; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.SINT64); string_ints = result; } return result; } private ProtoAdapter<Map<Integer, Thing>> int_things_twoAdapter() { ProtoAdapter<Map<Integer, Thing>> result = int_things_two; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.SINT32, Thing.ADAPTER); int_things_two = result; } return result; } } }
6,979
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/wire/map/Mappy.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.wire.map.Mappy in map.proto package com.squareup.wire.map; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import java.util.Map; import okio.ByteString; public final class Mappy extends Message<Mappy, Mappy.Builder> { public static final ProtoAdapter<Mappy> ADAPTER = new ProtoAdapter_Mappy(); private static final long serialVersionUID = 0L; @WireField( tag = 1, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", adapter = "com.squareup.wire.map.Thing#ADAPTER" ) public final Map<String, Thing> things; public Mappy(Map<String, Thing> things) { this(things, ByteString.EMPTY); } public Mappy(Map<String, Thing> things, ByteString unknownFields) { super(ADAPTER, unknownFields); this.things = Internal.immutableCopyOf("things", things); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.things = Internal.copyOf(things); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Mappy)) return false; Mappy o = (Mappy) other; return unknownFields().equals(o.unknownFields()) && things.equals(o.things); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + things.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (!things.isEmpty()) builder.append(", things=").append(things); return builder.replace(0, 2, "Mappy{").append('}').toString(); } public static final class Builder extends Message.Builder<Mappy, Builder> { public Map<String, Thing> things; public Builder() { things = Internal.newMutableMap(); } public Builder things(Map<String, Thing> things) { Internal.checkElementsNotNull(things); this.things = things; return this; } @Override public Mappy build() { return new Mappy(things, super.buildUnknownFields()); } } private static final class ProtoAdapter_Mappy extends ProtoAdapter<Mappy> { private ProtoAdapter<Map<String, Thing>> things; public ProtoAdapter_Mappy() { super(FieldEncoding.LENGTH_DELIMITED, Mappy.class, "type.googleapis.com/com.squareup.wire.map.Mappy", Syntax.PROTO_2, null, "map.proto"); } @Override public int encodedSize(Mappy value) { int result = 0; result += thingsAdapter().encodedSizeWithTag(1, value.things); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Mappy value) throws IOException { thingsAdapter().encodeWithTag(writer, 1, value.things); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Mappy value) throws IOException { writer.writeBytes(value.unknownFields()); thingsAdapter().encodeWithTag(writer, 1, value.things); } @Override public Mappy 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.things.putAll(thingsAdapter().decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Mappy redact(Mappy value) { Builder builder = value.newBuilder(); Internal.redactElements(builder.things, Thing.ADAPTER); builder.clearUnknownFields(); return builder.build(); } private ProtoAdapter<Map<String, Thing>> thingsAdapter() { ProtoAdapter<Map<String, Thing>> result = things; if (result == null) { result = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, Thing.ADAPTER); things = result; } return result; } } }
6,980
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/foobar/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/foobar/protos/foo/Foo.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.foobar.Foo in foo.proto package com.squareup.foobar.protos.foo; import com.squareup.foobar.protos.bar.Bar; 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.Deprecated; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; @Deprecated public final class Foo extends Message<Foo, Foo.Builder> { public static final ProtoAdapter<Foo> ADAPTER = new ProtoAdapter_Foo(); private static final long serialVersionUID = 0L; @WireField( tag = 1, adapter = "com.squareup.foobar.protos.bar.Bar$Baz$Moo#ADAPTER" ) public final Bar.Baz.Moo moo; public Foo(Bar.Baz.Moo moo) { this(moo, ByteString.EMPTY); } public Foo(Bar.Baz.Moo moo, ByteString unknownFields) { super(ADAPTER, unknownFields); this.moo = moo; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.moo = moo; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Foo)) return false; Foo o = (Foo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(moo, o.moo); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (moo != null ? moo.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (moo != null) builder.append(", moo=").append(moo); return builder.replace(0, 2, "Foo{").append('}').toString(); } public static final class Builder extends Message.Builder<Foo, Builder> { public Bar.Baz.Moo moo; public Builder() { } public Builder moo(Bar.Baz.Moo moo) { this.moo = moo; return this; } @Override public Foo build() { return new Foo(moo, super.buildUnknownFields()); } } private static final class ProtoAdapter_Foo extends ProtoAdapter<Foo> { public ProtoAdapter_Foo() { super(FieldEncoding.LENGTH_DELIMITED, Foo.class, "type.googleapis.com/squareup.foobar.Foo", Syntax.PROTO_2, null, "foo.proto"); } @Override public int encodedSize(Foo value) { int result = 0; result += Bar.Baz.Moo.ADAPTER.encodedSizeWithTag(1, value.moo); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Foo value) throws IOException { Bar.Baz.Moo.ADAPTER.encodeWithTag(writer, 1, value.moo); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Foo value) throws IOException { writer.writeBytes(value.unknownFields()); Bar.Baz.Moo.ADAPTER.encodeWithTag(writer, 1, value.moo); } @Override public Foo 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.moo(Bar.Baz.Moo.ADAPTER.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Foo redact(Foo value) { Builder builder = value.newBuilder(); if (builder.moo != null) builder.moo = Bar.Baz.Moo.ADAPTER.redact(builder.moo); builder.clearUnknownFields(); return builder.build(); } } }
6,981
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/foobar/protos
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/foobar/protos/bar/Bar.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.foobar.Bar in bar.proto package com.squareup.foobar.protos.bar; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Bar extends Message<Bar, Bar.Builder> { public static final ProtoAdapter<Bar> ADAPTER = new ProtoAdapter_Bar(); private static final long serialVersionUID = 0L; public Bar() { this(ByteString.EMPTY); } public Bar(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Bar)) return false; Bar o = (Bar) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "Bar{").append('}').toString(); } public static final class Builder extends Message.Builder<Bar, Builder> { public Builder() { } @Override public Bar build() { return new Bar(super.buildUnknownFields()); } } public static final class Baz extends Message<Baz, Baz.Builder> { public static final ProtoAdapter<Baz> ADAPTER = new ProtoAdapter_Baz(); private static final long serialVersionUID = 0L; public Baz() { this(ByteString.EMPTY); } public Baz(ByteString unknownFields) { super(ADAPTER, unknownFields); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Baz)) return false; Baz o = (Baz) other; return unknownFields().equals(o.unknownFields()); } @Override public int hashCode() { return unknownFields().hashCode(); } @Override public String toString() { StringBuilder builder = new StringBuilder(); return builder.replace(0, 2, "Baz{").append('}').toString(); } public static final class Builder extends Message.Builder<Baz, Builder> { public Builder() { } @Override public Baz build() { return new Baz(super.buildUnknownFields()); } } public static final class Moo extends Message<Moo, Moo.Builder> { public static final ProtoAdapter<Moo> ADAPTER = new ProtoAdapter_Moo(); private static final long serialVersionUID = 0L; public static final String DEFAULT_BOO = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String boo; public Moo(String boo) { this(boo, ByteString.EMPTY); } public Moo(String boo, ByteString unknownFields) { super(ADAPTER, unknownFields); this.boo = boo; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.boo = boo; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Moo)) return false; Moo o = (Moo) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(boo, o.boo); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (boo != null ? boo.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (boo != null) builder.append(", boo=").append(Internal.sanitize(boo)); return builder.replace(0, 2, "Moo{").append('}').toString(); } public static final class Builder extends Message.Builder<Moo, Builder> { public String boo; public Builder() { } public Builder boo(String boo) { this.boo = boo; return this; } @Override public Moo build() { return new Moo(boo, super.buildUnknownFields()); } } private static final class ProtoAdapter_Moo extends ProtoAdapter<Moo> { public ProtoAdapter_Moo() { super(FieldEncoding.LENGTH_DELIMITED, Moo.class, "type.googleapis.com/squareup.foobar.Bar.Baz.Moo", Syntax.PROTO_2, null, "bar.proto"); } @Override public int encodedSize(Moo value) { int result = 0; result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.boo); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Moo value) throws IOException { ProtoAdapter.STRING.encodeWithTag(writer, 1, value.boo); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Moo value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.boo); } @Override public Moo 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.boo(ProtoAdapter.STRING.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Moo redact(Moo value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_Baz extends ProtoAdapter<Baz> { public ProtoAdapter_Baz() { super(FieldEncoding.LENGTH_DELIMITED, Baz.class, "type.googleapis.com/squareup.foobar.Bar.Baz", Syntax.PROTO_2, null, "bar.proto"); } @Override public int encodedSize(Baz value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Baz value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Baz value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public Baz decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Baz redact(Baz value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } } private static final class ProtoAdapter_Bar extends ProtoAdapter<Bar> { public ProtoAdapter_Bar() { super(FieldEncoding.LENGTH_DELIMITED, Bar.class, "type.googleapis.com/squareup.foobar.Bar", Syntax.PROTO_2, null, "bar.proto"); } @Override public int encodedSize(Bar value) { int result = 0; result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Bar value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Bar value) throws IOException { writer.writeBytes(value.unknownFields()); } @Override public Bar decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public Bar redact(Bar value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,982
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services/LetsDataRequest.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.services.LetsDataRequest in simple_service2.proto package com.squareup.services; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class LetsDataRequest extends Message<LetsDataRequest, LetsDataRequest.Builder> { public static final ProtoAdapter<LetsDataRequest> ADAPTER = new ProtoAdapter_LetsDataRequest(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_DATA = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString data; public LetsDataRequest(ByteString data) { this(data, ByteString.EMPTY); } public LetsDataRequest(ByteString data, ByteString unknownFields) { super(ADAPTER, unknownFields); this.data = data; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.data = data; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof LetsDataRequest)) return false; LetsDataRequest o = (LetsDataRequest) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (data != null ? data.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (data != null) builder.append(", data=").append(data); return builder.replace(0, 2, "LetsDataRequest{").append('}').toString(); } public static final class Builder extends Message.Builder<LetsDataRequest, Builder> { public ByteString data; public Builder() { } public Builder data(ByteString data) { this.data = data; return this; } @Override public LetsDataRequest build() { return new LetsDataRequest(data, super.buildUnknownFields()); } } private static final class ProtoAdapter_LetsDataRequest extends ProtoAdapter<LetsDataRequest> { public ProtoAdapter_LetsDataRequest() { super(FieldEncoding.LENGTH_DELIMITED, LetsDataRequest.class, "type.googleapis.com/com.squareup.services.LetsDataRequest", Syntax.PROTO_2, null, "simple_service2.proto"); } @Override public int encodedSize(LetsDataRequest value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, LetsDataRequest value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, LetsDataRequest value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); } @Override public LetsDataRequest 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.data(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public LetsDataRequest redact(LetsDataRequest value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,983
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services/HeresAllTheDataRequest.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.services.HeresAllTheDataRequest in simple_service2.proto package com.squareup.services; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class HeresAllTheDataRequest extends Message<HeresAllTheDataRequest, HeresAllTheDataRequest.Builder> { public static final ProtoAdapter<HeresAllTheDataRequest> ADAPTER = new ProtoAdapter_HeresAllTheDataRequest(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_DATA = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString data; public HeresAllTheDataRequest(ByteString data) { this(data, ByteString.EMPTY); } public HeresAllTheDataRequest(ByteString data, ByteString unknownFields) { super(ADAPTER, unknownFields); this.data = data; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.data = data; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof HeresAllTheDataRequest)) return false; HeresAllTheDataRequest o = (HeresAllTheDataRequest) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (data != null ? data.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (data != null) builder.append(", data=").append(data); return builder.replace(0, 2, "HeresAllTheDataRequest{").append('}').toString(); } public static final class Builder extends Message.Builder<HeresAllTheDataRequest, Builder> { public ByteString data; public Builder() { } public Builder data(ByteString data) { this.data = data; return this; } @Override public HeresAllTheDataRequest build() { return new HeresAllTheDataRequest(data, super.buildUnknownFields()); } } private static final class ProtoAdapter_HeresAllTheDataRequest extends ProtoAdapter<HeresAllTheDataRequest> { public ProtoAdapter_HeresAllTheDataRequest() { super(FieldEncoding.LENGTH_DELIMITED, HeresAllTheDataRequest.class, "type.googleapis.com/com.squareup.services.HeresAllTheDataRequest", Syntax.PROTO_2, null, "simple_service2.proto"); } @Override public int encodedSize(HeresAllTheDataRequest value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, HeresAllTheDataRequest value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, HeresAllTheDataRequest value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); } @Override public HeresAllTheDataRequest 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.data(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public HeresAllTheDataRequest redact(HeresAllTheDataRequest value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,984
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services/LetsDataResponse.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.services.LetsDataResponse in simple_service2.proto package com.squareup.services; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class LetsDataResponse extends Message<LetsDataResponse, LetsDataResponse.Builder> { public static final ProtoAdapter<LetsDataResponse> ADAPTER = new ProtoAdapter_LetsDataResponse(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_DATA = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString data; public LetsDataResponse(ByteString data) { this(data, ByteString.EMPTY); } public LetsDataResponse(ByteString data, ByteString unknownFields) { super(ADAPTER, unknownFields); this.data = data; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.data = data; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof LetsDataResponse)) return false; LetsDataResponse o = (LetsDataResponse) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (data != null ? data.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (data != null) builder.append(", data=").append(data); return builder.replace(0, 2, "LetsDataResponse{").append('}').toString(); } public static final class Builder extends Message.Builder<LetsDataResponse, Builder> { public ByteString data; public Builder() { } public Builder data(ByteString data) { this.data = data; return this; } @Override public LetsDataResponse build() { return new LetsDataResponse(data, super.buildUnknownFields()); } } private static final class ProtoAdapter_LetsDataResponse extends ProtoAdapter<LetsDataResponse> { public ProtoAdapter_LetsDataResponse() { super(FieldEncoding.LENGTH_DELIMITED, LetsDataResponse.class, "type.googleapis.com/com.squareup.services.LetsDataResponse", Syntax.PROTO_2, null, "simple_service2.proto"); } @Override public int encodedSize(LetsDataResponse value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, LetsDataResponse value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, LetsDataResponse value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); } @Override public LetsDataResponse 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.data(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public LetsDataResponse redact(LetsDataResponse value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,985
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services/HeresAllTheDataResponse.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.services.HeresAllTheDataResponse in simple_service2.proto package com.squareup.services; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class HeresAllTheDataResponse extends Message<HeresAllTheDataResponse, HeresAllTheDataResponse.Builder> { public static final ProtoAdapter<HeresAllTheDataResponse> ADAPTER = new ProtoAdapter_HeresAllTheDataResponse(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_DATA = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString data; public HeresAllTheDataResponse(ByteString data) { this(data, ByteString.EMPTY); } public HeresAllTheDataResponse(ByteString data, ByteString unknownFields) { super(ADAPTER, unknownFields); this.data = data; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.data = data; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof HeresAllTheDataResponse)) return false; HeresAllTheDataResponse o = (HeresAllTheDataResponse) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (data != null ? data.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (data != null) builder.append(", data=").append(data); return builder.replace(0, 2, "HeresAllTheDataResponse{").append('}').toString(); } public static final class Builder extends Message.Builder<HeresAllTheDataResponse, Builder> { public ByteString data; public Builder() { } public Builder data(ByteString data) { this.data = data; return this; } @Override public HeresAllTheDataResponse build() { return new HeresAllTheDataResponse(data, super.buildUnknownFields()); } } private static final class ProtoAdapter_HeresAllTheDataResponse extends ProtoAdapter<HeresAllTheDataResponse> { public ProtoAdapter_HeresAllTheDataResponse() { super(FieldEncoding.LENGTH_DELIMITED, HeresAllTheDataResponse.class, "type.googleapis.com/com.squareup.services.HeresAllTheDataResponse", Syntax.PROTO_2, null, "simple_service2.proto"); } @Override public int encodedSize(HeresAllTheDataResponse value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, HeresAllTheDataResponse value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, HeresAllTheDataResponse value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); } @Override public HeresAllTheDataResponse 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.data(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public HeresAllTheDataResponse redact(HeresAllTheDataResponse value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,986
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services/anotherpackage/SendDataResponse.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.services.anotherpackage.SendDataResponse in request_response.proto package com.squareup.services.anotherpackage; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class SendDataResponse extends Message<SendDataResponse, SendDataResponse.Builder> { public static final ProtoAdapter<SendDataResponse> ADAPTER = new ProtoAdapter_SendDataResponse(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_DATA = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString data; public SendDataResponse(ByteString data) { this(data, ByteString.EMPTY); } public SendDataResponse(ByteString data, ByteString unknownFields) { super(ADAPTER, unknownFields); this.data = data; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.data = data; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof SendDataResponse)) return false; SendDataResponse o = (SendDataResponse) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (data != null ? data.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (data != null) builder.append(", data=").append(data); return builder.replace(0, 2, "SendDataResponse{").append('}').toString(); } public static final class Builder extends Message.Builder<SendDataResponse, Builder> { public ByteString data; public Builder() { } public Builder data(ByteString data) { this.data = data; return this; } @Override public SendDataResponse build() { return new SendDataResponse(data, super.buildUnknownFields()); } } private static final class ProtoAdapter_SendDataResponse extends ProtoAdapter<SendDataResponse> { public ProtoAdapter_SendDataResponse() { super(FieldEncoding.LENGTH_DELIMITED, SendDataResponse.class, "type.googleapis.com/com.squareup.services.anotherpackage.SendDataResponse", Syntax.PROTO_2, null, "request_response.proto"); } @Override public int encodedSize(SendDataResponse value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, SendDataResponse value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, SendDataResponse value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); } @Override public SendDataResponse 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.data(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public SendDataResponse redact(SendDataResponse value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,987
0
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services
Create_ds/wire/wire-tests/src/jvmJavaNoOptionsTest/proto-java/com/squareup/services/anotherpackage/SendDataRequest.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: com.squareup.services.anotherpackage.SendDataRequest in request_response.proto package com.squareup.services.anotherpackage; 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.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class SendDataRequest extends Message<SendDataRequest, SendDataRequest.Builder> { public static final ProtoAdapter<SendDataRequest> ADAPTER = new ProtoAdapter_SendDataRequest(); private static final long serialVersionUID = 0L; public static final ByteString DEFAULT_DATA = ByteString.EMPTY; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString data; public SendDataRequest(ByteString data) { this(data, ByteString.EMPTY); } public SendDataRequest(ByteString data, ByteString unknownFields) { super(ADAPTER, unknownFields); this.data = data; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.data = data; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof SendDataRequest)) return false; SendDataRequest o = (SendDataRequest) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(data, o.data); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (data != null ? data.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (data != null) builder.append(", data=").append(data); return builder.replace(0, 2, "SendDataRequest{").append('}').toString(); } public static final class Builder extends Message.Builder<SendDataRequest, Builder> { public ByteString data; public Builder() { } public Builder data(ByteString data) { this.data = data; return this; } @Override public SendDataRequest build() { return new SendDataRequest(data, super.buildUnknownFields()); } } private static final class ProtoAdapter_SendDataRequest extends ProtoAdapter<SendDataRequest> { public ProtoAdapter_SendDataRequest() { super(FieldEncoding.LENGTH_DELIMITED, SendDataRequest.class, "type.googleapis.com/com.squareup.services.anotherpackage.SendDataRequest", Syntax.PROTO_2, null, "request_response.proto"); } @Override public int encodedSize(SendDataRequest value) { int result = 0; result += ProtoAdapter.BYTES.encodedSizeWithTag(1, value.data); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, SendDataRequest value) throws IOException { ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, SendDataRequest value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.BYTES.encodeWithTag(writer, 1, value.data); } @Override public SendDataRequest 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.data(ProtoAdapter.BYTES.decode(reader)); break; default: { reader.readUnknownField(tag); } } } builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token)); return builder.build(); } @Override public SendDataRequest redact(SendDataRequest value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
6,988
0
Create_ds/wire/wire-tests/src/jvmJavaAndroidTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaAndroidTest/proto-java/com/squareup/wire/protos/person/Person.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.person.Person in person.proto package com.squareup.wire.protos.person; import android.os.Parcelable; import com.squareup.wire.AndroidMessage; 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; public final class Person extends AndroidMessage<Person, Person.Builder> { public static final ProtoAdapter<Person> ADAPTER = new ProtoAdapter_Person(); public static final Parcelable.Creator<Person> CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; public static final Integer DEFAULT_ID = 0; public static final String DEFAULT_NAME = ""; public static final String DEFAULT_EMAIL = ""; /** * The customer's ID number. */ @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32", label = WireField.Label.REQUIRED ) public final Integer id; /** * The customer's full name. */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REQUIRED ) public final String name; /** * 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.protos.person.Person$PhoneNumber#ADAPTER", label = WireField.Label.REPEATED ) public final List<PhoneNumber> phone; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#STRING", label = WireField.Label.REPEATED ) public final List<String> aliases; public Person(Integer id, String name, String email, List<PhoneNumber> phone, List<String> aliases) { this(id, name, email, phone, aliases, ByteString.EMPTY); } public Person(Integer id, String name, String email, List<PhoneNumber> phone, List<String> aliases, ByteString unknownFields) { super(ADAPTER, unknownFields); this.id = id; this.name = name; this.email = email; this.phone = Internal.immutableCopyOf("phone", phone); this.aliases = Internal.immutableCopyOf("aliases", aliases); } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.id = id; builder.name = name; builder.email = email; builder.phone = Internal.copyOf(phone); builder.aliases = Internal.copyOf(aliases); 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()) && id.equals(o.id) && name.equals(o.name) && Internal.equals(email, o.email) && phone.equals(o.phone) && aliases.equals(o.aliases); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + id.hashCode(); result = result * 37 + name.hashCode(); result = result * 37 + (email != null ? email.hashCode() : 0); result = result * 37 + phone.hashCode(); result = result * 37 + aliases.hashCode(); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(", id=").append(id); builder.append(", name=").append(Internal.sanitize(name)); if (email != null) builder.append(", email=").append(Internal.sanitize(email)); if (!phone.isEmpty()) builder.append(", phone=").append(phone); if (!aliases.isEmpty()) builder.append(", aliases=").append(Internal.sanitize(aliases)); return builder.replace(0, 2, "Person{").append('}').toString(); } public static final class Builder extends Message.Builder<Person, Builder> { public Integer id; public String name; public String email; public List<PhoneNumber> phone; public List<String> aliases; public Builder() { phone = Internal.newMutableList(); aliases = Internal.newMutableList(); } /** * The customer's ID number. */ public Builder id(Integer id) { this.id = id; return this; } /** * The customer's full name. */ public Builder name(String name) { this.name = name; 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; } public Builder aliases(List<String> aliases) { Internal.checkElementsNotNull(aliases); this.aliases = aliases; return this; } @Override public Person build() { if (id == null || name == null) { throw Internal.missingRequiredFields(id, "id", name, "name"); } return new Person(id, name, email, phone, aliases, super.buildUnknownFields()); } } 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 AndroidMessage<PhoneNumber, PhoneNumber.Builder> { public static final ProtoAdapter<PhoneNumber> ADAPTER = new ProtoAdapter_PhoneNumber(); public static final Parcelable.Creator<PhoneNumber> CREATOR = AndroidMessage.newCreator(ADAPTER); 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.protos.person.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.protos.person.Person.PhoneNumber", Syntax.PROTO_2, null, "person.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.protos.person.Person", Syntax.PROTO_2, null, "person.proto"); } @Override public int encodedSize(Person value) { int result = 0; result += ProtoAdapter.INT32.encodedSizeWithTag(2, value.id); result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.name); result += ProtoAdapter.STRING.encodedSizeWithTag(3, value.email); result += PhoneNumber.ADAPTER.asRepeated().encodedSizeWithTag(4, value.phone); result += ProtoAdapter.STRING.asRepeated().encodedSizeWithTag(5, value.aliases); result += value.unknownFields().size(); return result; } @Override public void encode(ProtoWriter writer, Person value) throws IOException { ProtoAdapter.INT32.encodeWithTag(writer, 2, value.id); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.email); PhoneNumber.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.phone); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 5, value.aliases); writer.writeBytes(value.unknownFields()); } @Override public void encode(ReverseProtoWriter writer, Person value) throws IOException { writer.writeBytes(value.unknownFields()); ProtoAdapter.STRING.asRepeated().encodeWithTag(writer, 5, value.aliases); PhoneNumber.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.phone); ProtoAdapter.STRING.encodeWithTag(writer, 3, value.email); ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); ProtoAdapter.INT32.encodeWithTag(writer, 2, value.id); } @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; case 5: builder.aliases.add(ProtoAdapter.STRING.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(); } } }
6,989
0
Create_ds/wire/wire-tests/src/jvmJavaCompactTest/proto-java/com/squareup/wire/protos
Create_ds/wire/wire-tests/src/jvmJavaCompactTest/proto-java/com/squareup/wire/protos/alltypes/AllTypes.java
// Code generated by Wire protocol buffer compiler, do not edit. // Source: squareup.protos.alltypes.AllTypes in all_types.proto package com.squareup.wire.protos.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.protos.alltypes.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; @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.protos.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum opt_nested_enum; @WireField( tag = 17, adapter = "com.squareup.wire.protos.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.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REQUIRED ) public final NestedEnum req_nested_enum; @WireField( tag = 117, adapter = "com.squareup.wire.protos.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.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> rep_nested_enum; @WireField( tag = 217, adapter = "com.squareup.wire.protos.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.protos.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; /** * Note: protoc doesn't allow some characters of the default value. */ @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.protos.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.protos.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.protos.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final Map<String, NestedEnum> map_string_enum; /** * Extension source: all_types.proto */ @WireField( tag = 1001, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) public final Integer ext_opt_int32; /** * Extension source: all_types.proto */ @WireField( tag = 1002, adapter = "com.squareup.wire.ProtoAdapter#UINT32" ) public final Integer ext_opt_uint32; /** * Extension source: all_types.proto */ @WireField( tag = 1003, adapter = "com.squareup.wire.ProtoAdapter#SINT32" ) public final Integer ext_opt_sint32; /** * Extension source: all_types.proto */ @WireField( tag = 1004, adapter = "com.squareup.wire.ProtoAdapter#FIXED32" ) public final Integer ext_opt_fixed32; /** * Extension source: all_types.proto */ @WireField( tag = 1005, adapter = "com.squareup.wire.ProtoAdapter#SFIXED32" ) public final Integer ext_opt_sfixed32; /** * Extension source: all_types.proto */ @WireField( tag = 1006, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long ext_opt_int64; /** * Extension source: all_types.proto */ @WireField( tag = 1007, adapter = "com.squareup.wire.ProtoAdapter#UINT64" ) public final Long ext_opt_uint64; /** * Extension source: all_types.proto */ @WireField( tag = 1008, adapter = "com.squareup.wire.ProtoAdapter#SINT64" ) public final Long ext_opt_sint64; /** * Extension source: all_types.proto */ @WireField( tag = 1009, adapter = "com.squareup.wire.ProtoAdapter#FIXED64" ) public final Long ext_opt_fixed64; /** * Extension source: all_types.proto */ @WireField( tag = 1010, adapter = "com.squareup.wire.ProtoAdapter#SFIXED64" ) public final Long ext_opt_sfixed64; /** * Extension source: all_types.proto */ @WireField( tag = 1011, adapter = "com.squareup.wire.ProtoAdapter#BOOL" ) public final Boolean ext_opt_bool; /** * Extension source: all_types.proto */ @WireField( tag = 1012, adapter = "com.squareup.wire.ProtoAdapter#FLOAT" ) public final Float ext_opt_float; /** * Extension source: all_types.proto */ @WireField( tag = 1013, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) public final Double ext_opt_double; /** * Extension source: all_types.proto */ @WireField( tag = 1014, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) public final String ext_opt_string; /** * Extension source: all_types.proto */ @WireField( tag = 1015, adapter = "com.squareup.wire.ProtoAdapter#BYTES" ) public final ByteString ext_opt_bytes; /** * Extension source: all_types.proto */ @WireField( tag = 1016, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedEnum#ADAPTER" ) public final NestedEnum ext_opt_nested_enum; /** * Extension source: all_types.proto */ @WireField( tag = 1017, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedMessage#ADAPTER" ) public final NestedMessage ext_opt_nested_message; /** * Extension source: all_types.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.proto */ @WireField( tag = 1116, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedEnum> ext_rep_nested_enum; /** * Extension source: all_types.proto */ @WireField( tag = 1117, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedMessage#ADAPTER", label = WireField.Label.REPEATED ) public final List<NestedMessage> ext_rep_nested_message; /** * Extension source: all_types.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.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.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.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.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.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.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.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.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.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.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.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.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.proto */ @WireField( tag = 1216, adapter = "com.squareup.wire.protos.alltypes.AllTypes$NestedEnum#ADAPTER", label = WireField.Label.PACKED ) public final List<NestedEnum> ext_pack_nested_enum; public AllTypes(Builder builder, ByteString unknownFields) { super(ADAPTER, unknownFields); 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); } @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.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); } @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(); 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 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; } /** * Note: protoc doesn't allow some characters of the default value. */ 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; } @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.protos.alltypes.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()); } } } }
6,990
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/WireTest.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 java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; import com.squareup.wire.protos.custom_options.FooBar; import com.squareup.wire.protos.custom_options.MessageWithOptions; import com.squareup.wire.protos.custom_options.MyFieldOptionOneOption; import com.squareup.wire.protos.custom_options.MyFieldOptionThreeOption; import com.squareup.wire.protos.custom_options.MyFieldOptionTwoOption; import com.squareup.wire.protos.custom_options.MyMessageOptionFourOption; import com.squareup.wire.protos.custom_options.MyMessageOptionTwoOption; import com.squareup.wire.protos.edgecases.NoFields; import com.squareup.wire.protos.person.Person; import com.squareup.wire.protos.person.Person.PhoneNumber; import com.squareup.wire.protos.person.Person.PhoneType; import com.squareup.wire.protos.simple.ExternalMessage; import com.squareup.wire.protos.simple.SimpleMessage; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import okio.Buffer; import okio.ByteString; import org.junit.Test; /** Test Wire runtime. */ public class WireTest { @Test public void testSimpleMessage() throws Exception { SimpleMessage msg = new SimpleMessage.Builder().required_int32(456).build(); assertThat(msg.optional_int32).isNull(); assertThat(msg.optional_nested_msg).isNull(); assertThat(msg.optional_external_msg).isNull(); assertThat(msg.default_nested_enum).isNull(); assertThat(msg.required_int32).isEqualTo(new Integer(456)); assertThat(msg.repeated_double).isNotNull(); assertThat(msg.repeated_double).hasSize(0); SimpleMessage.Builder builder = new SimpleMessage.Builder(); builder.optional_int32(789); SimpleMessage.NestedMessage.Builder nested_msg_builder = new SimpleMessage.NestedMessage.Builder(); nested_msg_builder.bb(2); builder.optional_nested_msg(nested_msg_builder.build()); ExternalMessage.Builder external_msg_builder = new ExternalMessage.Builder(); external_msg_builder.f(99.9f); builder.optional_external_msg(external_msg_builder.build()); builder.default_nested_enum(SimpleMessage.NestedEnum.BAR); builder.required_int32(456); List<Double> doubles = Arrays.asList(1.0, 2.0, 3.0); builder.repeated_double(doubles); msg = builder.build(); assertThat(msg.optional_int32).isEqualTo(new Integer(789)); assertThat(msg.optional_nested_msg.bb).isEqualTo(new Integer(2)); assertThat(msg.optional_external_msg.f).isEqualTo(new Float(99.9f)); assertThat(msg.default_nested_enum).isEqualTo(SimpleMessage.NestedEnum.BAR); assertThat(msg.required_int32).isEqualTo(new Integer(456)); assertThat(msg.repeated_double).isEqualTo(doubles); // Modifying the builder list does not affect an already-built message List<Double> savedData = new ArrayList<Double>(msg.repeated_double); doubles.set(1, 1.1); assertThat(msg.repeated_double).isNotSameAs(doubles); assertThat(msg.repeated_double).isEqualTo(savedData); // Rebuilding will use the new list msg = builder.build(); assertThat(msg.repeated_double).isEqualTo(doubles); // Check for required fields builder.required_int32(null); try { builder.build(); fail(); } catch (IllegalStateException e) { assertThat(e).hasMessage("Required field not set:\n required_int32"); } // The message list is immutable try { msg.repeated_double.set(0, 0.0); fail(); } catch (UnsupportedOperationException e) { // expected } ProtoAdapter<SimpleMessage> adapter = SimpleMessage.ADAPTER; byte[] result = adapter.encode(msg); assertThat(result.length).isEqualTo(46); SimpleMessage newMsg = adapter.decode(result); assertThat(newMsg.optional_int32).isEqualTo(new Integer(789)); assertThat(newMsg.optional_nested_msg.bb).isEqualTo(new Integer(2)); assertThat(newMsg.optional_external_msg.f).isEqualTo(new Float(99.9F)); assertThat(newMsg.default_nested_enum).isEqualTo(SimpleMessage.NestedEnum.BAR); assertThat(newMsg.required_int32).isEqualTo(new Integer(456)); assertThat(msg.repeated_double).isEqualTo(doubles); } @Test public void mutateBuilder() throws Exception { SimpleMessage message = new SimpleMessage.Builder().required_int32(10).build(); SimpleMessage.Builder builder = message.newBuilder(); builder.required_int32 = 20; builder.repeated_double.add(30.5); builder.optional_int32 = 40; assertThat(builder.build()) .isEqualTo( new SimpleMessage.Builder() .required_int32(20) .repeated_double(Arrays.asList(30.5)) .optional_int32(40) .build()); } @Test public void testPerson() throws IOException { Person person = new Person.Builder() .name("Omar") .id(1234) .email("omar@wire.com") .phone( Arrays.asList( new PhoneNumber.Builder() .number("410-555-0909") .type(PhoneType.MOBILE) .build())) .build(); ProtoAdapter<Person> adapter = Person.ADAPTER; byte[] data = adapter.encode(person); adapter.decode(data); } @Test public void testExtensions() throws Exception { ExternalMessage optional_external_msg = new ExternalMessage.Builder() .fooext(Arrays.asList(444, 555)) .barext(333) .bazext(222) .nested_message_ext(new SimpleMessage.NestedMessage.Builder().bb(77).build()) .nested_enum_ext(SimpleMessage.NestedEnum.BAZ) .build(); SimpleMessage msg = new SimpleMessage.Builder() .optional_external_msg(optional_external_msg) .required_int32(456) .build(); assertThat(msg.optional_external_msg.fooext).containsExactly(444, 555); assertThat(msg.optional_external_msg.barext).isEqualTo(new Integer(333)); assertThat(msg.optional_external_msg.bazext).isEqualTo(new Integer(222)); assertThat(msg.optional_external_msg.nested_message_ext.bb).isEqualTo(new Integer(77)); assertThat(msg.optional_external_msg.nested_enum_ext).isEqualTo(SimpleMessage.NestedEnum.BAZ); ProtoAdapter<SimpleMessage> adapter = SimpleMessage.ADAPTER; byte[] result = adapter.encode(msg); assertThat(result.length).isEqualTo(29); SimpleMessage newMsg = adapter.decode(result); assertThat(newMsg.optional_external_msg.fooext).containsExactly(444, 555); assertThat(newMsg.optional_external_msg.barext).isEqualTo(new Integer(333)); assertThat(newMsg.optional_external_msg.bazext).isEqualTo(new Integer(222)); } @Test public void testExtensionEnum() throws Exception { ExternalMessage optional_external_msg = new ExternalMessage.Builder().nested_enum_ext(SimpleMessage.NestedEnum.BAZ).build(); SimpleMessage msg = new SimpleMessage.Builder() .optional_external_msg(optional_external_msg) .required_int32(456) .build(); ProtoAdapter<SimpleMessage> adapter = SimpleMessage.ADAPTER; byte[] data = adapter.encode(msg); // Change BAZ enum to a value not known by this client. data[4] = 17; // Parse the altered message. SimpleMessage newMsg = adapter.decode(data); // Original value shows up as an extension. assertThat(msg.toString()).contains("nested_enum_ext=BAZ"); // New value is unknown in the tag map. ProtoReader reader = new ProtoReader(new Buffer().write(newMsg.optional_external_msg.unknownFields())); reader.beginMessage(); assertThat(reader.nextTag()).isEqualTo(129); assertThat(reader.peekFieldEncoding().rawProtoAdapter().decode(reader)).isEqualTo(17L); // Serialized outputs are the same. byte[] newData = adapter.encode(newMsg); assertThat(data).isEqualTo(newData); } @Test public void testExtensionsNoRegistry() throws Exception { ExternalMessage optional_external_msg = new ExternalMessage.Builder() .fooext(Arrays.asList(444, 555)) .barext(333) .bazext(222) .build(); SimpleMessage msg = new SimpleMessage.Builder() .optional_external_msg(optional_external_msg) .required_int32(456) .build(); assertThat(msg.optional_external_msg.fooext).containsExactly(444, 555); assertThat(msg.optional_external_msg.barext).isEqualTo(new Integer(333)); assertThat(msg.optional_external_msg.bazext).isEqualTo(new Integer(222)); ProtoAdapter<SimpleMessage> adapter = SimpleMessage.ADAPTER; byte[] result = adapter.encode(msg); assertThat(result.length).isEqualTo(21); SimpleMessage newMsg = adapter.decode(result); assertThat(newMsg.optional_external_msg.fooext).isEqualTo(Arrays.asList(444, 555)); assertThat(newMsg.optional_external_msg.barext).isEqualTo(333); assertThat(newMsg.optional_external_msg.bazext).isEqualTo(222); } @Test public void testEmptyList() throws IOException { SimpleMessage noListMessage = new SimpleMessage.Builder().required_int32(1).build(); SimpleMessage emptyListMessage = new SimpleMessage.Builder() .required_int32(1) .repeated_double(new ArrayList<Double>()) .build(); assertThat(noListMessage.repeated_double).isNotNull(); assertThat(noListMessage.repeated_double).hasSize(0); assertThat(emptyListMessage.repeated_double).isNotNull(); assertThat(emptyListMessage.repeated_double).hasSize(0); // Empty lists and null lists compare as equals() assertThat(noListMessage).isEqualTo(emptyListMessage); // Empty lists and null lists have the same hashCode() int noListHashCode = noListMessage.hashCode(); int emptyListHashCode = emptyListMessage.hashCode(); assertThat(noListHashCode).isEqualTo(emptyListHashCode); ProtoAdapter<SimpleMessage> adapter = SimpleMessage.ADAPTER; // Empty lists and null lists occupy 0 bytes in the wire encoding byte[] noListBytes = adapter.encode(noListMessage); byte[] emptyListBytes = adapter.encode(emptyListMessage); assertThat(noListBytes.length).isEqualTo(2); assertThat(emptyListBytes.length).isEqualTo(2); assertThat(emptyListBytes[0]).isEqualTo(noListBytes[0]); assertThat(emptyListBytes[1]).isEqualTo(noListBytes[1]); // Parsed results have a null list SimpleMessage noListParsed = adapter.decode(noListBytes); SimpleMessage emptyListParsed = adapter.decode(emptyListBytes); assertThat(noListParsed.repeated_double).isNotNull(); assertThat(noListParsed.repeated_double).hasSize(0); assertThat(emptyListParsed.repeated_double).isNotNull(); assertThat(emptyListParsed.repeated_double).hasSize(0); } @Test public void testBadEnum() throws IOException { Person person = new Person.Builder() .id(1) .name("Joe Schmoe") .phone( Arrays.asList( new PhoneNumber.Builder().number("555-1212").type(PhoneType.WORK).build())) .build(); assertThat(person.phone.get(0).type).isEqualTo(PhoneType.WORK); ProtoAdapter<Person> adapter = Person.ADAPTER; byte[] data = adapter.encode(person); assertThat(data[27]).isEqualTo((byte) PhoneType.WORK.getValue()); // Corrupt the PhoneNumber type field with an undefined value data[27] = 17; // Parsed PhoneNumber has no value set Person result = adapter.decode(data); assertThat(result.phone.get(0).type).isNull(); // The value 17 will be stored as an unknown varint with tag number 2 ByteString unknownFields = result.phone.get(0).unknownFields(); ProtoReader reader = new ProtoReader(new Buffer().write(unknownFields)); long token = reader.beginMessage(); assertThat(reader.nextTag()).isEqualTo(2); assertThat(reader.peekFieldEncoding()).isEqualTo(FieldEncoding.VARINT); assertThat(FieldEncoding.VARINT.rawProtoAdapter().decode(reader)).isEqualTo(17L); assertThat(reader.nextTag()).isEqualTo(-1); reader.endMessageAndGetUnknownFields(token); // Serialize again, value is preserved byte[] newData = adapter.encode(result); assertThat(data).isEqualTo(newData); } @Test public void listMustBeNonNull() { Person.Builder builder = new Person.Builder(); builder.id = 1; builder.name = "Joe Schmoe"; builder.phone = null; try { builder.build(); fail(); } catch (NullPointerException expected) { assertThat(expected) .hasMessage( "Parameter specified as non-null is null: " + "method com.squareup.wire.internal.Internal__InternalKt.immutableCopyOf, parameter list"); } } @Test public void listElementsMustBeNonNull() { Person.Builder builder = new Person.Builder(); builder.id = 1; builder.name = "Joe Schmoe"; builder.phone.add(null); try { builder.build(); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("phone.contains(null)"); } } @Test public void builderListsAreAlwaysMutable() { PhoneNumber phone = new PhoneNumber.Builder().number("555-1212").type(PhoneType.WORK).build(); Person.Builder newBuilder = new Person.Builder(); newBuilder.phone.add(phone); Person person = new Person.Builder().id(1).name("Joe Schmoe").phone(singletonList(phone)).build(); Person.Builder copyBuilder = person.newBuilder(); copyBuilder.phone.add(phone); } @Test public void emptyMessageToString() { NoFields empty = new NoFields(); assertThat(empty.toString()).isEqualTo("NoFields{}"); } @Test public void sanitizedToString() { Person person = new Person.Builder() .id(1) .name("Such, I mean it, such [a] {funny} name.") .phone(singletonList(new PhoneNumber.Builder().number("123,456,789").build())) .aliases(Arrays.asList("B-lo,ved", "D{esperado}")) .build(); String printedPerson = person.toString(); assertThat(printedPerson) .isEqualTo( "Person{" + "id=1, " + "name=Such\\, I mean it\\, such \\[a\\] \\{funny\\} name., " + "phone=[PhoneNumber{number=123\\,456\\,789}], " + "aliases=[B-lo\\,ved, D\\{esperado\\}]" + "}"); } @Test public void createUseResursiveMapBuilderWithoutCrashing() { ModelEvaluation model = new ModelEvaluation.Builder() .name("name") .score(33.0) .models(new LinkedHashMap<>()) .build(); assertThat(ModelEvaluation.ADAPTER.encodeByteString(model).hex()) .isEqualTo("0a046e616d65110000000000804040"); } @Test public void optionsOnMessageType() { MyMessageOptionTwoOption myMessageOptionTwo = MessageWithOptions.class.getAnnotation(MyMessageOptionTwoOption.class); assertThat(myMessageOptionTwo.value()).isEqualTo(91011.0f); MyMessageOptionFourOption myMessageOptionFour = MessageWithOptions.class.getAnnotation(MyMessageOptionFourOption.class); assertThat(myMessageOptionFour.value()).isEqualTo(FooBar.FooBarBazEnum.FOO); } @Test public void optionsOnField() throws Exception { MyFieldOptionOneOption myFieldOptionOne = FooBar.class.getDeclaredField("foo").getAnnotation(MyFieldOptionOneOption.class); assertThat(myFieldOptionOne.value()).isEqualTo(17); MyFieldOptionTwoOption myFieldOptionTwo = FooBar.class.getDeclaredField("bar").getAnnotation(MyFieldOptionTwoOption.class); assertThat(myFieldOptionTwo.value()).isEqualTo(33.5f); MyFieldOptionThreeOption myFieldOptionThree = FooBar.class.getDeclaredField("baz").getAnnotation(MyFieldOptionThreeOption.class); assertThat(myFieldOptionThree.value()).isEqualTo(FooBar.FooBarBazEnum.BAR); } }
6,991
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/TestAllTypesData.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 okio.ByteString; class TestAllTypesData { public static final String expectedToString = "" + "AllTypes{opt_int32=111, opt_uint32=112, opt_sint32=113, opt_fixed32=114, opt_sfixed32=115," + " opt_int64=116, opt_uint64=117, opt_sint64=118, opt_fixed64=119, opt_sfixed64=120, opt_boo" + "l=true, opt_float=122.0, opt_double=123.0, opt_string=124, opt_bytes=[hex=7de1], opt_neste" + "d_enum=A, opt_nested_message=NestedMessage{a=999}, req_int32=111, req_uint32=112, req_sint" + "32=113, req_fixed32=114, req_sfixed32=115, req_int64=116, req_uint64=117, req_sint64=118, " + "req_fixed64=119, req_sfixed64=120, req_bool=true, req_float=122.0, req_double=123.0, req_s" + "tring=124, req_bytes=[hex=7de1], req_nested_enum=A, req_nested_message=NestedMessage{a=999" + "}, rep_int32=[111, 111], rep_uint32=[112, 112], rep_sint32=[113, 113], rep_fixed32=[114, 1" + "14], rep_sfixed32=[115, 115], rep_int64=[116, 116], rep_uint64=[117, 117], rep_sint64=[118" + ", 118], rep_fixed64=[119, 119], rep_sfixed64=[120, 120], rep_bool=[true, true], rep_float=" + "[122.0, 122.0], rep_double=[123.0, 123.0], rep_string=[124, 124], rep_bytes=[[hex=7de1], [" + "hex=7de1]], rep_nested_enum=[A, A], rep_nested_message=[NestedMessage{a=999}, NestedMessag" + "e{a=999}], pack_int32=[111, 111], pack_uint32=[112, 112], pack_sint32=[113, 113], pack_fix" + "ed32=[114, 114], pack_sfixed32=[115, 115], pack_int64=[116, 116], pack_uint64=[117, 117], " + "pack_sint64=[118, 118], pack_fixed64=[119, 119], pack_sfixed64=[120, 120], pack_bool=[true" + ", true], pack_float=[122.0, 122.0], pack_double=[123.0, 123.0], pack_nested_enum=[A, A], e" + "xt_opt_bool=true, ext_rep_bool=[true, true], ext_pack_bool=[true, true]}"; public static final ByteString expectedOutput = ByteString.decodeHex( "" // optional + "08" // tag = 1, type = 0 + "6f" // value = 111 + "10" // tag = 2, type = 0 + "70" // value = 112 + "18" // tag = 3, type = 0 + "e201" // value = 226 (=113 zig-zag) + "25" // tag = 4, type = 5 + "72000000" // value = 114 (fixed32) + "2d" // tag = 5, type = 5 + "73000000" // value = 115 (sfixed32) + "30" // tag = 6, type = 0 + "74" // value = 116 + "38" // tag = 7, type = 0 + "75" // value = 117 + "40" // tag = 8, type = 0 + "ec01" // value = 236 (=118 zigzag) + "49" // tag = 9, type = 1 + "7700000000000000" // value = 119 + "51" // tag = 10, type = 1 + "7800000000000000" // value = 120 + "58" // tag = 11, type = 0 + "01" // value = 1 (true) + "65" // tag = 12, type = 5 + "0000f442" // value = 122.0F + "69" // tag = 13, type = 1 + "0000000000c05e40" // value = 123.0 + "72" // tag = 14, type = 2 + "03" // length = 3 + "313234" + "7a" // tag = 15, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "8001" // tag = 16, type = 0 + "01" // value = 1 + "8a01" // tag = 17, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 // required + "a806" // tag = 101, type = 0 + "6f" // value = 111 + "b006" // tag = 102, type = 0 + "70" // value = 112 + "b806" // tag = 103, type = 0 + "e201" // value = 226 (=113 zig-zag) + "c506" // tag = 104, type = 5 + "72000000" // value = 114 (fixed32) + "cd06" // tag = 105, type = 5 + "73000000" // value = 115 (sfixed32) + "d006" // tag = 106, type = 0 + "74" // value = 116 + "d806" // tag = 107, type = 0 + "75" // value = 117 + "e006" // tag = 108, type = 0 + "ec01" // value = 236 (=118 zigzag) + "e906" // tag = 109, type = 1 + "7700000000000000" // value = 119 + "f106" // tag = 110, type = 1 + "7800000000000000" // value = 120 + "f806" // tag = 111, type = 0 + "01" // value = 1 (true) + "8507" // tag = 112, type = 5 + "0000f442" // value = 122.0F + "8907" // tag = 113, type = 1 + "0000000000c05e40" // value = 123.0 + "9207" // tag = 114, type = 2 + "03" // length = 3 + "313234" // value = "124" + "9a07" // tag = 115, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "a007" // tag = 116, type = 0 + "01" // value = 1 + "aa07" // tag = 117, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 // repeated + "c80c" // tag = 201, type = 0 + "6f" // value = 111 + "c80c" // tag = 201, type = 0 + "6f" // value = 111 + "d00c" // tag = 202, type = 0 + "70" // value = 112 + "d00c" // tag = 202, type = 0 + "70" // value = 112 + "d80c" // tag = 203, type = 0 + "e201" // value = 226 (=113 zig-zag) + "d80c" // tag = 203, type = 0 + "e201" // value = 226 (=113 zig-zag) + "e50c" // tag = 204, type = 5 + "72000000" // value = 114 (fixed32) + "e50c" // tag = 204, type = 5 + "72000000" // value = 114 (fixed32) + "ed0c" // tag = 205, type = 5 + "73000000" // value = 115 (sfixed32) + "ed0c" // tag = 205, type = 5 + "73000000" // value = 115 (sfixed32) + "f00c" // tag = 206, type = 0 + "74" // value = 116 + "f00c" // tag = 206, type = 0 + "74" // value = 116 + "f80c" // tag = 207, type = 0 + "75" // value = 117 + "f80c" // tag = 207, type = 0 + "75" // value = 117 + "800d" // tag = 208, type = 0 + "ec01" // value = 236 (=118 zigzag) + "800d" // tag = 208, type = 0 + "ec01" // value = 236 (=118 zigzag) + "890d" // tag = 209, type = 1 + "7700000000000000" // value = 119 + "890d" // tag = 209, type = 1 + "7700000000000000" // value = 119 + "910d" // tag = 210, type = 1 + "7800000000000000" // value = 120 + "910d" // tag = 210, type = 1 + "7800000000000000" // value = 120 + "980d" // tag = 211, type = 0 + "01" // value = 1 (true) + "980d" // tag = 211, type = 0 + "01" // value = 1 (true) + "a50d" // tag = 212, type = 5 + "0000f442" // value = 122.0F + "a50d" // tag = 212, type = 5 + "0000f442" // value = 122.0F + "a90d" // tag = 213, type = 1 + "0000000000c05e40" // value = 123.0 + "a90d" // tag = 213, type = 1 + "0000000000c05e40" // value = 123.0 + "b20d" // tag = 214, type = 2 + "03" // length = 3 + "313234" // value = "124" + "b20d" // tag = 214, type = 2 + "03" // length = 3 + "313234" // value = "124" + "ba0d" // tag = 215, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "ba0d" // tag = 215, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "c00d" // tag = 216, type = 0 + "01" // value = 1 + "c00d" // tag = 216, type = 0 + "01" // value = 1 + "ca0d" // tag = 217, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 + "ca0d" // tag = 217, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 // packed + "ea12" // tag = 301, type = 2 + "02" // length = 2 + "6f" // value = 111 + "6f" // value = 111 + "f212" // tag = 302, type = 2 + "02" // length = 2 + "70" // value = 112 + "70" // value = 112 + "fa12" // tag = 303, type = 2 + "04" // length = 4 + "e201" // value = 226 (=113 zig-zag) + "e201" // value = 226 (=113 zig-zag) + "8213" // tag = 304, type = 2 + "08" // length = 8 + "72000000" // value = 114 (fixed32) + "72000000" // value = 114 (fixed32) + "8a13" // tag = 305, type = 2 + "08" // length = 8 + "73000000" // value = 115 (sfixed32) + "73000000" // value = 115 (sfixed32) + "9213" // tag = 306, type = 2 + "02" // length = 2 + "74" // value = 116 + "74" // value = 116 + "9a13" // tag = 307, type = 2 + "02" // length = 2 + "75" // value = 117 + "75" // value = 117 + "a213" // tag = 308, type = 2 + "04" // length = 4 + "ec01" // value = 236 (=118 zigzag) + "ec01" // value = 236 (=118 zigzag) + "aa13" // tag = 309, type = 2 + "10" // length = 16 + "7700000000000000" // value = 119 + "7700000000000000" // value = 119 + "b213" // tag = 310, type = 2 + "10" // length = 16 + "7800000000000000" // value = 120 + "7800000000000000" // value = 120 + "ba13" // tag = 311, type = 2 + "02" // length = 2 + "01" // value = 1 (true) + "01" // value = 1 (true) + "c213" // tag = 312, type = 2 + "08" // length = 8 + "0000f442" // value = 122.0F + "0000f442" // value = 122.0F + "ca13" // tag = 313, type = 2 + "10" // length = 16 + "0000000000c05e40" // value = 123.0 + "0000000000c05e40" // value = 123.0 + "e213" // tag = 316, type = 2 + "02" // length = 2 + "01" // value = 1 + "01" // value = 1 // extensions + "983f" // tag = 1011, type = 0 + "01" // value = 1 (true) + "b845" // tag = 1111, type = 0 + "01" // value = 1 (true) + "b845" // tag = 1111, type = 0 + "01" // value = 1 (true) + "da4b" // tag = 1211, type = 2 + "02" // length = 2 + "01" // value = 1 (true) + "01"); // value = 1 (true) // message with 'packed' fields stored non-packed, must still be readable public static final ByteString nonPacked = ByteString.decodeHex( "" // optional + "08" // tag = 1, type = 0 + "6f" // value = 111 + "10" // tag = 2, type = 0 + "70" // value = 112 + "18" // tag = 3, type = 0 + "e201" // value = 226 (=113 zig-zag) + "25" // tag = 4, type = 5 + "72000000" // value = 114 (fixed32) + "2d" // tag = 5, type = 5 + "73000000" // value = 115 (sfixed32) + "30" // tag = 6, type = 0 + "74" // value = 116 + "38" // tag = 7, type = 0 + "75" // value = 117 + "40" // tag = 8, type = 0 + "ec01" // value = 236 (=118 zigzag) + "49" // tag = 9, type = 1 + "7700000000000000" // value = 119 + "51" // tag = 10, type = 1 + "7800000000000000" // value = 120 + "58" // tag = 11, type = 0 + "01" // value = 1 (true) + "65" // tag = 12, type = 5 + "0000f442" // value = 122.0F + "69" // tag = 13, type = 1 + "0000000000c05e40" // value = 123.0 + "72" // tag = 14, type = 2 + "03" // length = 3 + "313234" + "7a" // tag = 15, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "8001" // tag = 16, type = 0 + "01" // value = 1 + "8a01" // tag = 17, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 // required + "a806" // tag = 101, type = 0 + "6f" // value = 111 + "b006" // tag = 102, type = 0 + "70" // value = 112 + "b806" // tag = 103, type = 0 + "e201" // value = 226 (=113 zig-zag) + "c506" // tag = 104, type = 5 + "72000000" // value = 114 (fixed32) + "cd06" // tag = 105, type = 5 + "73000000" // value = 115 (sfixed32) + "d006" // tag = 106, type = 0 + "74" // value = 116 + "d806" // tag = 107, type = 0 + "75" // value = 117 + "e006" // tag = 108, type = 0 + "ec01" // value = 236 (=118 zigzag) + "e906" // tag = 109, type = 1 + "7700000000000000" // value = 119 + "f106" // tag = 110, type = 1 + "7800000000000000" // value = 120 + "f806" // tag = 111, type = 0 + "01" // value = 1 (true) + "8507" // tag = 112, type = 5 + "0000f442" // value = 122.0F + "8907" // tag = 113, type = 1 + "0000000000c05e40" // value = 123.0 + "9207" // tag = 114, type = 2 + "03" // length = 3 + "313234" // value = "124" + "9a07" // tag = 115, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "a007" // tag = 116, type = 0 + "01" // value = 1 + "aa07" // tag = 117, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 // repeated + "c80c" // tag = 201, type = 0 + "6f" // value = 111 + "c80c" // tag = 201, type = 0 + "6f" // value = 111 + "d00c" // tag = 202, type = 0 + "70" // value = 112 + "d00c" // tag = 202, type = 0 + "70" // value = 112 + "d80c" // tag = 203, type = 0 + "e201" // value = 226 (=113 zig-zag) + "d80c" // tag = 203, type = 0 + "e201" // value = 226 (=113 zig-zag) + "e50c" // tag = 204, type = 5 + "72000000" // value = 114 (fixed32) + "e50c" // tag = 204, type = 5 + "72000000" // value = 114 (fixed32) + "ed0c" // tag = 205, type = 5 + "73000000" // value = 115 (sfixed32) + "ed0c" // tag = 205, type = 5 + "73000000" // value = 115 (sfixed32) + "f00c" // tag = 206, type = 0 + "74" // value = 116 + "f00c" // tag = 206, type = 0 + "74" // value = 116 + "f80c" // tag = 207, type = 0 + "75" // value = 117 + "f80c" // tag = 207, type = 0 + "75" // value = 117 + "800d" // tag = 208, type = 0 + "ec01" // value = 236 (=118 zigzag) + "800d" // tag = 208, type = 0 + "ec01" // value = 236 (=118 zigzag) + "890d" // tag = 209, type = 1 + "7700000000000000" // value = 119 + "890d" // tag = 209, type = 1 + "7700000000000000" // value = 119 + "910d" // tag = 210, type = 1 + "7800000000000000" // value = 120 + "910d" // tag = 210, type = 1 + "7800000000000000" // value = 120 + "980d" // tag = 211, type = 0 + "01" // value = 1 (true) + "980d" // tag = 211, type = 0 + "01" // value = 1 (true) + "a50d" // tag = 212, type = 5 + "0000f442" // value = 122.0F + "a50d" // tag = 212, type = 5 + "0000f442" // value = 122.0F + "a90d" // tag = 213, type = 1 + "0000000000c05e40" // value = 123.0 + "a90d" // tag = 213, type = 1 + "0000000000c05e40" // value = 123.0 + "b20d" // tag = 214, type = 2 + "03" // length = 3 + "313234" // value = "124" + "b20d" // tag = 214, type = 2 + "03" // length = 3 + "313234" // value = "124" + "ba0d" // tag = 215, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "ba0d" // tag = 215, type = 2 + "02" // length = 2 + "7de1" // value = { 125, 225 } + "c00d" // tag = 216, type = 0 + "01" // value = 1 + "c00d" // tag = 216, type = 0 + "01" // value = 1 + "ca0d" // tag = 217, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 + "ca0d" // tag = 217, type = 2 + "03" // length = 3 + "08" // nested tag = 1, type = 0 + "e707" // value = 999 // packed + "e812" // tag = 301, type = 0 + "6f" // value = 111 + "e812" // tag = 301, type = 0 + "6f" // value = 111 + "f012" // tag = 302, type = 0 + "70" // value = 112 + "f012" // tag = 302, type = 0 + "70" // value = 112 + "f812" // tag = 303, type = 0 + "e201" // value = 226 (=113 zig-zag) + "f812" // tag = 303, type = - + "e201" // value = 226 (=113 zig-zag) + "8513" // tag = 304, type = 5 + "72000000" // value = 114 (fixed32) + "8513" // tag = 304, type = 5 + "72000000" // value = 114 (fixed32) + "8d13" // tag = 305, type = 5 + "73000000" // value = 115 (sfixed32) + "8d13" // tag = 305, type = 5 + "73000000" // value = 115 (sfixed32) + "9013" // tag = 306, type = 0 + "74" // value = 116 + "9013" // tag = 306, type = 0 + "74" // value = 116 + "9813" // tag = 307, type = 0 + "75" // value = 117 + "9813" // tag = 307, type = 0 + "75" // value = 117 + "a013" // tag = 308, type = 0 + "ec01" // value = 236 (=118 zigzag) + "a013" // tag = 308, type = 0 + "ec01" // value = 236 (=118 zigzag) + "a913" // tag = 309, type = 0 + "7700000000000000" // value = 119 + "a913" // tag = 309, type = 0 + "7700000000000000" // value = 119 + "b113" // tag = 310, type = 0 + "7800000000000000" // value = 120 + "b113" // tag = 310, type = 0 + "7800000000000000" // value = 120 + "b813" // tag = 311, type = 0 + "01" // value = 1 (true) + "b813" // tag = 311, type = 0 + "01" // value = 1 (true) + "c513" // tag = 312, type = 0 + "0000f442" // value = 122.0F + "c513" // tag = 312, type = 0 + "0000f442" // value = 122.0F + "c913" // tag = 313, type = 0 + "0000000000c05e40" // value = 123.0 + "c913" // tag = 313, type = 0 + "0000000000c05e40" // value = 123.0 + "e013" // tag = 316, type = 0 + "01" // value = 1 + "e013" // tag = 316, type = 0 + "01" // value = 1 // extension + "983f" // tag = 1011, type = 0 + "01" // value = 1 (true) + "b845" // tag = 1111, type = 0 + "01" // value = 1 (true) + "b845" // tag = 1111, type = 0 + "01" // value = 1 (true) + "d84b" // tag = 1211, type = 0 + "01" // value = 1 (true) + "d84b" // tag = 1211, type = 0 + "01"); // value = 1 (true) }
6,992
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/ParseTest.java
/* * Copyright (C) 2014 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 static org.junit.Assert.fail; import com.squareup.wire.protos.edgecases.OneBytesField; import com.squareup.wire.protos.edgecases.OneField; import com.squareup.wire.protos.edgecases.Recursive; import java.io.EOFException; import java.io.IOException; import java.net.ProtocolException; import okio.ByteString; import org.junit.Ignore; import org.junit.Test; public final class ParseTest { @Test public void unknownTagIgnored() throws Exception { // tag 1 / type 0: 456 // tag 2 / type 0: 789 ByteString data = ByteString.decodeHex("08c803109506"); OneField oneField = OneField.ADAPTER.decode(data.toByteArray()); OneField expected = new OneField.Builder().opt_int32(456).build(); assertThat(oneField).isNotEqualTo(expected); assertThat(oneField.withoutUnknownFields()).isEqualTo(expected); } @Test public void unknownTypeThrowsIOException() throws Exception { // tag 1 / type 0: 456 // tag 2 / type 7: 789 ByteString data = ByteString.decodeHex("08c803179506"); try { OneField.ADAPTER.decode(data.toByteArray()); fail(); } catch (ProtocolException expected) { assertThat(expected).hasMessage("Unexpected field encoding: 7"); } } @Ignore("TODO(jwilson)") @Test public void typeMismatchHonorsWireDeclaredType() throws Exception { // tag 1 / 3-byte length-delimited string: 0x109506 // (0x109506 is a well-formed proto message that sets tag 2 to 456). ByteString data = ByteString.decodeHex("0a03109506"); OneField oneField = OneField.ADAPTER.decode(data.toByteArray()); assertThat(oneField).isEqualTo(new OneField.Builder().opt_int32(3).build()); } @Test public void truncatedMessageThrowsEOFException() throws Exception { // tag 1 / 4-byte length delimited string: 0x000000 (3 bytes) ByteString data = ByteString.decodeHex("0a04000000"); try { OneBytesField.ADAPTER.decode(data.toByteArray()); fail(); } catch (EOFException expected) { } } @Ignore("we no longer enforce this constraint") @Test public void repeatedUnknownValueWithDifferentTypesThrowsIOException() throws Exception { // tag 2 / 3-byte length-delimited string: 0x109506 // tag 2 / type 0: 456 ByteString data = ByteString.decodeHex("120300000010c803"); try { OneField.ADAPTER.decode(data.toByteArray()); fail(); } catch (ProtocolException expected) { assertThat(expected) .hasMessage("Wire type VARINT differs from previous type LENGTH_DELIMITED for tag 2"); } } @Test public void lastValueWinsForRepeatedValueOfNonrepeatedField() throws Exception { // tag 1 / type 0: 456 // tag 1 / type 0: 789 ByteString data = ByteString.decodeHex("08c803089506"); OneField oneField = OneField.ADAPTER.decode(data.toByteArray()); assertThat(new OneField.Builder().opt_int32(789).build()).isEqualTo(oneField); } @Test public void upToRecursionLimit() throws Exception { // tag 2: nested message (64 times) // tag 1: signed varint32 456 ByteString data = ByteString.decodeHex( "127e127c127a12781276127412721270126e126c126a12681266126" + "412621260125e125c125a12581256125412521250124e124c124a12481246124412421240123e123c123a123" + "81236123412321230122e122c122a12281226122412221220121e121c121a12181216121412121210120e120" + "c120a1208120612041202120008c803"); Recursive recursive = Recursive.ADAPTER.decode(data.toByteArray()); assertThat(recursive.value.intValue()).isEqualTo(456); } @Test public void overRecursionLimitThrowsIOException() throws Exception { // tag 2: nested message (65 times) // tag 1: signed varint32 456 ByteString data = ByteString.decodeHex( "128001127e127c127a12781276127412721270126e126c126a12681" + "266126412621260125e125c125a12581256125412521250124e124c124a12481246124412421240123e123c1" + "23a12381236123412321230122e122c122a12281226122412221220121e121c121a121812161214121212101" + "20e120c120a1208120612041202120008c803"); try { Recursive.ADAPTER.decode(data.toByteArray()); fail(); } catch (IOException expected) { assertThat(expected).hasMessage("Wire recursion limit exceeded"); } } }
6,993
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/SerializableTest.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.wire; import static org.assertj.core.api.Assertions.assertThat; import com.squareup.wire.protos.edgecases.NoFields; import com.squareup.wire.protos.person.Person; import com.squareup.wire.protos.simple.SimpleMessage; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Arrays; import okio.Buffer; import okio.ByteString; import org.junit.Test; public class SerializableTest { @Test public void simple() throws Exception { SimpleMessage message = new SimpleMessage.Builder().required_int32(42).build(); assertThat(deserialize(serialize(message))).isEqualTo(message); } @Test public void nestedMessage() throws Exception { Person person = new Person.Builder() .name("Omar") .id(1234) .email("omar@wire.com") .phone( Arrays.asList( new Person.PhoneNumber.Builder() .number("410-555-0909") .type(Person.PhoneType.MOBILE) .build())) .build(); assertThat(deserialize(serialize(person))).isEqualTo(person); } @Test public void noFields() throws Exception { NoFields noFields = new NoFields(); assertThat(deserialize(serialize(noFields))).isEqualTo(noFields); } @Test public void decodeGolden() throws Exception { SimpleMessage goldenValue = new SimpleMessage.Builder().required_int32(99).result("tacos").build(); ByteString goldenSerialized = ByteString.decodeBase64( "rO0ABXNyACdjb20uc3F1YXJldXAud2lyZS5NZXNz" + "YWdlU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAlsABWJ5dGVzdAACW0JMAAxtZXNzYWdlQ2xhc3N0ABFMamF2YS9s" + "YW5nL0NsYXNzO3hwdXIAAltCrPMX+AYIVOACAAB4cAAAAAkoY1IFdGFjb3N2cgAtY29tLnNxdWFyZXVwLndpcmUu" + "cHJvdG9zLnNpbXBsZS5TaW1wbGVNZXNzYWdlAAAAAAAAAAACAAxMABRkZWZhdWx0X2ZvcmVpZ25fZW51bXQALkxj" + "b20vc3F1YXJldXAvd2lyZS9wcm90b3MvZm9yZWlnbi9Gb3JlaWduRW51bTtMABNkZWZhdWx0X25lc3RlZF9lbnVt" + "dAA6TGNvbS9zcXVhcmV1cC93aXJlL3Byb3Rvcy9zaW1wbGUvU2ltcGxlTWVzc2FnZSROZXN0ZWRFbnVtO0wAF25v" + "X2RlZmF1bHRfZm9yZWlnbl9lbnVtcQB+AAdMAAFvdAASTGphdmEvbGFuZy9TdHJpbmc7TAAVb3B0aW9uYWxfZXh0" + "ZXJuYWxfbXNndAAxTGNvbS9zcXVhcmV1cC93aXJlL3Byb3Rvcy9zaW1wbGUvRXh0ZXJuYWxNZXNzYWdlO0wADm9w" + "dGlvbmFsX2ludDMydAATTGphdmEvbGFuZy9JbnRlZ2VyO0wAE29wdGlvbmFsX25lc3RlZF9tc2d0AD1MY29tL3Nx" + "dWFyZXVwL3dpcmUvcHJvdG9zL3NpbXBsZS9TaW1wbGVNZXNzYWdlJE5lc3RlZE1lc3NhZ2U7TAAFb3RoZXJxAH4A" + "CUwACHBhY2thZ2VfcQB+AAlMAA9yZXBlYXRlZF9kb3VibGV0ABBMamF2YS91dGlsL0xpc3Q7TAAOcmVxdWlyZWRf" + "aW50MzJxAH4AC0wABnJlc3VsdHEAfgAJeHIAGWNvbS5zcXVhcmV1cC53aXJlLk1lc3NhZ2UAAAAAAAAAAAIAAHhw"); assertThat(deserialize(goldenSerialized)).isEqualTo(goldenValue); assertThat(serialize(goldenValue)).isEqualTo(goldenSerialized); } private static ByteString serialize(Message message) throws Exception { Buffer buffer = new Buffer(); ObjectOutputStream stream = new ObjectOutputStream(buffer.outputStream()); stream.writeObject(message); stream.flush(); return buffer.readByteString(); } public static Object deserialize(ByteString data) throws Exception { Buffer buffer = new Buffer().write(data); ObjectInputStream stream = new ObjectInputStream(buffer.inputStream()); return stream.readObject(); } }
6,994
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/TestAllTypes.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.protos.alltypes.AllTypes.NestedEnum.A; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; import com.squareup.wire.protos.alltypes.AllTypes; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import okio.Buffer; import okio.ByteString; import okio.ForwardingSource; import okio.Okio; import okio.Source; import org.junit.Ignore; import org.junit.Test; public class TestAllTypes { // Return a two-element list with a given repeated value private static <T> List<T> list(T x) { return list(x, 2); } private static <T> List<T> list(T x, int numRepeated) { List<T> data = new ArrayList<>(numRepeated); for (int i = 0; i < numRepeated; i++) { data.add(x); } return data; } private static AllTypes.Builder getBuilder() { return getBuilder(2); } private static AllTypes.Builder getBuilder(int numRepeated) { ByteString bytes = ByteString.of((byte) 125, (byte) 225); AllTypes.NestedMessage nestedMessage = new AllTypes.NestedMessage.Builder().a(999).build(); return new AllTypes.Builder() .opt_int32(111) .opt_uint32(112) .opt_sint32(113) .opt_fixed32(114) .opt_sfixed32(115) .opt_int64(116L) .opt_uint64(117L) .opt_sint64(118L) .opt_fixed64(119L) .opt_sfixed64(120L) .opt_bool(true) .opt_float(122.0F) .opt_double(123.0) .opt_string("124") .opt_bytes(bytes) .opt_nested_enum(A) .opt_nested_message(nestedMessage) .req_int32(111) .req_uint32(112) .req_sint32(113) .req_fixed32(114) .req_sfixed32(115) .req_int64(116L) .req_uint64(117L) .req_sint64(118L) .req_fixed64(119L) .req_sfixed64(120L) .req_bool(true) .req_float(122.0F) .req_double(123.0) .req_string("124") .req_bytes(bytes) .req_nested_enum(A) .req_nested_message(nestedMessage) .rep_int32(list(111, numRepeated)) .rep_uint32(list(112, numRepeated)) .rep_sint32(list(113, numRepeated)) .rep_fixed32(list(114, numRepeated)) .rep_sfixed32(list(115, numRepeated)) .rep_int64(list(116L, numRepeated)) .rep_uint64(list(117L, numRepeated)) .rep_sint64(list(118L, numRepeated)) .rep_fixed64(list(119L, numRepeated)) .rep_sfixed64(list(120L, numRepeated)) .rep_bool(list(true, numRepeated)) .rep_float(list(122.0F, numRepeated)) .rep_double(list(123.0, numRepeated)) .rep_string(list("124", numRepeated)) .rep_bytes(list(bytes, numRepeated)) .rep_nested_enum(list(A, numRepeated)) .rep_nested_message(list(nestedMessage, numRepeated)) .pack_int32(list(111, numRepeated)) .pack_uint32(list(112, numRepeated)) .pack_sint32(list(113, numRepeated)) .pack_fixed32(list(114, numRepeated)) .pack_sfixed32(list(115, numRepeated)) .pack_int64(list(116L, numRepeated)) .pack_uint64(list(117L, numRepeated)) .pack_sint64(list(118L, numRepeated)) .pack_fixed64(list(119L, numRepeated)) .pack_sfixed64(list(120L, numRepeated)) .pack_bool(list(true, numRepeated)) .pack_float(list(122.0F, numRepeated)) .pack_double(list(123.0, numRepeated)) .pack_nested_enum(list(A, numRepeated)) .ext_opt_bool(true) .ext_rep_bool(list(true, numRepeated)) .ext_pack_bool(list(true, numRepeated)); } private final AllTypes allTypes = createAllTypes(); private final ProtoAdapter<AllTypes> adapter = AllTypes.ADAPTER; private AllTypes createAllTypes(int numRepeated) { return getBuilder(numRepeated).build(); } private AllTypes createAllTypes() { return getBuilder().build(); } @Test public void testHashCodes() { AllTypes.Builder builder = getBuilder(); AllTypes message = builder.build(); int messageHashCode = message.hashCode(); assertThat(messageHashCode).isEqualTo(allTypes.hashCode()); } @Test public void testBuilder() { AllTypes.Builder builder = getBuilder(); AllTypes.NestedMessage nestedMessage = new AllTypes.NestedMessage.Builder().a(999).build(); assertThat(builder.opt_int32).isEqualTo(new Integer(111)); assertThat(builder.opt_uint32).isEqualTo(new Integer(112)); assertThat(builder.opt_sint32).isEqualTo(new Integer(113)); assertThat(builder.opt_fixed32).isEqualTo(new Integer(114)); assertThat(builder.opt_sfixed32).isEqualTo(new Integer(115)); assertThat(builder.opt_int64).isEqualTo(new Long(116L)); assertThat(builder.opt_uint64).isEqualTo(new Long(117L)); assertThat(builder.opt_sint64).isEqualTo(new Long(118L)); assertThat(builder.opt_fixed64).isEqualTo(new Long(119L)); assertThat(builder.opt_sfixed64).isEqualTo(new Long(120L)); assertThat(builder.opt_bool).isEqualTo(Boolean.TRUE); assertThat(builder.opt_float).isEqualTo(new Float(122.0F)); assertThat(builder.opt_double).isEqualTo(new Double(123.0)); assertThat(builder.opt_string).isEqualTo("124"); assertThat(builder.opt_bytes).isEqualTo(ByteString.of((byte) 125, (byte) 225)); assertThat(builder.opt_nested_enum).isEqualTo(A); assertThat(builder.opt_nested_message).isEqualTo(nestedMessage); assertThat(builder.req_int32).isEqualTo(new Integer(111)); assertThat(builder.req_uint32).isEqualTo(new Integer(112)); assertThat(builder.req_sint32).isEqualTo(new Integer(113)); assertThat(builder.req_fixed32).isEqualTo(new Integer(114)); assertThat(builder.req_sfixed32).isEqualTo(new Integer(115)); assertThat(builder.req_int64).isEqualTo(new Long(116L)); assertThat(builder.req_uint64).isEqualTo(new Long(117L)); assertThat(builder.req_sint64).isEqualTo(new Long(118L)); assertThat(builder.req_fixed64).isEqualTo(new Long(119L)); assertThat(builder.req_sfixed64).isEqualTo(new Long(120L)); assertThat(builder.req_bool).isEqualTo(Boolean.TRUE); assertThat(builder.req_float).isEqualTo(new Float(122.0F)); assertThat(builder.req_double).isEqualTo(new Double(123.0)); assertThat(builder.req_string).isEqualTo("124"); assertThat(builder.req_bytes).isEqualTo(ByteString.of((byte) 125, (byte) 225)); assertThat(builder.req_nested_enum).isEqualTo(A); assertThat(builder.req_nested_message).isEqualTo(nestedMessage); assertThat(builder.rep_int32).hasSize(2); assertThat(builder.rep_int32.get(0)).isEqualTo(new Integer(111)); assertThat(builder.rep_int32.get(1)).isEqualTo(new Integer(111)); assertThat(builder.rep_uint32).hasSize(2); assertThat(builder.rep_uint32.get(0)).isEqualTo(new Integer(112)); assertThat(builder.rep_uint32.get(1)).isEqualTo(new Integer(112)); assertThat(builder.rep_sint32).hasSize(2); assertThat(builder.rep_sint32.get(0)).isEqualTo(new Integer(113)); assertThat(builder.rep_sint32.get(1)).isEqualTo(new Integer(113)); assertThat(builder.rep_fixed32).hasSize(2); assertThat(builder.rep_fixed32.get(0)).isEqualTo(new Integer(114)); assertThat(builder.rep_fixed32.get(1)).isEqualTo(new Integer(114)); assertThat(builder.rep_sfixed32).hasSize(2); assertThat(builder.rep_sfixed32.get(0)).isEqualTo(new Integer(115)); assertThat(builder.rep_sfixed32.get(1)).isEqualTo(new Integer(115)); assertThat(builder.rep_int64).hasSize(2); assertThat(builder.rep_int64.get(0)).isEqualTo(new Long(116L)); assertThat(builder.rep_int64.get(1)).isEqualTo(new Long(116L)); assertThat(builder.rep_uint64).hasSize(2); assertThat(builder.rep_uint64.get(0)).isEqualTo(new Long(117L)); assertThat(builder.rep_uint64.get(1)).isEqualTo(new Long(117L)); assertThat(builder.rep_sint64).hasSize(2); assertThat(builder.rep_sint64.get(0)).isEqualTo(new Long(118L)); assertThat(builder.rep_sint64.get(1)).isEqualTo(new Long(118L)); assertThat(builder.rep_fixed64).hasSize(2); assertThat(builder.rep_fixed64.get(0)).isEqualTo(new Long(119L)); assertThat(builder.rep_fixed64.get(1)).isEqualTo(new Long(119L)); assertThat(builder.rep_sfixed64).hasSize(2); assertThat(builder.rep_sfixed64.get(0)).isEqualTo(new Long(120L)); assertThat(builder.rep_sfixed64.get(1)).isEqualTo(new Long(120L)); assertThat(builder.rep_bool).hasSize(2); assertThat(builder.rep_bool.get(0)).isEqualTo(Boolean.TRUE); assertThat(builder.rep_bool.get(1)).isEqualTo(Boolean.TRUE); assertThat(builder.rep_float).hasSize(2); assertThat(builder.rep_float.get(0)).isEqualTo(new Float(122.0F)); assertThat(builder.rep_float.get(1)).isEqualTo(new Float(122.0F)); assertThat(builder.rep_double).hasSize(2); assertThat(builder.rep_double.get(0)).isEqualTo(new Double(123.0)); assertThat(builder.rep_double.get(1)).isEqualTo(new Double(123.0)); assertThat(builder.rep_string).hasSize(2); assertThat(builder.rep_string.get(0)).isEqualTo("124"); assertThat(builder.rep_string.get(1)).isEqualTo("124"); assertThat(builder.rep_bytes).hasSize(2); assertThat(builder.rep_bytes.get(0)).isEqualTo(ByteString.of((byte) 125, (byte) 225)); assertThat(builder.rep_bytes.get(1)).isEqualTo(ByteString.of((byte) 125, (byte) 225)); assertThat(builder.rep_nested_enum).hasSize(2); assertThat(builder.rep_nested_enum.get(0)).isEqualTo(A); assertThat(builder.rep_nested_enum.get(1)).isEqualTo(A); assertThat(builder.rep_nested_message).hasSize(2); assertThat(builder.rep_nested_message.get(0)).isEqualTo(nestedMessage); assertThat(builder.rep_nested_message.get(1)).isEqualTo(nestedMessage); assertThat(builder.pack_int32).hasSize(2); assertThat(builder.pack_int32.get(0)).isEqualTo(new Integer(111)); assertThat(builder.pack_int32.get(1)).isEqualTo(new Integer(111)); assertThat(builder.pack_uint32).hasSize(2); assertThat(builder.pack_uint32.get(0)).isEqualTo(new Integer(112)); assertThat(builder.pack_uint32.get(1)).isEqualTo(new Integer(112)); assertThat(builder.pack_sint32).hasSize(2); assertThat(builder.pack_sint32.get(0)).isEqualTo(new Integer(113)); assertThat(builder.pack_sint32.get(1)).isEqualTo(new Integer(113)); assertThat(builder.pack_fixed32).hasSize(2); assertThat(builder.pack_fixed32.get(0)).isEqualTo(new Integer(114)); assertThat(builder.pack_fixed32.get(1)).isEqualTo(new Integer(114)); assertThat(builder.pack_sfixed32).hasSize(2); assertThat(builder.pack_sfixed32.get(0)).isEqualTo(new Integer(115)); assertThat(builder.pack_sfixed32.get(1)).isEqualTo(new Integer(115)); assertThat(builder.pack_int64).hasSize(2); assertThat(builder.pack_int64.get(0)).isEqualTo(new Long(116L)); assertThat(builder.pack_int64.get(1)).isEqualTo(new Long(116L)); assertThat(builder.pack_uint64).hasSize(2); assertThat(builder.pack_uint64.get(0)).isEqualTo(new Long(117L)); assertThat(builder.pack_uint64.get(1)).isEqualTo(new Long(117L)); assertThat(builder.pack_sint64).hasSize(2); assertThat(builder.pack_sint64.get(0)).isEqualTo(new Long(118L)); assertThat(builder.pack_sint64.get(1)).isEqualTo(new Long(118L)); assertThat(builder.pack_fixed64).hasSize(2); assertThat(builder.pack_fixed64.get(0)).isEqualTo(new Long(119L)); assertThat(builder.pack_fixed64.get(1)).isEqualTo(new Long(119L)); assertThat(builder.pack_sfixed64).hasSize(2); assertThat(builder.pack_sfixed64.get(0)).isEqualTo(new Long(120L)); assertThat(builder.pack_sfixed64.get(1)).isEqualTo(new Long(120L)); assertThat(builder.pack_bool).hasSize(2); assertThat(builder.pack_bool.get(0)).isEqualTo(Boolean.TRUE); assertThat(builder.pack_bool.get(1)).isEqualTo(Boolean.TRUE); assertThat(builder.pack_float).hasSize(2); assertThat(builder.pack_float.get(0)).isEqualTo(new Float(122.0F)); assertThat(builder.pack_float.get(1)).isEqualTo(new Float(122.0F)); assertThat(builder.pack_double).hasSize(2); assertThat(builder.pack_double.get(0)).isEqualTo(new Double(123.0)); assertThat(builder.pack_double.get(1)).isEqualTo(new Double(123.0)); assertThat(builder.pack_nested_enum).hasSize(2); assertThat(builder.pack_nested_enum.get(0)).isEqualTo(A); assertThat(builder.pack_nested_enum.get(1)).isEqualTo(A); assertThat(builder.ext_opt_bool).isEqualTo(Boolean.TRUE); assertThat(builder.ext_rep_bool).isEqualTo(list(true)); assertThat(builder.ext_pack_bool).isEqualTo(list(true)); builder.ext_opt_bool(false); builder.ext_rep_bool(list(false)); builder.ext_pack_bool(list(false)); assertThat(builder.ext_opt_bool).isEqualTo(Boolean.FALSE); assertThat(builder.ext_rep_bool).isEqualTo(list(false)); assertThat(builder.ext_pack_bool).isEqualTo(list(false)); } @Test public void testInitBuilder() { AllTypes.Builder builder = allTypes.newBuilder(); assertThat(builder.build()).isEqualTo(allTypes); builder.opt_bool = false; assertThat(builder.build()).isNotSameAs(allTypes); } @Test public void testWrite() { byte[] output = adapter.encode(allTypes); assertThat(output.length).isEqualTo(TestAllTypesData.expectedOutput.size()); assertThat(ByteString.of(output)).isEqualTo(TestAllTypesData.expectedOutput); } @Test public void testWriteSource() throws IOException { Buffer sink = new Buffer(); adapter.encode(sink, allTypes); assertThat(sink.readByteString()).isEqualTo(TestAllTypesData.expectedOutput); } @Test public void testWriteBytes() throws IOException { byte[] output = adapter.encode(allTypes); assertThat(output.length).isEqualTo(TestAllTypesData.expectedOutput.size()); assertThat(ByteString.of(output)).isEqualTo(TestAllTypesData.expectedOutput); } @Test public void testWriteStream() throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); adapter.encode(stream, allTypes); byte[] output = stream.toByteArray(); assertThat(output.length).isEqualTo(TestAllTypesData.expectedOutput.size()); assertThat(ByteString.of(output)).isEqualTo(TestAllTypesData.expectedOutput); } @Test public void testReadSource() throws IOException { byte[] data = adapter.encode(allTypes); Buffer input = new Buffer().write(data); AllTypes parsed = adapter.decode(input); assertThat(parsed).isEqualTo(allTypes); assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE); assertThat(allTypes.ext_rep_bool).isEqualTo(list(true)); assertThat(allTypes.ext_pack_bool).isEqualTo(list(true)); } @Test public void testReadBytes() throws IOException { byte[] data = adapter.encode(allTypes); AllTypes parsed = adapter.decode(data); assertThat(parsed).isEqualTo(allTypes); assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE); assertThat(allTypes.ext_rep_bool).isEqualTo(list(true)); assertThat(allTypes.ext_pack_bool).isEqualTo(list(true)); } @Test public void testReadStream() throws IOException { byte[] data = adapter.encode(allTypes); InputStream stream = new ByteArrayInputStream(data); AllTypes parsed = adapter.decode(stream); assertThat(parsed).isEqualTo(allTypes); assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE); assertThat(allTypes.ext_rep_bool).isEqualTo(list(true)); assertThat(allTypes.ext_pack_bool).isEqualTo(list(true)); } @Test public void testReadLongMessages() throws IOException { AllTypes allTypes = createAllTypes(50); byte[] data = adapter.encode(allTypes); AllTypes parsed = adapter.decode(data); assertThat(parsed).isEqualTo(allTypes); assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE); assertThat(allTypes.ext_rep_bool).isEqualTo(list(true, 50)); assertThat(allTypes.ext_pack_bool).isEqualTo(list(true, 50)); } /** A source that returns 1, 2, 3, or 4 bytes at a time. */ private static class SlowSource extends ForwardingSource { private long pos; SlowSource(Source delegate) { super(delegate); } @Override public long read(Buffer sink, long byteCount) throws IOException { long bytesToReturn = Math.min(byteCount, (pos % 4) + 1); pos += bytesToReturn; return super.read(sink, byteCount); } } @Test public void testReadFromSlowSource() throws IOException { byte[] data = adapter.encode(allTypes); Source input = new SlowSource(new Buffer().write(data)); AllTypes parsed = adapter.decode(Okio.buffer(input)); assertThat(parsed).isEqualTo(allTypes); assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE); assertThat(allTypes.ext_rep_bool).isEqualTo(list(true)); assertThat(allTypes.ext_pack_bool).isEqualTo(list(true)); } @Test public void testReadNoExtension() throws IOException { byte[] data = adapter.encode(allTypes); AllTypes parsed = AllTypes.ADAPTER.decode(data); assertThat(allTypes).isEqualTo(parsed); } @Test public void testReadNonPacked() throws IOException { AllTypes parsed = adapter.decode(new Buffer().write(TestAllTypesData.nonPacked)); assertThat(parsed).isEqualTo(allTypes); } @Test public void testToString() throws IOException { byte[] data = adapter.encode(allTypes); AllTypes parsed = adapter.decode(data); assertThat(parsed.toString()).isEqualTo(TestAllTypesData.expectedToString); } @Test public void testRequiredFields() { AllTypes.Builder builder = getBuilder(); builder.build(); builder.req_bool(null); try { builder.build(); fail(); } catch (IllegalStateException e) { assertThat(e.getMessage()).isEqualTo("Required field not set:\n req_bool"); } builder.req_int32(null); builder.req_sfixed64(null); try { builder.build(); fail(); } catch (IllegalStateException e) { assertThat(e).hasMessage("Required fields not set:\n req_int32\n req_sfixed64\n req_bool"); } } @Test public void testDefaults() throws Exception { assertThat(AllTypes.DEFAULT_DEFAULT_BOOL).isEqualTo((Object) true); // original: "<c-cedilla>ok\a\b\f\n\r\t\v\1\01\001\17\017\176\x1\x01\x11\X1\X01\X11g<u // umlaut>zel" assertThat(AllTypes.DEFAULT_DEFAULT_STRING) .isEqualTo( "çok\u0007\b\f\n\r\t\u000b\u0001\u0001" + "\u0001\u000f\u000f~\u0001\u0001\u0011\u0001\u0001\u0011güzel"); assertThat(new String(AllTypes.DEFAULT_DEFAULT_BYTES.toByteArray(), "ISO-8859-1")) .isEqualTo( "çok\u0007\b\f\n\r\t\u000b\u0001\u0001\u0001\u000f\u000f~\u0001\u0001\u0011\u0001\u0001" + "\u0011güzel"); } @Test public void testEnums() { assertThat(AllTypes.NestedEnum.fromValue(1)).isEqualTo(A); assertThat(AllTypes.NestedEnum.fromValue(10)).isNull(); assertThat(A.getValue()).isEqualTo(1); } @Test public void testSkipGroup() throws IOException { byte[] data = new byte[TestAllTypesData.expectedOutput.size() + 27]; System.arraycopy(TestAllTypesData.expectedOutput.toByteArray(), 0, data, 0, 17); int index = 17; data[index++] = (byte) 0xa3; // start group, tag = 20, type = 3 data[index++] = (byte) 0x01; data[index++] = (byte) 0x08; // tag = 1, type = 0 (varint) data[index++] = (byte) 0x81; data[index++] = (byte) 0x82; data[index++] = (byte) 0x6f; data[index++] = (byte) 0x21; // tag = 2, type = 1 (fixed64) data[index++] = (byte) 0x01; data[index++] = (byte) 0x02; data[index++] = (byte) 0x03; data[index++] = (byte) 0x04; data[index++] = (byte) 0x05; data[index++] = (byte) 0x06; data[index++] = (byte) 0x07; data[index++] = (byte) 0x08; data[index++] = (byte) 0x1a; // tag = 3, type = 2 (length-delimited) data[index++] = (byte) 0x03; // length = 3 data[index++] = (byte) 0x01; data[index++] = (byte) 0x02; data[index++] = (byte) 0x03; data[index++] = (byte) 0x25; // tag = 4, type = 5 (fixed32) data[index++] = (byte) 0x01; data[index++] = (byte) 0x02; data[index++] = (byte) 0x03; data[index++] = (byte) 0x04; data[index++] = (byte) 0xa4; // end group, tag = 20, type = 4 data[index++] = (byte) 0x01; System.arraycopy( TestAllTypesData.expectedOutput.toByteArray(), 17, data, index, TestAllTypesData.expectedOutput.size() - 17); AllTypes parsed = adapter.decode(data); assertThat(parsed).isEqualTo(allTypes); } @Test public void testUnknownFields() { AllTypes.Builder builder = getBuilder(); builder.addUnknownField(10000, FieldEncoding.VARINT, 1L); AllTypes withUnknownField = builder.build(); byte[] data = adapter.encode(withUnknownField); int count = TestAllTypesData.expectedOutput.size(); assertThat(data.length).isEqualTo(count + 4); assertThat(data[count]).isEqualTo((byte) 0x80); assertThat(data[count + 1]).isEqualTo((byte) 0xf1); assertThat(data[count + 2]).isEqualTo((byte) 0x04); assertThat(data[count + 3]).isEqualTo((byte) 0x01); } @Test @Ignore("we no longer enforce this constraint") public void testUnknownFieldsTypeMismatch() { AllTypes.Builder builder = getBuilder(); builder.addUnknownField(10000, FieldEncoding.VARINT, 1); try { // Don't allow heterogeneous types for the same tag builder.addUnknownField(10000, FieldEncoding.FIXED32, 2); fail(); } catch (IllegalArgumentException expected) { assertThat(expected) .hasMessage("Wire type FIXED32 differs from previous type VARINT for tag 10000"); } } @Test public void testNullInRepeated() { try { // A null value for a repeated field is not allowed. getBuilder().rep_nested_enum(Arrays.asList(A, null, A)); fail(); } catch (NullPointerException e) { assertThat(e).hasMessage("Element at index 1 is null"); } } @Test public void testNullRepeated() { try { // A null value for a repeated field is not allowed. getBuilder().rep_nested_enum(null); fail(); } catch (NullPointerException e) { assertThat(e) .hasMessage( "Parameter specified as non-null is null: method " + "com.squareup.wire.internal.Internal__InternalKt.checkElementsNotNull, parameter list"); } } }
6,995
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/UnknownFieldsTest.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 org.assertj.core.api.Assertions.assertThat; import com.squareup.wire.protos.unknownfields.EnumVersionTwo; import com.squareup.wire.protos.unknownfields.NestedVersionOne; import com.squareup.wire.protos.unknownfields.NestedVersionTwo; import com.squareup.wire.protos.unknownfields.VersionOne; import com.squareup.wire.protos.unknownfields.VersionTwo; import java.io.IOException; import java.util.Arrays; import okio.ByteString; import org.junit.Test; public class UnknownFieldsTest { private final ProtoAdapter<VersionOne> v1Adapter = VersionOne.ADAPTER; private final ProtoAdapter<VersionTwo> v2Adapter = VersionTwo.ADAPTER; @Test public void testUnknownFields() throws IOException { NestedVersionOne v1_obj = new NestedVersionOne.Builder().i(111).build(); NestedVersionTwo v2_obj = new NestedVersionTwo.Builder() .i(111) .v2_i(12345) .v2_s("222") .v2_f32(67890) .v2_f64(98765L) .v2_rs(Arrays.asList("1", "2")) .build(); VersionTwo v2 = new VersionTwo.Builder() .i(111) .v2_i(12345) .v2_s("222") .v2_f32(67890) .v2_f64(98765L) .v2_rs(Arrays.asList("1", "2")) .obj(v2_obj) .build(); assertThat(v2.i).isEqualTo(new Integer(111)); assertThat(v2.obj).isEqualTo(v2_obj.newBuilder().build()); // Check v.2 fields assertThat(v2.v2_i).isEqualTo(new Integer(12345)); assertThat(v2.v2_s).isEqualTo("222"); assertThat(v2.v2_f32).isEqualTo(new Integer(67890)); assertThat(v2.v2_f64).isEqualTo(new Long(98765L)); assertThat(v2.v2_rs).containsExactly("1", "2"); // Serialized byte[] v2Bytes = v2Adapter.encode(v2); // Parse VersionOne v1 = v1Adapter.decode(v2Bytes); // v.1 fields are visible, v.2 fields are in unknownFieldSet assertThat(v1.i).isEqualTo(new Integer(111)); assertThat(v1.obj.withoutUnknownFields()).isEqualTo(v1_obj); // Serialized output should still contain the v.2 fields byte[] v1Bytes = v1Adapter.encode(v1); // Unknown fields participate in equals() and hashCode() VersionOne v1Simple = new VersionOne.Builder().i(111).obj(v1_obj).build(); assertThat(v1).isNotEqualTo(v1Simple); assertThat(v1.hashCode()).isNotEqualTo(v1Simple.hashCode()); assertThat(v1Adapter.encode(v1)).isNotEqualTo(v1Adapter.encode(v1Simple)); // Unknown fields can be removed for equals() and hashCode(); VersionOne v1Known = v1.withoutUnknownFields().newBuilder().obj(v1.obj.withoutUnknownFields()).build(); assertThat(v1Known).isEqualTo(v1Simple); assertThat(v1Known.hashCode()).isEqualTo(v1Simple.hashCode()); assertThat(v1Adapter.encode(v1Known)).isEqualTo(v1Adapter.encode(v1Simple)); // Re-parse VersionTwo v2B = v2Adapter.decode(v1Bytes); assertThat(v2B.i).isEqualTo(new Integer(111)); assertThat(v2B.v2_i).isEqualTo(new Integer(12345)); assertThat(v2B.v2_s).isEqualTo("222"); assertThat(v2B.v2_f32).isEqualTo(new Integer(67890)); assertThat(v2B.v2_f64).isEqualTo(new Long(98765L)); assertThat(v2B.v2_rs).containsExactly("1", "2"); assertThat(v2B.obj).isEqualTo(v2_obj); // "Modify" v1 via a merged builder, serialize, and re-parse VersionOne v1Modified = v1.newBuilder().i(777).obj(v1_obj.newBuilder().i(777).build()).build(); assertThat(v1Modified.i).isEqualTo(new Integer(777)); assertThat(v1Modified.obj).isEqualTo(v1_obj.newBuilder().i(777).build()); byte[] v1ModifiedBytes = v1Adapter.encode(v1Modified); VersionTwo v2C = v2Adapter.decode(v1ModifiedBytes); assertThat(v2C.i).isEqualTo(new Integer(777)); assertThat(v2C.v2_i).isEqualTo(new Integer(12345)); assertThat(v2C.v2_s).isEqualTo("222"); assertThat(v2C.v2_f32).isEqualTo(new Integer(67890)); assertThat(v2C.v2_f64).isEqualTo(new Long(98765L)); assertThat(v2C.obj).isEqualTo(new NestedVersionTwo.Builder().i(777).build()); assertThat(v2C.v2_rs).containsExactly("1", "2"); } @Test public void repeatedCallsToBuildRetainUnknownFields() throws IOException { VersionTwo v2 = new VersionTwo.Builder() .i(111) .v2_i(12345) .v2_s("222") .v2_f32(67890) .v2_f64(98765L) .v2_rs(Arrays.asList("1", "2")) .build(); // Serializes v2 and decodes it as a VersionOne. byte[] v2Bytes = v2Adapter.encode(v2); VersionOne.Builder v1Builder = v1Adapter.decode(v2Bytes).newBuilder(); // Builds v1Builder. It should equal to v2. VersionOne v1A = v1Builder.build(); VersionTwo fromV1A = v2Adapter.decode(v1Adapter.encode(v1A)); assertThat(fromV1A).isEqualTo(v2); // Build v1Builder again. It should retain unknown fields. VersionOne v1B = v1Builder.build(); VersionTwo fromV1B = v2Adapter.decode(v1Adapter.encode(v1B)); assertThat(fromV1B).isEqualTo(v2); } @Test public void unknownFieldsCanBeAddedBetweenCallsToBuild() throws IOException { VersionTwo v2A = new VersionTwo.Builder().i(111).v2_i(12345).v2_s("222").v2_f32(67890).build(); VersionTwo v2B = new VersionTwo.Builder().v2_f64(98765L).build(); VersionTwo v2C = new VersionTwo.Builder().v2_rs(Arrays.asList("1", "2")).build(); // A combination of v1A and v1B. VersionTwo v2AB = v2A.newBuilder().v2_f64(v2B.v2_f64).build(); // A combination of v1A, v1B and v1C. VersionTwo v2All = v2AB.newBuilder().v2_rs(v2C.v2_rs).build(); // Serializes v2A and decodes it as a VersionOne. byte[] v2ABytes = v2Adapter.encode(v2A); VersionOne v1 = v1Adapter.decode(v2ABytes); VersionOne.Builder v1Builder = v1.newBuilder(); // Serializes v2B and decodes it as a VersionOne. byte[] v2BBytes = v2Adapter.encode(v2B); VersionOne v1B = v1Adapter.decode(v2BBytes); // Serializes v2C and decodes it as a VersionOne. byte[] v2CBytes = v2Adapter.encode(v2C); VersionOne v1C = v1Adapter.decode(v2CBytes); // Adds the unknown fields of v1B to v1Builder. The built message should equal to v2AB. VersionOne v1AB = v1Builder.addUnknownFields(v1B.unknownFields()).build(); VersionTwo fromV1AB = v2Adapter.decode(v1Adapter.encode(v1AB)); assertThat(fromV1AB).isEqualTo(v2AB); assertThat(fromV1AB.i).isEqualTo(new Integer(111)); assertThat(fromV1AB.v2_i).isEqualTo(new Integer(12345)); assertThat(fromV1AB.v2_s).isEqualTo("222"); assertThat(fromV1AB.v2_f32).isEqualTo(new Integer(67890)); assertThat(fromV1AB.v2_f64).isEqualTo(new Long(98765L)); assertThat(fromV1AB.v2_rs).isEmpty(); // Also Adds the unknown fields of v1C to v1Builder. The built message should equals to v2All. VersionOne v1All = v1Builder.addUnknownFields(v1C.unknownFields()).build(); VersionTwo fromV1All = v2Adapter.decode(v1Adapter.encode(v1All)); assertThat(fromV1All).isEqualTo(v2All); assertThat(fromV1All.i).isEqualTo(new Integer(111)); assertThat(fromV1All.v2_i).isEqualTo(new Integer(12345)); assertThat(fromV1All.v2_s).isEqualTo("222"); assertThat(fromV1All.v2_f32).isEqualTo(new Integer(67890)); assertThat(fromV1All.v2_f64).isEqualTo(new Long(98765L)); assertThat(fromV1All.v2_rs).containsExactly("1", "2"); } @Test public void unknownFieldsCanBeAddedAfterClearingUnknownFields() throws IOException { VersionTwo v2 = new VersionTwo.Builder() .i(111) .v2_i(12345) .v2_s("222") .v2_f32(67890) .v2_f64(98765L) .v2_rs(Arrays.asList("1", "2")) .build(); // Serializes v2 and decodes it as a VersionOne. byte[] v2Bytes = v2Adapter.encode(v2); VersionOne v1 = v1Adapter.decode(v2Bytes); VersionOne.Builder v1Builder = v1.newBuilder(); // Clears the unknown fields from v1Builder. VersionOne v1Known = v1Builder.clearUnknownFields().build(); assertThat(v1Known.unknownFields()).isEqualTo(ByteString.EMPTY); // Adds unknown fields of v1 to v1Builder. VersionOne addedUnknown = v1Builder.addUnknownFields(v1.unknownFields()).build(); assertThat(addedUnknown.unknownFields()).isEqualTo(v1.unknownFields()); } @Test public void addedUnknownFieldsCanBeClearedFromBuilder() throws IOException { VersionTwo v2 = new VersionTwo.Builder().i(111).v2_i(12345).v2_s("222").v2_f32(67890).build(); // Serializes v2 and decodes it as a VersionOne. byte[] v2Bytes = v2Adapter.encode(v2); VersionOne fromV2 = v1Adapter.decode(v2Bytes); // Adds unknown fields to an empty builder and clears them again. VersionOne emptyV1 = new VersionOne.Builder() .addUnknownFields(fromV2.unknownFields()) .clearUnknownFields() .build(); assertThat(emptyV1.unknownFields()).isEqualTo(ByteString.EMPTY); } @Test public void unknownEnumFields() throws IOException { VersionTwo v2 = new VersionTwo.Builder().en(EnumVersionTwo.PUSS_IN_BOOTS_V2).i(100).build(); byte[] v2Serialized = VersionTwo.ADAPTER.encode(v2); VersionOne v1 = VersionOne.ADAPTER.decode(v2Serialized); assertThat(v1.i).isEqualTo(100); assertThat(v1.en).isNull(); // 40 = 8 << 3 | 0 (tag: 8, field encoding: VARINT(0)) // 04 = PUSS_IN_BOOTS(4) assertThat(v1.unknownFields()).isEqualTo(ByteString.decodeHex("4004")); } }
6,996
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/OneOfTest.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.wire; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; import com.squareup.wire.protos.oneof.OneOfMessage; import java.io.IOException; import org.junit.Test; public class OneOfTest { private static final byte[] INITIAL_BYTES = {}; // (Tag #1 << 3 | VARINT) = 8. private static final byte[] FOO_BYTES = {8, 17}; // (Tag #3 << 3 | LENGTH_DELIMITED) = 26, string length = 6. private static final byte[] BAR_BYTES = {26, 6, 'b', 'a', 'r', 'b', 'a', 'r'}; private final ProtoAdapter<OneOfMessage> adapter = OneOfMessage.ADAPTER; @Test public void testOneOf() throws Exception { OneOfMessage.Builder builder = new OneOfMessage.Builder(); validate(builder, null, null, INITIAL_BYTES); builder.foo(17); validate(builder, 17, null, FOO_BYTES); builder.bar("barbar"); validate(builder, null, "barbar", BAR_BYTES); builder.bar(null); validate(builder, null, null, INITIAL_BYTES); builder.bar("barbar"); validate(builder, null, "barbar", BAR_BYTES); builder.foo(17); validate(builder, 17, null, FOO_BYTES); builder.foo(null); validate(builder, null, null, INITIAL_BYTES); } @Test public void buildFailsWhenBothFieldsAreNonNull() throws Exception { OneOfMessage.Builder builder = new OneOfMessage.Builder(); builder.foo = 1; builder.bar = "two"; try { builder.build(); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("at most one of foo, bar, baz may be non-null"); } } @Test public void constructorFailsWhenBothFieldsAreNonNull() throws Exception { try { new OneOfMessage(1, "two", null); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("at most one of foo, bar, baz may be non-null"); } } private void validate( OneOfMessage.Builder builder, Integer expectedFoo, String expectedBar, byte[] expectedBytes) throws IOException { // Check builder fields assertThat(builder.foo).isEqualTo(expectedFoo); assertThat(builder.bar).isEqualTo(expectedBar); // Check message fields. OneOfMessage message = builder.build(); assertThat(message.foo).isEqualTo(expectedFoo); assertThat(message.bar).isEqualTo(expectedBar); // Check serialized bytes. byte[] bytes = adapter.encode(message); assertThat(expectedBytes).isEqualTo(bytes); // Check result of deserialization. OneOfMessage newMessage = adapter.decode(bytes); assertThat(newMessage.foo).isEqualTo(expectedFoo); assertThat(newMessage.bar).isEqualTo(expectedBar); } }
6,997
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/ProtoAdapterTest.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.wire; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import com.squareup.wire.protos.person.Person; import java.io.IOException; import okio.ByteString; import org.junit.Test; import squareup.protos.packed_encoding.EmbeddedMessage; import squareup.protos.packed_encoding.OuterMessage; public final class ProtoAdapterTest { @Test public void getFromClass() throws Exception { Person person = new Person.Builder().id(99).name("Omar Little").build(); ByteString encoded = ByteString.decodeHex("10630a0b4f6d6172204c6974746c65"); ProtoAdapter<Person> personAdapter = ProtoAdapter.get(Person.class); assertThat(ByteString.of(personAdapter.encode(person))).isEqualTo(encoded); assertThat(personAdapter.decode(encoded)).isEqualTo(person); } @Test public void getFromInstanceSameAsFromClass() throws Exception { Person person = new Person.Builder().id(99).name("Omar Little").build(); ProtoAdapter<Person> instanceAdapter = ProtoAdapter.get(person); ProtoAdapter<Person> classAdapter = ProtoAdapter.get(Person.class); assertThat(instanceAdapter).isSameAs(classAdapter); } @Test public void repeatedHelpersCacheInstances() { ProtoAdapter<?> adapter = ProtoAdapter.UINT64; assertThat(adapter.asRepeated()).isSameAs(adapter.asRepeated()); assertThat(adapter.asPacked()).isSameAs(adapter.asPacked()); } /** https://github.com/square/wire/issues/541 */ @Test public void embeddedEmptyPackedMessage() throws IOException { OuterMessage outerMessage = new OuterMessage.Builder() .outer_number_before(2) .embedded_message(new EmbeddedMessage.Builder().inner_number_after(1).build()) .build(); OuterMessage outerMessagesAfterSerialisation = OuterMessage.ADAPTER.decode(OuterMessage.ADAPTER.encode(outerMessage)); assertEquals(outerMessagesAfterSerialisation, outerMessage); } }
6,998
0
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup
Create_ds/wire/wire-tests/src/jvmJavaTest/java/com/squareup/wire/RuntimeMessageAdapterRedactTest.java
/* * Copyright (C) 2014 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 static org.junit.Assert.fail; import com.squareup.wire.protos.redacted.NotRedacted; import com.squareup.wire.protos.redacted.RedactedChild; import com.squareup.wire.protos.redacted.RedactedCycleA; import com.squareup.wire.protos.redacted.RedactedExtension; import com.squareup.wire.protos.redacted.RedactedFields; import com.squareup.wire.protos.redacted.RedactedRepeated; import com.squareup.wire.protos.redacted.RedactedRequired; import java.io.IOException; import java.util.Arrays; import org.junit.Test; public class RuntimeMessageAdapterRedactTest { @Test public void string() throws IOException { RedactedFields redacted = new RedactedFields.Builder().a("a").b("b").c("c").build(); assertThat(redacted.toString()).isEqualTo("RedactedFields{a=██, b=b, c=c}"); RedactedRepeated redactedRepeated = new RedactedRepeated.Builder() .a(Arrays.asList("a", "b")) .b( Arrays.asList( new RedactedFields("a", "b", "c", null), new RedactedFields("d", "e", "f", null))) .build(); assertThat(redactedRepeated.toString()) .isEqualTo( "RedactedRepeated{a=██, b=[RedactedFields{a=██, b=b, c=c}," + " RedactedFields{a=██, b=e, c=f}]}"); } @Test public void message() { RedactedFields message = new RedactedFields.Builder().a("a").b("b").c("c").build(); RedactedFields expected = message.newBuilder().a(null).build(); assertThat(RedactedFields.ADAPTER.redact(message)).isEqualTo(expected); } @Test public void messageWithNoRedactions() { NotRedacted message = new NotRedacted.Builder().a("a").b("b").build(); assertThat(NotRedacted.ADAPTER.redact(message)).isEqualTo(message); } @Test public void nestedRedactions() { RedactedChild message = new RedactedChild.Builder() .a("a") .b(new RedactedFields.Builder().a("a").b("b").c("c").build()) .c(new NotRedacted.Builder().a("a").b("b").build()) .build(); RedactedChild expected = message.newBuilder().b(message.b.newBuilder().a(null).build()).build(); assertThat(RedactedChild.ADAPTER.redact(message)).isEqualTo(expected); } @Test public void redactedExtensions() { RedactedFields message = new RedactedFields.Builder() .extension(new RedactedExtension.Builder().d("d").e("e").build()) .build(); RedactedFields expected = new RedactedFields.Builder() .extension(new RedactedExtension.Builder().e("e").build()) .build(); assertThat(RedactedFields.ADAPTER.redact(message)).isEqualTo(expected); } @Test public void messageCycle() { RedactedCycleA message = new RedactedCycleA.Builder().build(); assertThat(RedactedCycleA.ADAPTER.redact(message)).isEqualTo(message); } @Test public void repeatedField() { RedactedRepeated message = new RedactedRepeated.Builder() .a(Arrays.asList("a", "b")) .b( Arrays.asList( new RedactedFields("a", "b", "c", null), new RedactedFields("d", "e", "f", null))) .build(); RedactedRepeated expected = new RedactedRepeated.Builder() .b( Arrays.asList( new RedactedFields(null, "b", "c", null), new RedactedFields(null, "e", "f", null))) .build(); RedactedRepeated actual = RedactedRepeated.ADAPTER.redact(message); assertThat(actual).isEqualTo(expected); } @Test public void requiredRedactedFieldThrowsRedacting() { ProtoAdapter<RedactedRequired> adapter = RedactedRequired.ADAPTER; try { adapter.redact(new RedactedRequired("a")); fail(); } catch (UnsupportedOperationException e) { assertThat(e).hasMessage("Field 'a' is required and cannot be redacted."); } } @Test public void requiredRedactedFieldToString() { ProtoAdapter<RedactedRequired> adapter = RedactedRequired.ADAPTER; assertThat(adapter.toString(new RedactedRequired("a"))).isEqualTo("RedactedRequired{a=██}"); } }
6,999