Skip to content

[Avro] Generate logicalType switch #290

@MichalFoksa

Description

@MichalFoksa

Hi @cowtowncoder

I want to implement a toggle to enable / disable logicalType generation in Avro schema. I am bit lost here, I do not know where to add new feature, whether to AvroGenerator.Feature, AvroMapper.Feature or AvroParser.

When I start backwards, I do know how to check whether the feature is enable. I have in my mind following implementation in VisitorFormatWrapperImpl:

public class VisitorFormatWrapperImpl implements JsonFormatVisitorWrapper {
 
   @Override
    public JsonIntegerFormatVisitor expectIntegerFormat(JavaType type) {
        ...
        if (GENERATE_LOGICAL_TYPE feature enabled){
            if (_isDateTimeType(type)) {
                DateTimeVisitor v = new DateTimeVisitor(type);
                _builder = v;
                return v;
            }
        }

        IntegerVisitor v = new IntegerVisitor(type);
        _builder = v;
        return v;
    }
}

My Question is: How to make if (GENERATE_LOGICAL_TYPE feature enabled) condition?

Cheers,
Michal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions