001package com.box.sdkgen.networking.fetchoptions; 002 003import com.fasterxml.jackson.databind.JsonNode; 004import java.io.InputStream; 005 006/** Multipart item for multipart data */ 007public class MultipartItem { 008 009 /** Name of the part */ 010 public final String partName; 011 012 /** Data of the part */ 013 public JsonNode data; 014 015 /** File stream of the part */ 016 public InputStream fileStream; 017 018 /** File name of the part */ 019 public String fileName; 020 021 /** Content type of the part */ 022 public String contentType; 023 024 public MultipartItem(String partName) { 025 this.partName = partName; 026 } 027 028 protected MultipartItem(Builder builder) { 029 this.partName = builder.partName; 030 this.data = builder.data; 031 this.fileStream = builder.fileStream; 032 this.fileName = builder.fileName; 033 this.contentType = builder.contentType; 034 } 035 036 public String getPartName() { 037 return partName; 038 } 039 040 public JsonNode getData() { 041 return data; 042 } 043 044 public InputStream getFileStream() { 045 return fileStream; 046 } 047 048 public String getFileName() { 049 return fileName; 050 } 051 052 public String getContentType() { 053 return contentType; 054 } 055 056 public static class Builder { 057 058 protected final String partName; 059 060 protected JsonNode data; 061 062 protected InputStream fileStream; 063 064 protected String fileName; 065 066 protected String contentType; 067 068 public Builder(String partName) { 069 this.partName = partName; 070 } 071 072 public Builder data(JsonNode data) { 073 this.data = data; 074 return this; 075 } 076 077 public Builder fileStream(InputStream fileStream) { 078 this.fileStream = fileStream; 079 return this; 080 } 081 082 public Builder fileName(String fileName) { 083 this.fileName = fileName; 084 return this; 085 } 086 087 public Builder contentType(String contentType) { 088 this.contentType = contentType; 089 return this; 090 } 091 092 public MultipartItem build() { 093 return new MultipartItem(this); 094 } 095 } 096}