@Test public void roundtripFromJSON() { Assert.assertTrue(new JSONObject("{\"year\":2013}").similar( new PhenoTipsDate(new JSONObject("{\"year\":2013}")).toJSON())); Assert.assertTrue(new JSONObject("{\"year\":2013}").similar( new PhenoTipsDate(new JSONObject("{\"year\":\"2013\"}")).toJSON())); Assert.assertTrue(new JSONObject("{\"year\":2010,\"month\":1,\"day\":13}").similar( new PhenoTipsDate(new JSONObject("{\"year\":\"2010\",\"month\":\"01\",\"day\":\"13\"}")).toJSON())); Assert.assertTrue(new JSONObject("{\"year\":2010,\"month\":1,\"day\":13}").similar( new PhenoTipsDate(new JSONObject("{\"year\":2010,\"month\":01,\"day\":13}")).toJSON())); Assert.assertTrue(new JSONObject("{\"year\":2010,\"range\":{\"years\":10},\"month\":1,\"day\":13}").similar( new PhenoTipsDate(new JSONObject("{\"year\":2010,\"range\":{\"years\":10},\"month\":01,\"day\":13}")) .toJSON())); }
public JSONObject toJSON() { JSONObject result = new JSONObject(); if (this.year != null) { result.put(JSON_YEAR_FIELDNAME, this.year); } if (this.month != null) { result.put(JSON_MONTH_FIELDNAME, this.month); } if (this.day != null) { result.put(JSON_DAY_FIELDNAME, this.day); } if (this.rangeYears != null) { JSONObject rangeObject = new JSONObject(); rangeObject.put(JSON_RANGE_YEARS, this.rangeYears); result.put(JSON_RANGE_FIELDNAME, rangeObject); } return result; }
PhenoTipsDate { public JSONObject toJSON() { JSONObject result = new JSONObject(); if (this.year != null) { result.put(JSON_YEAR_FIELDNAME, this.year); } if (this.month != null) { result.put(JSON_MONTH_FIELDNAME, this.month); } if (this.day != null) { result.put(JSON_DAY_FIELDNAME, this.day); } if (this.rangeYears != null) { JSONObject rangeObject = new JSONObject(); rangeObject.put(JSON_RANGE_YEARS, this.rangeYears); result.put(JSON_RANGE_FIELDNAME, rangeObject); } return result; } }
PhenoTipsDate { public JSONObject toJSON() { JSONObject result = new JSONObject(); if (this.year != null) { result.put(JSON_YEAR_FIELDNAME, this.year); } if (this.month != null) { result.put(JSON_MONTH_FIELDNAME, this.month); } if (this.day != null) { result.put(JSON_DAY_FIELDNAME, this.day); } if (this.rangeYears != null) { JSONObject rangeObject = new JSONObject(); rangeObject.put(JSON_RANGE_YEARS, this.rangeYears); result.put(JSON_RANGE_FIELDNAME, rangeObject); } return result; } PhenoTipsDate(Date date);  PhenoTipsDate(JSONObject jsonFuzzyDate);  PhenoTipsDate(String phenoTipsDateString); }
PhenoTipsDate { public JSONObject toJSON() { JSONObject result = new JSONObject(); if (this.year != null) { result.put(JSON_YEAR_FIELDNAME, this.year); } if (this.month != null) { result.put(JSON_MONTH_FIELDNAME, this.month); } if (this.day != null) { result.put(JSON_DAY_FIELDNAME, this.day); } if (this.rangeYears != null) { JSONObject rangeObject = new JSONObject(); rangeObject.put(JSON_RANGE_YEARS, this.rangeYears); result.put(JSON_RANGE_FIELDNAME, rangeObject); } return result; } PhenoTipsDate(Date date);  PhenoTipsDate(JSONObject jsonFuzzyDate);  PhenoTipsDate(String phenoTipsDateString); JSONObject toJSON(); Date toEarliestPossibleISODate(); @Override String toString(); String toYYYYMMDDString(); boolean isSet(); }
PhenoTipsDate { public JSONObject toJSON() { JSONObject result = new JSONObject(); if (this.year != null) { result.put(JSON_YEAR_FIELDNAME, this.year); } if (this.month != null) { result.put(JSON_MONTH_FIELDNAME, this.month); } if (this.day != null) { result.put(JSON_DAY_FIELDNAME, this.day); } if (this.rangeYears != null) { JSONObject rangeObject = new JSONObject(); rangeObject.put(JSON_RANGE_YEARS, this.rangeYears); result.put(JSON_RANGE_FIELDNAME, rangeObject); } return result; } PhenoTipsDate(Date date);  PhenoTipsDate(JSONObject jsonFuzzyDate);  PhenoTipsDate(String phenoTipsDateString); JSONObject toJSON(); Date toEarliestPossibleISODate(); @Override String toString(); String toYYYYMMDDString(); boolean isSet(); static final String JSON_YEAR_FIELDNAME; static final String JSON_MONTH_FIELDNAME; static final String JSON_DAY_FIELDNAME; static final String JSON_RANGE_FIELDNAME; static final String JSON_RANGE_YEARS; static final Pattern DATE_STRING_REGEXP; }