Package org.yaac.shared.property

Examples of org.yaac.shared.property.DoublePropertyInfo


    } else if (obj instanceof Email) {
      result = new StringPropertyInfo(((Email) obj).getEmail());
    } else if (obj instanceof Long) {  // short, int, long are all stored as long value
      result = new LongPropertyInfo((Long)obj);
    } else if (obj instanceof Double) {// float and double are both stored as 64-bit double precision, IEEE 754
      result = new DoublePropertyInfo((Double)obj);
    } else if (obj instanceof BigDecimal) {  // most processed fields will be bigdecimal
      BigDecimal bd = (BigDecimal) obj;
      if ((double)bd.longValue() == bd.doubleValue()) {  // try to make it long if there is no lose of precision
        result = new LongPropertyInfo(bd.longValue());
      } else {
        result = new DoublePropertyInfo(bd.doubleValue())
      }
    } else if (obj instanceof User) {
      User user = (User)obj;
      result = new UserPropertyInfo(user.getAuthDomain(), user.getEmail(),
          user.getFederatedIdentity(), user.getUserId(), user.getNickname());
View Full Code Here


    DatastoreServiceFactory.getDatastoreService().put(new Entity(key));
    String keyString = KeyFactory.keyToString(key);
   
    assertEquals(new StringPropertyInfo("str"), service.parsePropertyExp(keyString, "'str'", null));
    assertEquals(new LongPropertyInfo(10l), service.parsePropertyExp(keyString, "10", null));
    assertEquals(new DoublePropertyInfo(10.5D), service.parsePropertyExp(keyString, "10.5", null));
    assertEquals(new LongPropertyInfo(10l), service.parsePropertyExp(keyString, "long(10.5)", null));
    assertEquals(new DoublePropertyInfo(10D), service.parsePropertyExp(keyString, "double(10)", null));
    assertEquals(new ListPropertyInfo().add(new LongPropertyInfo(10)).add(new StringPropertyInfo("abc")),
        service.parsePropertyExp(keyString, "list(10, 'abc')", new ArrayList<String>()));
  }
View Full Code Here

TOP

Related Classes of org.yaac.shared.property.DoublePropertyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.