use of java.lang.Override in project storio by pushtorefresh.
the class PrimitiveMethodsFactoryMethodStorIOSQLitePutResolver method mapToContentValues.
/**
* {@inheritDoc}
*/
@Override
@NonNull
public ContentValues mapToContentValues(@NonNull PrimitiveMethodsFactoryMethod object) {
ContentValues contentValues = new ContentValues(8);
contentValues.put("field1", object.getField1());
contentValues.put("field7", object.getField7());
contentValues.put("field6", object.getField6());
contentValues.put("field8", object.getField8());
contentValues.put("field3", object.getField3());
contentValues.put("field2", object.getField2());
contentValues.put("field5", object.getField5());
contentValues.put("field4", object.getField4());
return contentValues;
}
use of java.lang.Override in project storio by pushtorefresh.
the class BoxedTypesMethodsConstructorIgnoreNullStorIOSQLiteGetResolver method mapFromCursor.
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsConstructorIgnoreNull mapFromCursor(@NonNull Cursor cursor) {
Boolean field1 = null;
if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
}
Short field2 = null;
if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
field2 = cursor.getShort(cursor.getColumnIndex("field2"));
}
Integer field3 = null;
if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
field3 = cursor.getInt(cursor.getColumnIndex("field3"));
}
Long field4 = null;
if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
field4 = cursor.getLong(cursor.getColumnIndex("field4"));
}
Float field5 = null;
if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
}
Double field6 = null;
if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
}
BoxedTypesMethodsConstructorIgnoreNull object = new BoxedTypesMethodsConstructorIgnoreNull(field1, field2, field3, field4, field5, field6);
return object;
}
use of java.lang.Override in project reactive-streams-jvm by reactive-streams.
the class PublisherVerification method optional_spec104_mustSignalOnErrorWhenFails.
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4
@Override
@Test
public void optional_spec104_mustSignalOnErrorWhenFails() throws Throwable {
try {
whenHasErrorPublisherTest(new PublisherTestRun<T>() {
@Override
public void run(final Publisher<T> pub) throws InterruptedException {
final Latch onErrorlatch = new Latch(env);
final Latch onSubscribeLatch = new Latch(env);
pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) {
@Override
public void onSubscribe(Subscription subs) {
onSubscribeLatch.assertOpen("Only one onSubscribe call expected");
onSubscribeLatch.close();
}
@Override
public void onError(Throwable cause) {
onSubscribeLatch.assertClosed("onSubscribe should be called prior to onError always");
onErrorlatch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub));
onErrorlatch.close();
}
});
onSubscribeLatch.expectClose("Should have received onSubscribe");
onErrorlatch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub));
env.verifyNoAsyncErrors();
}
});
} catch (SkipException se) {
throw se;
} catch (Throwable ex) {
// which was wrong of him - he should have signalled on error using onError
throw new RuntimeException(String.format("Publisher threw exception (%s) instead of signalling error via onError!", ex.getMessage()), ex);
}
}
use of java.lang.Override in project platform_frameworks_base by android.
the class IconTest method testAsync.
@SmallTest
public void testAsync() throws Exception {
final Bitmap bit1 = ((BitmapDrawable) getContext().getDrawable(R.drawable.landscape)).getBitmap();
final File dir = getContext().getExternalFilesDir(null);
final File file1 = new File(dir, "async-original.png");
bit1.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(file1));
final Icon im1 = Icon.createWithFilePath(file1.toString());
final HandlerThread thd = new HandlerThread("testAsync");
thd.start();
final Handler h = new Handler(thd.getLooper());
L(TAG, "asyncTest: dispatching load to thread: " + thd);
im1.loadDrawableAsync(mContext, new Icon.OnDrawableLoadedListener() {
@Override
public void onDrawableLoaded(Drawable draw1) {
L(TAG, "asyncTest: thread: loading drawable");
L(TAG, "asyncTest: thread: loaded: %dx%d", draw1.getIntrinsicWidth(), draw1.getIntrinsicHeight());
final Bitmap test1 = Bitmap.createBitmap(draw1.getIntrinsicWidth(), draw1.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
draw1.setBounds(0, 0, test1.getWidth(), test1.getHeight());
draw1.draw(new Canvas(test1));
try {
test1.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(new File(dir, "async-test.png")));
} catch (java.io.FileNotFoundException ex) {
fail("couldn't create test file: " + ex);
}
if (!equalBitmaps(bit1, test1)) {
findBitmapDifferences(bit1, test1);
fail("testAsync: file1 differs, check " + dir);
}
}
}, h);
L(TAG, "asyncTest: awaiting result");
// ;_;
Thread.sleep(500);
assertTrue("async-test.png does not exist!", new File(dir, "async-test.png").exists());
L(TAG, "asyncTest: done");
}
use of java.lang.Override in project platform_frameworks_base by android.
the class KeyguardSecurityViewFlipper method onTouchEvent.
@Override
public boolean onTouchEvent(MotionEvent ev) {
boolean result = super.onTouchEvent(ev);
mTempRect.set(0, 0, 0, 0);
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.VISIBLE) {
offsetRectIntoDescendantCoords(child, mTempRect);
ev.offsetLocation(mTempRect.left, mTempRect.top);
result = child.dispatchTouchEvent(ev) || result;
ev.offsetLocation(-mTempRect.left, -mTempRect.top);
}
}
return result;
}
Aggregations