dominikschlosser / super-csv-declarative

Unofficial declarative extension to super-csv
Apache License 2.0
2 stars 1 forks source link

Add scopes/contexts to support usage of the same bean in read and write-scenarios #2

Closed dominikschlosser closed 8 years ago

dominikschlosser commented 8 years ago

Sketch:

@CellProcessorAnnotationDescriptor(provider = FmtBoolCellProcessorProvider.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD })
public @interface FmtBool {
    String trueValue();
    String falseValue();

    int order() default ProcessorOrder.UNDEFINED;

    String[] contexts() default { StandardContexts.WRITE };
}

Allows to use, for example, @FmtBool and @ParseBool on same field, while @FmtBool is only used when writing to csv and @ParseBool is only used when reading from csv.

Supports custom-scopes (since scopes are just unique Strings), too.

dominikschlosser commented 8 years ago

Implemented