本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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));
}