本文整理匯總了Java中org.bson.BSONObject.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java BSONObject.keySet方法的具體用法?Java BSONObject.keySet怎麽用?Java BSONObject.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bson.BSONObject
的用法示例。
在下文中一共展示了BSONObject.keySet方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putAll
import org.bson.BSONObject; //導入方法依賴的package包/類
/**
* Put all value from the BSONObject to the instance
* @param object the BSONObject
*/
@Override
public void putAll(final BSONObject object) {
for ( final String key : object.keySet() ) {
final Object value = object.get(key);
put( key , value );
}
}
示例2: BSONToXCO
import org.bson.BSONObject; //導入方法依賴的package包/類
public static void BSONToXCO(BSONObject bson, XCO xco) {
Set<String> keys = bson.keySet();
for (String key : keys) {
setObjectValue(xco, key, bson.get(key));
}
}
示例3: BSONToMap
import org.bson.BSONObject; //導入方法依賴的package包/類
public static void BSONToMap(BSONObject bson, Map<String, Object> map) {
Set<String> keys = bson.keySet();
for (String key : keys) {
setObjectValue(map, key, bson.get(key));
}
}
示例4: putAll
import org.bson.BSONObject; //導入方法依賴的package包/類
@Override
public void putAll(BSONObject o) {
for (String name: o.keySet())
put(name, o.get(name));
}
示例5: putAll
import org.bson.BSONObject; //導入方法依賴的package包/類
public void putAll( BSONObject o ){
for ( String k : o.keySet() ){
put( k , o.get( k ) );
}
}
示例6: putAll
import org.bson.BSONObject; //導入方法依賴的package包/類
@Override
public void putAll(BSONObject o) {
for(String key : o.keySet()){
put(key, o.get(key));
}
}
示例7: handleOperand
import org.bson.BSONObject; //導入方法依賴的package包/類
/** Handle an operand */
private static Operand handleOperand( String sourceField, BSONObject exp ) {
Operand current = null;
Object value = null;
for ( String field : exp.keySet() ) {
if ( field.startsWith( "$" ) ) {
if ( "$gt".equals( field ) ) {
value = exp.get( field );
GreaterThan gt = new GreaterThan();
gt.setProperty( sourceField );
gt.setLiteral( value );
current = gt;
}
else if ( "$gte".equals( field ) ) {
value = exp.get( field );
GreaterThanEqual gte = new GreaterThanEqual();
gte.setProperty( sourceField );
gte.setLiteral( exp.get( field ) );
current = gte;
// http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%3C%2C%3C%3D%2C%3E%2C%3E%3D
// greater than equals
// { "field" : { $gte: value } }
}
else if ( "$lt".equals( field ) ) {
value = exp.get( field );
LessThan lt = new LessThan();
lt.setProperty( sourceField );
lt.setLiteral( value );
current = lt;
}
else if ( "$lte".equals( field ) ) {
value = exp.get( field );
LessThanEqual lte = new LessThanEqual();
lte.setProperty( sourceField );
lte.setLiteral( value );
current = lte;
}
else if ( "$in".equals( field ) ) {
value = exp.get( field );
BasicBSONList values = ( BasicBSONList ) value;
int size = values.size();
Stack<Operand> expressions = new Stack<Operand>();
for (Object value1 : values) {
Equal equal = new Equal();
equal.setProperty(sourceField);
equal.setLiteral(value1);
expressions.push(equal);
}
// we need to build a tree of expressions
while ( expressions.size() > 1 ) {
OrOperand or = new OrOperand();
or.addChild( expressions.pop() );
or.addChild( expressions.pop() );
expressions.push( or );
}
current = expressions.pop();
}
}
}
return current;
}