@Test public void testGetDate() throws Exception { PropertyValue p = PropertyValue.create(DATE_VAL_b); assertEquals(DATE_VAL_b, p.getDate()); }
@Override public int compareTo(PropertyValue o) { int result; if (this.isNull() && o.isNull()) { result = 0; } else if (this.isNumber() && o.isNumber()) { result = PropertyValueUtils.Numeric.compare(this, o); } else if (this.isBoolean() && o.isBoolean()) { result = Boolean.compare(this.getBoolean(), o.getBoolean()); } else if (this.isString() && o.isString()) { result = this.getString().compareTo(o.getString()); } else if (this.isGradoopId() && o.isGradoopId()) { result = this.getGradoopId().compareTo(o.getGradoopId()); } else if (this.isDate() && o.isDate()) { result = this.getDate().compareTo(o.getDate()); } else if (this.isTime() && o.isTime()) { result = this.getTime().compareTo(o.getTime()); } else if (this.isDateTime() && o.isDateTime()) { result = this.getDateTime().compareTo(o.getDateTime()); } else if (this.isMap() || o.isMap() || this.isList() || o.isList() || this.isSet() || o.isSet()) { throw new UnsupportedOperationException(String.format( "Method compareTo() is not supported for %s, %s", this.getClass(), o.getClass())); } else { throw new IllegalArgumentException(String.format( "Incompatible types: %s, %s", this.getClass(), o.getClass())); } return result; }
/** * Returns the wrapped value as object. * * @return value or {@code null} if the value is empty */ public Object getObject() { return isBoolean() ? getBoolean() : isShort() ? getShort() : isInt() ? getInt() : isLong() ? getLong() : isFloat() ? getFloat() : isDouble() ? getDouble() : isString() ? getString() : isBigDecimal() ? getBigDecimal() : isGradoopId() ? getGradoopId() : isMap() ? getMap() : isList() ? getList() : isDate() ? getDate() : isTime() ? getTime() : isDateTime() ? getDateTime() : isSet() ? getSet() : null; } /**
@Test public void testSetDate() throws Exception { PropertyValue p = new PropertyValue(); p.setDate(DATE_VAL_b); assertEquals(DATE_VAL_b, p.getDate()); }
assertEquals(epgmElement.getPropertyValue(GradoopTestUtils.KEY_6).getGradoopId(), PROPERTY_MAP.get(GradoopTestUtils.KEY_6)); assertEquals(epgmElement.getPropertyValue(GradoopTestUtils.KEY_7).getDate(), PROPERTY_MAP.get(GradoopTestUtils.KEY_7)); assertEquals(epgmElement.getPropertyValue(GradoopTestUtils.KEY_8).getTime(),
LocalDate birthDayDate = current.getPropertyValue("birthday").getDate(); current.setProperty("yob", birthDayDate.getYear()); current.setProperty("decade", birthDayDate.getYear() - birthDayDate.getYear() % 10);
assertEquals(DATE_VAL_b, p.getDate());
case KEY_b: assertTrue(v.getPropertyValue(propertyKey).isDate()); assertEquals(DATE_VAL_b, v.getPropertyValue(propertyKey).getDate()); break; case KEY_c:
assertEquals(DATE_VAL_b, p.getDate());
case KEY_b: assertTrue(v.getPropertyValue(propertyKey).isDate()); assertEquals(DATE_VAL_b, v.getPropertyValue(propertyKey).getDate()); break; case KEY_c: