当前位置: 首页>>代码示例>>Java>>正文


Java LongValue.newBuilder方法代码示例

本文整理汇总了Java中com.google.cloud.datastore.LongValue.newBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java LongValue.newBuilder方法的具体用法?Java LongValue.newBuilder怎么用?Java LongValue.newBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.cloud.datastore.LongValue的用法示例。


在下文中一共展示了LongValue.newBuilder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toDatastore

import com.google.cloud.datastore.LongValue; //导入方法依赖的package包/类
@Override
public ValueBuilder<?, ?, ?> toDatastore(Object input) {
  if (input == null) {
    return NullValue.newBuilder();
  }
  return LongValue.newBuilder((int) input);
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:8,代码来源:IntegerMapper.java

示例2: toDatastore

import com.google.cloud.datastore.LongValue; //导入方法依赖的package包/类
@Override
public ValueBuilder<?, ?, ?> toDatastore(Object input) {
  if (input == null) {
    return NullValue.newBuilder();
  }
  return LongValue.newBuilder((short) input);
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:8,代码来源:ShortMapper.java

示例3: toDatastore

import com.google.cloud.datastore.LongValue; //导入方法依赖的package包/类
@Override
public ValueBuilder<?, ?, ?> toDatastore(Object input) {
  ValueBuilder<?, ?, ?> builder;
  if (input == null) {
    builder = NullValue.newBuilder();
  } else if (input instanceof Long) {
    builder = LongValue.newBuilder((long) input);
  } else if (input instanceof Double) {
    builder = DoubleValue.newBuilder((double) input);
  } else if (input instanceof Boolean) {
    builder = BooleanValue.newBuilder((boolean) input);
  } else if (input instanceof String) {
    builder = StringValue.newBuilder((String) input);
  } else if (input instanceof DatastoreKey) {
    builder = KeyValue.newBuilder(((DatastoreKey) input).nativeKey());
  } else if (input instanceof GeoLocation) {
    GeoLocation geoLocation = (GeoLocation) input;
    builder = LatLngValue
        .newBuilder(LatLng.of(geoLocation.getLatitude(), geoLocation.getLongitude()));
  } else if (input instanceof Map) {
    @SuppressWarnings("unchecked")
    Map<String, ?> map = (Map<String, ?>) input;
    FullEntity.Builder<IncompleteKey> entityBuilder = FullEntity.newBuilder();
    for (Map.Entry<String, ?> entry : map.entrySet()) {
      String key = entry.getKey();
      entityBuilder.set(key, toDatastore(entry.getValue()).build());
    }
    builder = EntityValue.newBuilder(entityBuilder.build());
  } else {
    throw new MappingException(String.format("Unsupported type: %s", input.getClass().getName()));
  }
  return builder;
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:34,代码来源:CatchAllMapper.java

示例4: toDatastore

import com.google.cloud.datastore.LongValue; //导入方法依赖的package包/类
@Override
public ValueBuilder<?, ?, ?> toDatastore(Object input) {
  if (input == null) {
    return NullValue.newBuilder();
  }
  return LongValue.newBuilder((long) input);
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:8,代码来源:LongMapper.java

示例5: toDatastore

import com.google.cloud.datastore.LongValue; //导入方法依赖的package包/类
@Override
public ValueBuilder<?, ?, ?> toDatastore(Object input) {
  if (input == null) {
    return NullValue.newBuilder();
  }
  return LongValue.newBuilder((byte) input);
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:8,代码来源:ByteMapper.java

示例6: toDatastore

import com.google.cloud.datastore.LongValue; //导入方法依赖的package包/类
@Override
public ValueBuilder<?, ?, ?> toDatastore(Object input) {
  if (input == null) {
    return NullValue.newBuilder();
  }
  try {
    BigDecimal n = (BigDecimal) input;
    n = n.movePointRight(fractionalDigits);
    return LongValue.newBuilder(n.longValueExact());
  } catch (Exception e) {
    throw new MappingException(e);
  }
}
 
开发者ID:sai-pullabhotla,项目名称:catatumbo,代码行数:14,代码来源:CurrencyMapper.java


注:本文中的com.google.cloud.datastore.LongValue.newBuilder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。