/** * Find a field based on a type. E.g. * <p> </p> * <code> * await().until(fieldIn(object).ofType(int.class), equalTo(2)); * </code> * <p> </p> * You can also specify the field more accurately by continuing the statement: * E.g. * <code> * await().until(fieldIn(object).ofType(int.class).andWithName("fieldName"), equalTo(2)); * </code> * <p> </p> * or * <p> </p> * <code> * await().until(fieldIn(object).ofType(int.class).andAnnotatedWith(MyAnnotation.class).andWithName("fieldName"), equalTo(2)); * </code> * * @param fieldType The type of the field. * @param <T> The type of the field * @return The field supplier */ public <T> NameAndAnnotationFieldSupplier<T> ofType(Class<T> fieldType) { this.expectedFieldType = fieldType; return new NameAndAnnotationFieldSupplier<T>(); }
/** * Find a field based on the annotation and field type. E.g. * <p> </p> * <code> * await().until(fieldIn(object).annotatedWith(MyAnnotation.class).andOfType(int.class), equalTo(2)); * </code> * * @param type The class representing the type of the field * @param <S> The type of the field * @return The supplier */ public <S> NameAndAnnotationFieldSupplier<S> andOfType(Class<S> type) { assertNotNullParameter(type, "Expected field type"); FieldSupplierBuilder.this.expectedFieldType = type; return new NameAndAnnotationFieldSupplier<S>(); }
/** * Find a field based on a type. E.g. * <p> </p> * <code> * await().until(fieldIn(object).ofType(int.class), equalTo(2)); * </code> * <p> </p> * You can also specify the field more accurately by continuing the statement: * E.g. * <code> * await().until(fieldIn(object).ofType(int.class).andWithName("fieldName"), equalTo(2)); * </code> * <p> </p> * or * <p> </p> * <code> * await().until(fieldIn(object).ofType(int.class).andAnnotatedWith(MyAnnotation.class).andWithName("fieldName"), equalTo(2)); * </code> * * @param fieldType The type of the field. * @param <T> The type of the field * @return The field supplier */ public <T> NameAndAnnotationFieldSupplier<T> ofType(Class<T> fieldType) { this.expectedFieldType = fieldType; return new NameAndAnnotationFieldSupplier<T>(); }
/** * Find a field based on the annotation and field type. E.g. * <p> </p> * <code> * await().until(fieldIn(object).annotatedWith(MyAnnotation.class).andOfType(int.class), equalTo(2)); * </code> * * @param type The class representing the type of the field * @param <S> The type of the field * @return The supplier */ public <S> NameAndAnnotationFieldSupplier<S> andOfType(Class<S> type) { assertNotNullParameter(type, "Expected field type"); FieldSupplierBuilder.this.expectedFieldType = type; return new NameAndAnnotationFieldSupplier<S>(); }