public class FieldAccessor extends Object
Field
of an AnchorBean
.Modifier and Type | Method and Description |
---|---|
static Optional<Object> |
fieldFromBean(AnchorBean<?> bean,
Field field)
Retrieves the value of a
Field from a AnchorBean . |
static boolean |
isFieldAnnotatedAsOptional(Field field)
Is a particular
Field on a AnchorBean marked as optional? |
public static Optional<Object> fieldFromBean(AnchorBean<?> bean, Field field) throws IllegalAccessException, BeanMisconfiguredException
Field
from a AnchorBean
.bean
- the beanfield
- the field to retrieve a value fromOptional.empty()
if it doesn't exist and
the bean is marked as optional.IllegalAccessException
- if reflection tries to access a property it has no permissions
for.BeanMisconfiguredException
- if no value exists for the field (and it's not marked as
optional).public static boolean isFieldAnnotatedAsOptional(Field field)
Field
on a AnchorBean
marked as optional?field
- the fieldCopyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.