本文整理汇总了Java中org.bson.BasicBSONObject.containsField方法的典型用法代码示例。如果您正苦于以下问题:Java BasicBSONObject.containsField方法的具体用法?Java BasicBSONObject.containsField怎么用?Java BasicBSONObject.containsField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bson.BasicBSONObject
的用法示例。
在下文中一共展示了BasicBSONObject.containsField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
@Override
public Object call(BasicBSONObject bsonResponse) {
this.connexionBtnFragment.hideLoader();
//Log.i("REQUEST", bsonResponse.toString());
//si la r�ponse ne contient le token de login
if(bsonResponse.containsField(ServerHelper.SERVER_TOKEN_KEY)
&& bsonResponse.containsField(ServerHelper.SERVER_EMAIL_KEY)){
//on d�marre l'activity WalletActivity
Intent loadWallet = new Intent(getApplicationContext(), WalletActivity.class);
Bundle session = new Bundle();
session.putString(ServerHelper.SERVER_TOKEN_KEY, bsonResponse.getString(ServerHelper.SERVER_TOKEN_KEY));
session.putString(ServerHelper.SERVER_EMAIL_KEY, bsonResponse.getString(ServerHelper.SERVER_EMAIL_KEY));
session.putString(ServerHelper.SERVER_TAG_KEY, bsonResponse.getString(ServerHelper.SERVER_TAG_KEY));
loadWallet.putExtra("session", session);
startActivity(loadWallet);
}
return null;
}
示例2: readResponse
import org.bson.BasicBSONObject; //导入方法依赖的package包/类
public static BasicBSONObject readResponse(InputStream stream)
throws CustomServerException, JSONException, IOException{
BasicBSONObject bsonResponse;
String lineRead = "";
StringBuilder stringResponse = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
try {
while((lineRead = reader.readLine())!=null){
stringResponse.append(lineRead);
}
} catch (IOException e) {
throw e;
}
bsonResponse = decodeResponseBody(stringResponse.toString());
if(bsonResponse.containsField("error")){
throw ErrorHelper.getCustomServerException(bsonResponse.getString("error"));
}
return bsonResponse;
}