Package com.google.storage.onestore.v3.OnestoreEntity

Examples of com.google.storage.onestore.v3.OnestoreEntity.PropertyValue


    property.setName(name);
    property.setMultiple(multiple);
    PropertyValue newValue = property.getMutableValue();
    if (value != null) {
      Type<?> type = getType(value.getClass());
      Meaning meaning = type.getV3Meaning();
      if (meaning != property.getMeaningEnum()) {
        property.setMeaning(meaning);
      }
      indexed &= type.toV3Value(value, newValue);
    }
View Full Code Here


      return Pair.of(null, property);
    }

    Pair<Type<?>, PropertyValue> newValue = createPropertyValue(value);
    Type<?> type = newValue.first;
    Meaning meaning = type.getMeaning();
    if (meaning != Meaning.NO_MEANING) {
      property.setMeaning(meaning);
    }
    property.setValue(newValue.second);
    return new Pair<Type<?>, Property>(type, property);
View Full Code Here

   * @param property a not {@code null} property
   * @return {@code null} if no value was set for {@code property}
   */
  public static Comparable<Object> getComparablePropertyValue(Property property) {
    PropertyValue value = property.getValue();
    Meaning meaning = property.getMeaningEnum();
    for (Type<?> type : typeMap.values()) {
      if (type.hasPropertyValue(value) &&
          (meaning == Meaning.INDEX_VALUE || meaning == type.getMeaning()) &&
          type.getComparableFunction() != null) {
        return toComparableObject(
View Full Code Here

        cost += 25;
        EntityProto ep = i.next();
        Iterator<Property> pi = ep.propertyIterator();
        while (pi.hasNext()) {
          Property p = pi.next();
          Meaning m = p.getMeaningEnum();
          if (m != null) {
            if (m.compareTo(Meaning.BLOB) != 0
                && m.compareTo(Meaning.TEXT) != 0) {
              cost += 20;
            }
          }
        }
      }
View Full Code Here

        cost += 25;
        EntityProto ep = i.next();
        Iterator<Property> pi = ep.propertyIterator();
        while (pi.hasNext()) {
          Property p = pi.next();
          Meaning m = p.getMeaningEnum();
          if (m != null) {
            if (m.compareTo(Meaning.BLOB) != 0
                && m.compareTo(Meaning.TEXT) != 0) {
              cost += 20;
            }
          }
        }
      }
View Full Code Here

  }

  private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    int version = in.read();
    if (version == 1) {
      valueV3 = new PropertyValue();
      valueV3.parseFrom(in);
    } else if (version == 2) {
      valueV4 = EntityV4.Value.PARSER.parseFrom(in);
    } else {
      checkArgument(false, "unknown RawValue format");
View Full Code Here

  private static void addPropertyToPb(String name, Object value, boolean indexed, boolean multiple,
      EntityProto entity) {
    Property property = new Property();
    property.setName(name);
    property.setMultiple(multiple);
    PropertyValue newValue = property.getMutableValue();
    if (value != null) {
      Type<?> type = getType(value.getClass());
      Meaning meaning = type.getV3Meaning();
      if (meaning != property.getMeaningEnum()) {
        property.setMeaning(meaning);
View Full Code Here

      entity.addProperty(property);
    }
  }

  static PropertyValue toV3Value(Object value) {
    PropertyValue propertyValue = new PropertyValue();
    if (value != null) {
      getType(value.getClass()).toV3Value(value, propertyValue);
    }
    return propertyValue;
  }
View Full Code Here

  }

  private static Property buildImplicitKeyProperty(EntityProto proto) {
    Property keyProp = new Property();
    keyProp.setName(Entity.KEY_RESERVED_PROPERTY);
    PropertyValue propVal = new PropertyValue();
    propVal.setReferenceValue(KeyType.toReferenceValue(proto.getKey()));
    keyProp.setValue(propVal);
    return keyProp;
  }
View Full Code Here

   *
   * @param property a not {@code null} property
   * @return {@code null} if no value was set for {@code property}
   */
  public static Object getPropertyValue(Property property) {
    PropertyValue value = property.getValue();
    for (Type<?> type : typeMap.values()) {
      if (type.isType(property.getMeaningEnum(), value)) {
        return type.getValue(value);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.storage.onestore.v3.OnestoreEntity.PropertyValue

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.