@Documented
@Retention(value=RUNTIME)
@Target(value={CONSTRUCTOR,METHOD})
public @interface SchemaCreate
For example, the following Java POJO.
@DefaultSchema(JavaBeanSchema.class)
class MyClass {
public final String user;
public final int age;
@SchemaCreate
public MyClass(String user, int age) {
this.user = user;
this.age = age;
}
}
This tells Beam that this constructor can be used to construct instances. Beam will match up the names of the constructor arguments to schema fields in order to decide how to create the class from a Row.
This can also be used to annotate a static factory method on the class. For example:
@DefaultSchema(JavaBeanSchema.class)
class MyClass {
public final String user;
public final int age;
private MyClass(String user, int age) { this.user = user; this.age = age; }
@SchemaCreate
public static MyClass create(String user, int age) {
return new MyClass(user, age);
}
}