private static org.fest.reflect.field.Invoker<Long> getDeadlineMsField(Params params) { return Reflection.field("deadlineMs").ofType(long.class).in(params); }
private static org.fest.reflect.field.Invoker<Long> getDelayUntilNsField(JobHolder jobHolder) { return Reflection.field("delayUntilNs").ofType(long.class).in(jobHolder); }
private static org.fest.reflect.field.Invoker<Integer> getPriorityField(Params params) { return Reflection.field("priority").ofType(int.class).in(params); }
private static org.fest.reflect.field.Invoker<Long> getDelayMsField(Params params) { return Reflection.field("delayMs").ofType(long.class).in(params); }
private static org.fest.reflect.field.Invoker<Boolean> getCancelOnDeadlineDeadlineField(Params params) { return Reflection.field("cancelOnDeadline").ofType(Boolean.class).in(params); }
private static org.fest.reflect.field.Invoker<String> getGroupIdField(Params params) { return Reflection.field("groupId").ofType(String.class).in(params); }
private static org.fest.reflect.field.Invoker<Integer> getNetworkTypeField(Params params) { return Reflection.field("requiredNetworkType").ofType(int.class).in(params); }
private void setRunning(MessageQueue mq) { Reflection.field("running").ofType(AtomicBoolean.class).in(mq).get().set(true); }
@Override @Nullable public Component focusOwner() { return field("focusOwner").ofType(Component.class).in(KeyboardFocusManager.class).get(); } }
@Provides public WebApplication webApp( @NotNull GuiceContainer guiceContainer ) { WebApplication copy = webApplicationReference; if ( copy == null ) { WebComponent component = Reflection.field( "webComponent" ).ofType( WebComponent.class ).in( guiceContainer ).get(); copy = Reflection.field( "application" ).ofType( WebApplication.class ).in( component ).get(); webApplicationReference = copy; } return copy; }
@Nullable protected Object resolveId( @NotNull Object object ) { try { return Reflection.field( "id" ).ofType( Long.class ).in( object ).get(); } catch ( ReflectionError ignore ) { ignore.printStackTrace(); } return null; }
public JAnnotationFieldReference( @Nonnull JFieldVar ns ) { this.ns = ns; this.owner = Reflection.field( FIELD_OWNER ).ofType( JDefinedClass.class ).in( ns ).get(); }
@Nullable protected Object resolveId( @Nonnull Object object ) { try { return Reflection.field( "id" ).ofType( Long.class ).in( object ).get(); } catch ( ReflectionError ignore ) { ignore.printStackTrace(); } return null; }
@Nullable protected Object resolveId( @NotNull Object object ) { try { return Reflection.field( "id" ).ofType( Long.class ).in( object ).get(); } catch ( ReflectionError ignore ) { ignore.printStackTrace(); } return null; }
@RunsInCurrentThread @Nonnull private static Container dockFor(final @Nonnull JToolBar toolBar) { try { return checkNotNull(field("dockingSource").ofType(Container.class).in(toolBar.getUI()).get()); } catch (RuntimeException e) { throw actionFailure("Unabled to determine dock for JToolBar"); } }
private static int modifiersFrom(@Nonnull String s) { if ("NO_MASK".equals(s)) { return NO_MASK; } try { Integer modifiers = field(s).ofType(int.class).in(InputEvent.class).get(); return checkNotNull(modifiers); } catch (ReflectionError e) { throw new ParsingException(concat("Unable to retrieve modifiers from text ", quote(s)), e.getCause()); } } }
private boolean isCanceled() { try { int state = Preconditions.checkNotNull(field("state").ofType(int.class).in(task).get()); return state == CANCELED; } catch (RuntimeException e) { handleException(e); } return false; }
private static int keyCodeFrom(@Nonnull String s) { try { Integer keyCode = field("VK_" + s).ofType(int.class).in(KeyEvent.class).get(); return checkNotNull(keyCode); } catch (ReflectionError e) { throw new ParsingException(concat("Unable to retrieve key code from text ", quote(s)), e.getCause()); } }
private float[] getCurrentPosition(final ColorPicker colorPicker) { final float mAngle = field("mAngle") .ofType(float.class) .in(colorPicker) .get(); return getPosition(colorPicker, mAngle); }
@Test public void shouldUnregisterLifecycleCallbacksOnActivityDestroyed() throws Exception { speakerbox.getCallbacks().onActivityDestroyed(activity); ArrayList callbackList = field("mActivityLifecycleCallbacks") .ofType(ArrayList.class) .in(application) .get(); assertThat(callbackList).isEmpty(); }