throw new ProtoSchemaBuilderException("Private fields cannot be @ProtoField annotated: " + field); if (annotation.number() == 0) { throw new ProtoSchemaBuilderException("0 is not a valid Protobuf field number: " + field); ProtoFieldMetadata fieldMetadata = new ProtoFieldMetadata(clazz, annotation.number(), fieldName, javaType, collectionImplementation, protobufType, protoTypeMetadata, isRequired, isRepeated, isArray, defaultValue, field); ProtoFieldMetadata existing = fieldsByNumber.get(annotation.number()); if (existing != null) { throw new ProtoSchemaBuilderException("Duplicate field number definition. Found two field definitions with number " + annotation.number() + ": in " + fieldMetadata.getLocation() + " and in " + existing.getLocation()); if (annotation.number() == 0) { throw new ProtoSchemaBuilderException("0 is not a valid Protobuf field number: " + method); ProtoFieldMetadata fieldMetadata = new ProtoFieldMetadata(clazz, annotation.number(), fieldName, javaType, collectionImplementation, protobufType, protoTypeMetadata, isRequired, isRepeated, isArray, defaultValue, propertyName, getter, setter); ProtoFieldMetadata existing = fieldsByNumber.get(annotation.number()); if (existing != null) { throw new ProtoSchemaBuilderException("Duplicate field definition. Found two field definitions with number " + annotation.number() + ": in " + fieldMetadata.getLocation() + " and in " + existing.getLocation()); fieldsByNumber.put(annotation.number(), fieldMetadata); fieldsByName.put(fieldName, fieldMetadata);