private static org.fest.reflect.field.Invoker<Long> getDeadlineMsField(Params params) { return Reflection.field("deadlineMs").ofType(long.class).in(params); }
/** * Sets the type of the field to access. * @param <T> the generic type of the field type. * @param type the type of the field to access. * @return a recipient for the field type. * @throws NullPointerException if the given type is <code>null</code>. */ public <T> FieldType<T> ofType(Class<T> type) { return newFieldType(name, type, path); }
static <T> FieldType<T> newFieldType(String name, Class<T> type, List<String> path) { if (type == null) throw new NullPointerException("The type of the field to access should not be null"); return new FieldType<T>(name, type, path); }
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<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 static org.fest.reflect.field.Invoker<Integer> getPriorityField(Params params) { return Reflection.field("priority").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; }
@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; }
public JAnnotationFieldReference( @Nonnull JFieldVar ns ) { this.ns = ns; this.owner = Reflection.field( FIELD_OWNER ).ofType( JDefinedClass.class ).in( ns ).get(); }
@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()); } }