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


Java DirtyMapWrapper类代码示例

本文整理汇总了Java中org.apache.gora.persistency.impl.DirtyMapWrapper的典型用法代码示例。如果您正苦于以下问题:Java DirtyMapWrapper类的具体用法?Java DirtyMapWrapper怎么用?Java DirtyMapWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: fromMongoMap

import org.apache.gora.persistency.impl.DirtyMapWrapper; //导入依赖的package包/类
Object fromMongoMap(final String docf, final Schema fieldSchema,
                    final BSONDecorator easybson, final Field f) {
  BasicDBObject map = easybson.getDBObject(docf);
  Map<Utf8, Object> rmap = new HashMap<>();
  if (map == null) {
      return new DirtyMapWrapper(rmap);
  }
  for (Entry<String, Object> e : map.entrySet()) {
    String mapKey = e.getKey();
    String decodedMapKey = decodeFieldKey(mapKey);

    DocumentFieldType storeType = mapping.getDocumentFieldType(docf);
    Object o = fromDBObject(fieldSchema.getValueType(), storeType, f, mapKey,
        new BSONDecorator(map));
    rmap.put(new Utf8(decodedMapKey), o);
  }
  return new DirtyMapWrapper<>(rmap);
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:19,代码来源:MongoStore.java

示例2: fromCouchDBMap

import org.apache.gora.persistency.impl.DirtyMapWrapper; //导入依赖的package包/类
private Object fromCouchDBMap(final Schema fieldSchema, final Field field, final String docf, final Object value) {

    final Map<String, Object> map = (Map<String, Object>) ((Map<String, Object>) value).get(docf);
    final Map<Utf8, Object> rmap = new HashMap<>();

    if (map == null) {
      return new DirtyMapWrapper(rmap);
    }

    for (Map.Entry<String, Object> e : map.entrySet()) {
      Schema innerSchema = fieldSchema.getValueType();
      ;
      Object o = fromDBObject(innerSchema, field, e.getKey(), e.getValue());
      rmap.put(new Utf8(e.getKey()), o);
    }
    return new DirtyMapWrapper<>(rmap);
  }
 
开发者ID:apache,项目名称:gora,代码行数:18,代码来源:CouchDBStore.java

示例3: fromMongoMap

import org.apache.gora.persistency.impl.DirtyMapWrapper; //导入依赖的package包/类
Object fromMongoMap(final String docf, final Schema fieldSchema,
    final BSONDecorator easybson, final Field f) {
  BasicDBObject map = easybson.getDBObject(docf);
  Map<Utf8, Object> rmap = new HashMap<>();
  if (map == null) {
    return new DirtyMapWrapper(rmap);
  }
  for (Entry<String, Object> e : map.entrySet()) {
    String mapKey = e.getKey();
    String decodedMapKey = decodeFieldKey(mapKey);

    DocumentFieldType storeType = mapping.getDocumentFieldType(docf);
    Object o = fromDBObject(fieldSchema.getValueType(), storeType, f, mapKey,
        new BSONDecorator(map));
    rmap.put(new Utf8(decodedMapKey), o);
  }
  return new DirtyMapWrapper<>(rmap);
}
 
开发者ID:apache,项目名称:gora,代码行数:19,代码来源:MongoStore.java

示例4: putMap

import org.apache.gora.persistency.impl.DirtyMapWrapper; //导入依赖的package包/类
private int putMap(Mutation m, int count, Schema valueType, Object o, Pair<Text, Text> col, String fieldName) throws GoraException {

    // First of all we delete map field on accumulo store
    Text rowKey = new Text(m.getRow());
    Query<K, T> query = newQuery();
    query.setFields(fieldName);
    query.setStartKey((K)rowKey.toString());
    query.setEndKey((K)rowKey.toString());
    deleteByQuery(query);
    flush();
    if (o == null){
      return 0;
    }

    Set<?> es = ((Map<?, ?>)o).entrySet();
    for (Object entry : es) {
      Object mapKey = ((Entry<?, ?>) entry).getKey();
      Object mapVal = ((Entry<?, ?>) entry).getValue();
      if ((o instanceof DirtyMapWrapper && ((DirtyMapWrapper<?, ?>)o).isDirty())
          || !(o instanceof DirtyMapWrapper)) { //mapVal instanceof Dirtyable && ((Dirtyable)mapVal).isDirty()) {
        m.put(col.getFirst(), new Text(toBytes(mapKey)), new Value(toBytes(valueType, mapVal)));
        count++;
      }
      // TODO map value deletion
    }
    return count;
  }
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:28,代码来源:AccumuloStore.java

示例5: putMap

import org.apache.gora.persistency.impl.DirtyMapWrapper; //导入依赖的package包/类
private int putMap(Mutation m, int count, Schema valueType, Object o, Pair<Text, Text> col, String fieldName) throws GoraException {

    // First of all we delete map field on accumulo store
    Text rowKey = new Text(m.getRow());
    Query<K, T> query = newQuery();
    query.setFields(fieldName);
    query.setStartKey((K)rowKey.toString());
    query.setEndKey((K)rowKey.toString());
    deleteByQuery(query);
    flush();
    if (o == null){
      return 0;
    }

    Set<?> es = ((Map<?, ?>)o).entrySet();
    for (Object entry : es) {
      Object mapKey = ((Entry<?, ?>) entry).getKey();
      Object mapVal = ((Entry<?, ?>) entry).getValue();
      if ((o instanceof DirtyMapWrapper && ((DirtyMapWrapper<?, ?>)o).isDirty())
          || !(o instanceof DirtyMapWrapper)) {
        m.put(col.getFirst(), new Text(toBytes(mapKey)), new Value(toBytes(valueType, mapVal)));
        count++;
      }
      // TODO map value deletion
    }
    return count;
  }
 
开发者ID:apache,项目名称:gora,代码行数:28,代码来源:AccumuloStore.java

示例6: setField

import org.apache.gora.persistency.impl.DirtyMapWrapper; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private void setField(T persistent, Field field, Map map) {
  persistent.put(field.pos(), new DirtyMapWrapper(map));
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:5,代码来源:HBaseStore.java


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