New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPROTO-307 @Proto annotation #241
IPROTO-307 @Proto annotation #241
Conversation
b4cb3ad
to
9ebdfcf
Compare
/** | ||
* Defines a Protocol Buffers message without having to annotate all fields with {@link ProtoField}. | ||
* Use this annotation to quickly generate messages from records or classes with public fields. | ||
* Fields must be public and they will be assigned incremental numbers based on the declaration order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should detail here that it's possible to overwrite fields with subsequent @protofield definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
generatedSchema.registerSchema(ctx); | ||
generatedSchema.registerMarshallers(ctx); | ||
|
||
assertTrue(generatedSchema.getProtoFile().contains("message BareMessage")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also assert the generated fields contain the correct types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
protobufType = Type.BYTES; | ||
} | ||
if (!javaType.isArray() && !javaType.isPrimitive() && javaType.isAbstract() && !javaType.isEnum()) { | ||
throw new ProtoSchemaBuilderException("The type " + javaType.getCanonicalName() + " of field '" + fieldName + "' of " + clazz.getCanonicalName() + " should not be abstract, while processing " + this.protoSchemaGenerator.generator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We throw the same exception in two places. We should either split the duplicated code into a method, or at least create the exception via the Log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've promoted a few logs to Log
, including this one.
This is making my day |
* IPROTO-306 Record support
9ebdfcf
to
9395b90
Compare
https://issues.redhat.com/browse/IPROTO-307
https://issues.redhat.com/browse/IPROTO-306
Adds a
@Proto
annotation for simple handling of protobuf entities. Also adds support for Javarecord
s