use of com.squareup.wire.schema.Options in project schema2proto by entur.
the class SchemaParser method createWrapper.
private MessageType createWrapper(String typeName, MessageType messageType, String wrapperFieldName, String targetNamespace, XSParticle particle, String fieldDoc, Location location, XSComplexType parentType, String wrapperDoc) {
// Add message type to file
List<OptionElement> messageOptions = new ArrayList<>();
Options options = new Options(Options.MESSAGE_OPTIONS, messageOptions);
MessageType wrapperType = new MessageType(ProtoType.get(typeName), location, wrapperDoc, typeName, options);
wrapperType.setWrapperMessageType(true);
messageType.nestedTypes().add(wrapperType);
Options fieldOptions = getFieldOptions(particle);
String fieldPackagename = NamespaceHelper.xmlNamespaceToProtoFieldPackagename(targetNamespace, configuration.forceProtoPackage);
Field field = new Field(fieldPackagename, location, Label.REPEATED, wrapperFieldName, fieldDoc, messageType.getNextFieldNum(), typeName, fieldOptions, false);
addField(messageType, field);
localTypes.add(new LocalType(particle, wrapperType, messageType, field, NamespaceHelper.xmlNamespaceToProtoPackage(targetNamespace, configuration.forceProtoPackage), parentType));
return wrapperType;
}
Aggregations