All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.chanjar.weixin.cp.bean.templatecard.CheckboxOption Maven / Gradle / Ivy

There is a newer version: 4.6.7.B
Show newest version
package me.chanjar.weixin.cp.bean.templatecard;

import com.google.gson.JsonObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 按钮列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6
 *
 * @author yzts  created on  2021/9/22
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CheckboxOption implements Serializable {
  private static final long serialVersionUID = 5405702239190050250L;

  /**
   * 选项id,用户提交选项后,会产生回调事件,回调事件会带上该id值表示该选项,最长支持128字节,不可重复
   * 必填
   */
  private String id;
  /**
   * 选项文案描述,建议不超过17个字.
   * 必填
   */
  private String text;
  /**
   * 该选项是否要默认选中
   * 必填
   */
  private Boolean is_checked;

  /**
   * To json json object.
   *
   * @return the json object
   */
  public JsonObject toJson() {
    JsonObject optionJson = new JsonObject();
    optionJson.addProperty("id", this.getId());
    optionJson.addProperty("text", this.getText());
    if (null != this.getIs_checked()) {
      optionJson.addProperty("is_checked", this.getIs_checked());
    }
    return optionJson;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy