Hey all,

I might have found a bug in the way we create schemas from Java Beans.

My schema has to have uppercase field names.

So I have something like :

@DefaultSchema(JavaBeanSchema.class)
public class Foo {
private String ACTION_ID;

private String getACTION_ID(){..}
private void  setACTION_ID(String ACTION_ID){..}
}

Problem is that once the schema is parsed, all the fields have their first
letter lowercased. I think it's because of the ReflectUtils.stripPrefix
method.

As workarounds, I have tried:

1. Decorate my class with @SchemaCaseFormat(CaseFormat.UPPER_UNDERSCORE)
and have my fields/getters/setters follow camelCase naming. Unfortunately,
JavaBeanUtils.validateJavaBean sees all the setters as NULL. I'm not sure
why. I could investigate after I deliver a few things.

2. Use AutoValue. Unfortunately with Flink, I get things like this: Failed
to access class package.AutoValue_Foo$Builder from class
package.SchemaUserTypeCreator@SchemaCodeGen$someRandomString
package.AutoValue_Foo$Builder is in unnamed module of loader 'app';
package.SchemaUserTypeCreator@SchemaCodeGen$someRandomString is in
unnamed module of loader org.apache.flink.util.ChildFirstClassLoader . I
would love for this to work. Very sad it doesn't.

3. Use Pojos with @DefaultSchema(JavaFieldSchema.class), this seems to work
as expected, not 100% sure yet.

If this is indeed a bug, could someone create a Jira and I could have a
look into it in the near future.

Thanks,
Cristian

Reply via email to