Skip to content

simple demo

LightSun edited this page Sep 11, 2017 · 1 revision

Here is a simple definition of data entity.

@Fields({
        @Field(propName = "name", seriaName = "heaven7", type = String.class),
        @Field(propName = "test_object", seriaName = "test_object",
                flags = FLAG_EXPOSE_DEFAULT | FLAG_EXPOSE_SERIALIZE_FALSE, type = Object.class),
        @Field(propName = "test_Format", seriaName = "test_Format", flags = 1, type = Double.class),
        @Field(propName = "test_int", seriaName = "test_int", type = int.class,
                flags = FLAG_EXPOSE_DEFAULT | FLAG_COPY | FLAG_RESET),
        @Field(propName = "test_list", seriaName = "test_list", type = long.class, complexType = COMPLEXT_LIST,
                flags = FLAG_RESET | FLAG_SHARE | FLAG_SNAP),
        @Field(propName = "test_array", seriaName = "test_array", type = String.class,
                complexType = COMPLEXT_ARRAY,
                flags = FLAG_RESET | FLAG_SHARE | FLAG_SNAP
        ),
})
public interface StudentBind extends ICopyable, IResetable, IShareable, ISnapable {
}

And here is the generate Impl Class.

public class StudentBindModule_Impl implements StudentBindModule, ICopyable, IResetable, IShareable, ISnapable {
  @SerializedName("heaven7")
  private String name;

  @SerializedName("test_object")
  @Expose(
      serialize = false,
      deserialize = true
  )
  private Object test_object;

  @SerializedName("test_Format")
  private transient Double test_Format;

  @SerializedName("test_int")
  @Expose(
      serialize = true,
      deserialize = true
  )
  private int test_int;

  @SerializedName("test_list")
  private List<Long> test_list;

  @SerializedName("test_array")
  private String[] test_array;

  public StudentBindModule_Impl() {
  }

  @Override
  public StudentBindModule copy() {
//if the field definition have FLAG_COPY. it will be here.
    StudentBindModule_Impl result = new StudentBindModule_Impl();
    result.test_int = this.test_int;
    return result;
  }

  @Override
  public void reset() {
//if the field definition have FLAG_RESET. it will be here.
    this.test_int = 0;
    this.test_list = null;
    this.test_array = null;
  }

  @Override
  public void clearShare() {
//if the field definition have FLAG_RESET. it will be here.
    this.test_list = null;
    this.test_array = null;
  }

  @Override
  public void clearSnap() {
//if the field definition have FLAG_SNAP. it will be here.
    this.test_list = null;
    this.test_array = null;
  }

  public String getName() {
    return name;
  }

  public void setName(String string1) {
    this.name = string1;
  }

  public Object getTest_object() {
    return test_object;
  }

  public void setTest_object(Object object1) {
    this.test_object = object1;
  }

  public Double getTest_Format() {
    return test_Format;
  }

  public void setTest_Format(Double double1) {
    this.test_Format = double1;
  }

  public int getTest_int() {
    return test_int;
  }

  public void setTest_int(int int1) {
    this.test_int = int1;
  }

  public List<Long> getTest_list() {
    return test_list;
  }

  public void setTest_list(List<Long> list1) {
    this.test_list = list1;
  }

  public String[] getTest_array() {
    return test_array;
  }

  public void setTest_array(String[] array1) {
    this.test_array = array1;
  }
}

Clone this wiki locally