com.javanut.json.decode.JSONTable Maven / Gradle / Ivy
Show all versions of pronghorn-pipes Show documentation
package com.javanut.json.decode;
import com.javanut.json.JSONAccumRule;
import com.javanut.json.JSONAligned;
import com.javanut.json.JSONExtractorImpl;
import com.javanut.json.JSONRequired;
import com.javanut.json.JSONType;
public abstract class JSONTable {
final JSONExtractorImpl extractor;
JSONTable(JSONExtractorImpl extractor) {
this.extractor = extractor;
}
public > JSONTable integerField(String extractionPath, T field) {
extractor.newPath(JSONType.TypeInteger, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable stringField(String extractionPath, T field) {
extractor.newPath(JSONType.TypeString, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable decimalField(String extractionPath, T field) {
extractor.newPath(JSONType.TypeDecimal, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable booleanField(String extractionPath, T field) {
extractor.newPath(JSONType.TypeBoolean, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable integerField(String extractionPath, T field, JSONRequired required, Object validator) {
extractor.newPath(JSONType.TypeInteger, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field, required, validator);
return this;
}
public > JSONTable stringField(String extractionPath, T field, JSONRequired required, Object validator) {
extractor.newPath(JSONType.TypeString, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field, required, validator);
return this;
}
public > JSONTable decimalField(String extractionPath, T field, JSONRequired required, Object validator) {
extractor.newPath(JSONType.TypeDecimal, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field, required, validator);
return this;
}
public > JSONTable booleanField(String extractionPath, T field, JSONRequired required) {
extractor.newPath(JSONType.TypeBoolean, JSONAligned.UNPADDED, null);
extractor.completePath(extractionPath, field.name(), field, required, null);
return this;
}
public > JSONTable integerField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field) {
extractor.newPath(JSONType.TypeInteger, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable stringField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field) {
extractor.newPath(JSONType.TypeString, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable decimalField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field) {
extractor.newPath(JSONType.TypeDecimal, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable booleanField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field) {
extractor.newPath(JSONType.TypeBoolean, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field);
return this;
}
public > JSONTable integerField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field, JSONRequired required, Object validator) {
extractor.newPath(JSONType.TypeInteger, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field, required, validator);
return this;
}
public > JSONTable stringField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field, JSONRequired required, Object validator) {
extractor.newPath(JSONType.TypeString, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field, required, validator);
return this;
}
public > JSONTable decimalField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field, JSONRequired required, Object validator) {
extractor.newPath(JSONType.TypeDecimal, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field, required, validator);
return this;
}
public > JSONTable booleanField(JSONAligned isAligned, JSONAccumRule accumRule, String extractionPath, T field, JSONRequired required) {
extractor.newPath(JSONType.TypeBoolean, isAligned, accumRule);
extractor.completePath(extractionPath, field.name(), field, required, null);
return this;
}
public P finish() {
return tableEnded();
}
abstract P tableEnded();
}