use of java.lang.Override in project LoganSquare by bluelinelabs.
the class PrivateFieldModel$$JsonObjectMapper method serialize.
@Override
public void serialize(PrivateFieldModel object, JsonGenerator jsonGenerator, boolean writeStartAndEnd) throws IOException {
if (writeStartAndEnd) {
jsonGenerator.writeStartObject();
}
if (object.getStringThatStartsWithM() != null) {
jsonGenerator.writeStringField("string_to_test_m_vars", object.getStringThatStartsWithM());
}
jsonGenerator.writeBooleanField("privateBoolean", object.isPrivateBoolean());
final List<String> lslocalprivateList = object.getPrivateList();
if (lslocalprivateList != null) {
jsonGenerator.writeFieldName("privateList");
jsonGenerator.writeStartArray();
for (String element1 : lslocalprivateList) {
if (element1 != null) {
jsonGenerator.writeString(element1);
}
}
jsonGenerator.writeEndArray();
}
final Map<String, String> lslocalprivateMap = object.getPrivateMap();
if (lslocalprivateMap != null) {
jsonGenerator.writeFieldName("privateMap");
jsonGenerator.writeStartObject();
for (Map.Entry<String, String> entry1 : lslocalprivateMap.entrySet()) {
jsonGenerator.writeFieldName(entry1.getKey().toString());
if (entry1.getValue() != null) {
jsonGenerator.writeString(entry1.getValue());
}
}
jsonGenerator.writeEndObject();
}
if (object.getPrivateNamedString() != null) {
jsonGenerator.writeStringField("private_named_string", object.getPrivateNamedString());
}
if (object.getPrivateString() != null) {
jsonGenerator.writeStringField("privateString", object.getPrivateString());
}
if (writeStartAndEnd) {
jsonGenerator.writeEndObject();
}
}
use of java.lang.Override in project LoganSquare by bluelinelabs.
the class PrivateFieldModel$$JsonObjectMapper method parseField.
@Override
public void parseField(PrivateFieldModel instance, String fieldName, JsonParser jsonParser) throws IOException {
if ("string_to_test_m_vars".equals(fieldName)) {
instance.setStringThatStartsWithM(jsonParser.getValueAsString(null));
} else if ("privateBoolean".equals(fieldName)) {
instance.setPrivateBoolean(jsonParser.getValueAsBoolean());
} else if ("privateList".equals(fieldName)) {
if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
ArrayList<String> collection1 = new ArrayList<String>();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
String value1;
value1 = jsonParser.getValueAsString(null);
collection1.add(value1);
}
instance.setPrivateList(collection1);
} else {
instance.setPrivateList(null);
}
} else if ("privateMap".equals(fieldName)) {
if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
HashMap<String, String> map1 = new HashMap<String, String>();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String key1 = jsonParser.getText();
jsonParser.nextToken();
if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
map1.put(key1, null);
} else {
map1.put(key1, jsonParser.getValueAsString(null));
}
}
instance.setPrivateMap(map1);
} else {
instance.setPrivateMap(null);
}
} else if ("private_named_string".equals(fieldName)) {
instance.setPrivateNamedString(jsonParser.getValueAsString(null));
} else if ("privateString".equals(fieldName)) {
instance.setPrivateString(jsonParser.getValueAsString(null));
}
}
use of java.lang.Override in project facebook-android-sdk by facebook.
the class BatchRequestTests method testBatchCallbackIsCalled.
@LargeTest
public void testBatchCallbackIsCalled() {
final AtomicInteger count = new AtomicInteger();
GraphRequest request1 = GraphRequest.newGraphPathRequest(null, "4", new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
count.incrementAndGet();
}
});
GraphRequest request2 = GraphRequest.newGraphPathRequest(null, "4", new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
count.incrementAndGet();
}
});
GraphRequestBatch batch = new GraphRequestBatch(request1, request2);
batch.addCallback(new GraphRequestBatch.Callback() {
@Override
public void onBatchCompleted(GraphRequestBatch batch) {
count.incrementAndGet();
}
});
batch.executeAndWait();
assertEquals(3, count.get());
}
use of java.lang.Override in project facebook-android-sdk by facebook.
the class BatchRequestTests method testMixedBatchCallbacks.
@LargeTest
public void testMixedBatchCallbacks() {
final AtomicInteger requestProgressCount = new AtomicInteger();
final AtomicInteger requestCompletedCount = new AtomicInteger();
final AtomicInteger batchProgressCount = new AtomicInteger();
final AtomicInteger batchCompletedCount = new AtomicInteger();
final AccessToken accessToken = getAccessTokenForSharedUser();
String appId = getApplicationId();
GraphRequest.setDefaultBatchApplicationId(appId);
GraphRequest request1 = GraphRequest.newGraphPathRequest(null, "4", new GraphRequest.OnProgressCallback() {
@Override
public void onCompleted(GraphResponse response) {
requestCompletedCount.incrementAndGet();
}
@Override
public void onProgress(long current, long max) {
if (current == max) {
requestProgressCount.incrementAndGet();
} else if (current > max) {
requestProgressCount.set(0);
}
}
});
assertNotNull(request1);
GraphRequest request2 = GraphRequest.newGraphPathRequest(null, "4", null);
assertNotNull(request2);
GraphRequestBatch batch = new GraphRequestBatch(request1, request2);
batch.addCallback(new GraphRequestBatch.OnProgressCallback() {
@Override
public void onBatchCompleted(GraphRequestBatch batch) {
batchCompletedCount.incrementAndGet();
}
@Override
public void onBatchProgress(GraphRequestBatch batch, long current, long max) {
if (current == max) {
batchProgressCount.incrementAndGet();
} else if (current > max) {
batchProgressCount.set(0);
}
}
});
batch.executeAndWait();
assertEquals(1, requestProgressCount.get());
assertEquals(1, requestCompletedCount.get());
assertEquals(1, batchProgressCount.get());
assertEquals(1, batchCompletedCount.get());
}
use of java.lang.Override in project facebook-android-sdk by facebook.
the class BatchRequestTests method testBatchLastOnProgressCallbackIsCalledOnce.
@LargeTest
public void testBatchLastOnProgressCallbackIsCalledOnce() {
final AtomicInteger count = new AtomicInteger();
final AccessToken accessToken = getAccessTokenForSharedUser();
String appId = getApplicationId();
GraphRequest.setDefaultBatchApplicationId(appId);
GraphRequest request1 = GraphRequest.newGraphPathRequest(accessToken, "4", null);
assertNotNull(request1);
GraphRequest request2 = GraphRequest.newGraphPathRequest(accessToken, "4", null);
assertNotNull(request2);
GraphRequestBatch batch = new GraphRequestBatch(request1, request2);
batch.addCallback(new GraphRequestBatch.OnProgressCallback() {
@Override
public void onBatchCompleted(GraphRequestBatch batch) {
}
@Override
public void onBatchProgress(GraphRequestBatch batch, long current, long max) {
if (current == max) {
count.incrementAndGet();
} else if (current > max) {
count.set(0);
}
}
});
batch.executeAndWait();
assertEquals(1, count.get());
}
Aggregations