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

com.files.models.FormField Maven / Gradle / Ivy

Go to download

The Files.com Java client library provides convenient access to the Files.com API from JVM based applications.

There is a newer version: 1.4.123
Show newest version
package com.files.models;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.files.FilesClient;
import com.files.FilesConfig;
import com.files.net.HttpMethods.RequestMethods;
import com.files.util.ModelUtils;
import com.files.util.FilesInputStream;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;

@JsonIgnoreProperties(ignoreUnknown = true)
public class FormField {
  private HashMap options;
  private ObjectMapper objectMapper = JsonMapper
    .builder()
    .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
    .build();

  public FormField() {
    this(null, null);
  }

  public FormField(HashMap parameters) {
    this(parameters, null);
  }

  public FormField(HashMap parameters, HashMap options) {
    this.options = options;
    try{
      ObjectReader objectReader = objectMapper.readerForUpdating(this);
      objectReader.readValue(objectMapper.writeValueAsString(parameters));
    } catch (JsonProcessingException e){
      // TODO: error generation on constructor
    }
  }

  /**
  * Form field id
  */
  @Getter
  @JsonProperty("id")
  public Long id;

  /**
  * Label to be displayed
  */
  @Getter
  @JsonProperty("label")
  public String label;

  /**
  * Is this a required field?
  */
  @Getter
  @JsonProperty("required")
  public Boolean required;

  /**
  * Help text to be displayed
  */
  @Getter
  @JsonProperty("help_text")
  public String helpText;

  /**
  * Type of Field
  */
  @Getter
  @JsonProperty("field_type")
  public String fieldType;

  /**
  * Options to display for radio and dropdown
  */
  @Getter
  @JsonProperty("options_for_select")
  public Object[] optionsForSelect;

  /**
  * Default option for radio and dropdown
  */
  @Getter
  @JsonProperty("default_option")
  public String defaultOption;

  /**
  * Form field set id
  */
  @Getter
  @JsonProperty("form_field_set_id")
  public Long formFieldSetId;



}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy