Annotation Type SchemaCaseFormat


  • @Documented
    @Retention(RUNTIME)
    @Target({FIELD,METHOD,TYPE})
    @Experimental(SCHEMAS)
    public @interface SchemaCaseFormat
    When used on a POJO, Java Bean, or AutoValue class the specified case format will be used for all the generated Schema fields.

    The annotation can also be used on individual POJO fields, and Java Bean and AutoValue getters to change the case format just for those fields.

    For example, say we have a POJO with fields that we want in our schema but under names with a different case format:

    
     @DefaultSchema(JavaFieldSchema.class)
     @SchemaCaseFormat(CaseFormat.LOWER_UNDERSCORE)
       class MyClass {
         public String user;
         public int ageInYears;
        @SchemaCaseFormat(CaseFormat.UPPER_CAMEL)
         public boolean knowsJavascript;
       }
     

    The resulting schema will have fields named "user", "age_in_years", "KnowsJavascript".

    A common application of this annotation is to make schema fields use the lower_underscore case format, which is recommended for schemas that will be used across language boundaries.

    NOTE: This annotation assumes that field and method names follow the convention of using the lowerCamel case format. If that is not the case, we make a best effort to convert the field name but the result is not well defined.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.CaseFormat value
      The name to use for the generated schema field.
    • Element Detail

      • value

        @Nonnull
        org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.CaseFormat value
        The name to use for the generated schema field.