/** * Returns the first valid implementation as a BoundMethod or throws a * NoSuchMethodException if there is none. * * @param target an Object on which to get and set the field * @param <T> Java class stored in the field * @return a {@link BoundField} with a valid implementation and target * @throws IllegalStateException if the method is static * @throws IllegalArgumentException if the receiver's class is incompatible * @throws NoSuchFieldException if no implementation was found */ public <T> BoundField<T> buildChecked(Object target) throws NoSuchFieldException { return this.<T>buildChecked().bind(target); }
/** * Returns the first valid implementation as a StaticField or throws a * NoSuchFieldException if there is none. * * @param <T> Java class stored in the field * @return a {@link StaticField} with a valid implementation * @throws IllegalStateException if the method is not static * @throws NoSuchFieldException if no implementation was found */ public <T> StaticField<T> buildStaticChecked() throws NoSuchFieldException { return this.<T>buildChecked().asStatic(); }