Search in sources :

Example 1 with Kind

use of com.squareup.wire.schema.internal.parser.OptionElement.Kind in project schema2proto by entur.

the class ProtoSerializer method addConfigurationSpecifiedOptions.

private void addConfigurationSpecifiedOptions(Map<String, ProtoFile> packageToProtoFileMap) {
    for (Entry<String, ProtoFile> protoFile : packageToProtoFileMap.entrySet()) {
        for (Entry<String, Object> option : configuration.options.entrySet()) {
            Kind kind = null;
            if (option.getValue() instanceof Boolean) {
                kind = Kind.BOOLEAN;
            } else if (option.getValue() instanceof Number) {
                kind = Kind.NUMBER;
            } else {
                kind = Kind.STRING;
            }
            OptionElement optionElement = new OptionElement(option.getKey(), kind, option.getValue(), false);
            protoFile.getValue().options().add(optionElement);
        }
    }
}
Also used : Kind(com.squareup.wire.schema.internal.parser.OptionElement.Kind) OptionElement(com.squareup.wire.schema.internal.parser.OptionElement) ProtoFile(com.squareup.wire.schema.ProtoFile) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Aggregations

ProtoFile (com.squareup.wire.schema.ProtoFile)1 OptionElement (com.squareup.wire.schema.internal.parser.OptionElement)1 Kind (com.squareup.wire.schema.internal.parser.OptionElement.Kind)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1