@Test public void testGetDateTime() throws Exception { PropertyValue p = PropertyValue.create(DATETIME_VAL_d); assertEquals(DATETIME_VAL_d, p.getDateTime()); }
@Test public void testSetDateTime() throws Exception { PropertyValue p = new PropertyValue(); p.setDateTime(DATETIME_VAL_d); assertEquals(DATETIME_VAL_d, p.getDateTime()); }
@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; } /**
assertEquals(epgmElement.getPropertyValue(GradoopTestUtils.KEY_8).getTime(), PROPERTY_MAP.get(GradoopTestUtils.KEY_8)); assertEquals(epgmElement.getPropertyValue(GradoopTestUtils.KEY_9).getDateTime(), PROPERTY_MAP.get(GradoopTestUtils.KEY_9)); assertEquals(epgmElement.getPropertyValue(GradoopTestUtils.KEY_a).getBigDecimal(),
case KEY_d: assertTrue(v.getPropertyValue(propertyKey).isDateTime()); assertEquals(DATETIME_VAL_d, v.getPropertyValue(propertyKey).getDateTime()); break; case KEY_e:
case KEY_d: assertTrue(v.getPropertyValue(propertyKey).isDateTime()); assertEquals(DATETIME_VAL_d, v.getPropertyValue(propertyKey).getDateTime()); break; case KEY_e:
assertEquals(DATETIME_VAL_d, p.getDateTime());
assertEquals(DATETIME_VAL_d, p.getDateTime());