本文整理汇总了Java中org.bson.BasicBSONObject.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java BasicBSONObject.putAll方法的具体用法?Java BasicBSONObject.putAll怎么用?Java BasicBSONObject.putAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bson.BasicBSONObject
的用法示例。
在下文中一共展示了BasicBSONObject.putAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reduce
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
public void reduce(Text entityId, Iterator<Text> fragments,
OutputCollector<NullWritable, MongoUpdateWritable> framedEntities, Reporter arg3) throws IOException {
while (fragments.hasNext()) {
String triple = fragments.next().toString();
Map<String, Object> jsonData = (Map<String, Object>) JsonUtils.fromString(triple);
Map<String, Object> framedEntity;
try {
framedEntity = JsonLdProcessor.frame(jsonData, entityFrame.getFrame(), options);
List<Object> entities = (List<Object>)framedEntity.get("@graph");
BasicBSONObject bsonQuery = new BasicBSONObject("_id", entityId.toString());
BasicBSONObject bsonObject = new BasicBSONObject();
bsonObject.putAll((Map<String, Object>)entities.get(0));
BasicBSONObject bsonUpdate = new BasicBSONObject();
bsonUpdate.put("$set", bsonObject);
framedEntities.collect(null, new MongoUpdateWritable(bsonQuery, bsonUpdate, true, false));
} catch (JsonLdError e) {
e.printStackTrace();
}
}
}
示例2: toBSONObject
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
/**
*
* @param obj an array of pairs of property name and value/Map<String, Object> or an entity with getter/setter methods.
* @return
*/
public static BasicBSONObject toBSONObject(final Object obj) {
final BasicBSONObject result = new BasicBSONObject();
if (obj instanceof Map) {
result.putAll((Map<String, Object>) obj);
} else if (N.isEntity(obj.getClass())) {
Maps.deepEntity2Map(result, obj);
} else if (obj instanceof Object[]) {
final Object[] a = (Object[]) obj;
if (0 != (a.length % 2)) {
throw new IllegalArgumentException(
"The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods.");
}
for (int i = 0; i < a.length; i++) {
result.put((String) a[i], a[++i]);
}
} else {
throw new IllegalArgumentException("The parameters must be a Map, or an entity class with getter/setter methods");
}
resetObjectId(obj, result);
return result;
}
示例3: setSelector
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
public void setSelector( Map<?, ?> map ) {
selector = new BasicBSONObject();
selector.putAll( map );
}
示例4: setUpdate
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
public void setUpdate( Map<?, ?> map ) {
update = new BasicBSONObject();
update.putAll( map );
}
示例5: setQuery
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
public void setQuery( Map<?, ?> map ) {
query = new BasicBSONObject();
query.putAll( map );
}
示例6: setReturnFieldSelector
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
public void setReturnFieldSelector( Map<?, ?> map ) {
returnFieldSelector = new BasicBSONObject();
returnFieldSelector.putAll( map );
}