Package io.micronaut.core.beans
Interface BeanReadProperty<B,T>
- Type Parameters:
B
- The bean typeT
- The bean property type
- All Superinterfaces:
AnnotatedElement
,AnnotationMetadata
,AnnotationMetadataDelegate
,AnnotationMetadataProvider
,AnnotationSource
,ArgumentCoercible<T>
,Named
- All Known Subinterfaces:
BeanProperty<B,
,T> UnsafeBeanProperty<B,
,T> UnsafeBeanReadProperty<B,
T>
- All Known Implementing Classes:
AbstractBeanProperty
public interface BeanReadProperty<B,T>
extends AnnotatedElement, AnnotationMetadataDelegate, ArgumentCoercible<T>
Represents a read write property of a bean.
A BeanReadProperty
allows you to read the value of a property via get(Object)
, without using reflection.
The annotations of a property can be inspected via the AnnotationMetadataProvider.getAnnotationMetadata()
method.
- Since:
- 4.4.0
- Author:
- Denis Stepanov
- See Also:
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptionRepresent the type as an argument, including any generic type information.Read the bean value.default <T2> Optional<T2>
get
(B bean, @NonNull ArgumentConversionContext<T2> conversionContext) Read the value and try to convert it to the given type.default <T2> Optional<T2>
Read the value and try to convert it to the given type.Read the value and try to convert it to the given type.default <T2> T2
Read the value and try to convert it to the given type.The declaring type of the property.getType()
Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadata
-
Method Details
-
getDeclaringBean
- Returns:
- The declaring bean introspection.
-
getDeclaringType
The declaring type of the property.- Returns:
- The type
-
get
Read the bean value.- Parameters:
bean
- The bean to read from- Returns:
- The value
- Throws:
IllegalArgumentException
- If the bean instance if not of the correct type
-
get
Read the value and try to convert it to the given type.- Type Parameters:
T2
- The generic type- Parameters:
bean
- The beantype
- The type- Returns:
- The value if conversion was possible.
-
get
Read the value and try to convert it to the given type.- Type Parameters:
T2
- The generic type- Parameters:
bean
- The beanargument
- The type- Returns:
- The value if conversion was possible.
-
get
default <T2> Optional<T2> get(@NonNull B bean, @NonNull @NonNull ArgumentConversionContext<T2> conversionContext) Read the value and try to convert it to the given type.- Type Parameters:
T2
- The generic type- Parameters:
bean
- The beanconversionContext
- The conversion context to use- Returns:
- The value if conversion was possible.
-
get
@Nullable default <T2> T2 get(@NonNull B bean, @NonNull @NonNull Class<T2> type, @Nullable T2 defaultValue) Read the value and try to convert it to the given type.- Type Parameters:
T2
- The generic type- Parameters:
bean
- The beantype
- The typedefaultValue
- The default value if conversion is not possible- Returns:
- The value if conversion was possible.
-
getType
- Returns:
- The property type.
-
asArgument
Represent the type as an argument, including any generic type information.- Specified by:
asArgument
in interfaceArgumentCoercible<B>
- Returns:
- The argument
-