Interface FieldConfig

  • All Superinterfaces:
    DeclarationConfig

    public interface FieldConfig
    extends DeclarationConfig
    Allows adding annotations to and removing annotations from a field. Note that the field is not physically altered, the modifications are only seen by the CDI container.
    Since:
    4.0
    See Also:
    Enhancement
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      FieldConfig addAnnotation​(jakarta.enterprise.lang.model.AnnotationInfo annotation)
      Adds given annotation to this field.
      FieldConfig addAnnotation​(java.lang.annotation.Annotation annotation)
      Adds given annotation to this field.
      FieldConfig addAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      Adds a marker annotation of given type to this field.
      jakarta.enterprise.lang.model.declarations.FieldInfo info()
      Returns the FieldInfo corresponding to this transformed field.
      FieldConfig removeAllAnnotations()
      Removes all annotations from this field.
      FieldConfig removeAnnotation​(java.util.function.Predicate<jakarta.enterprise.lang.model.AnnotationInfo> predicate)
      Removes all annotations matching given predicate from this field.
    • Method Detail

      • info

        jakarta.enterprise.lang.model.declarations.FieldInfo info()
        Returns the FieldInfo corresponding to this transformed field.
        Specified by:
        info in interface DeclarationConfig
        Returns:
        the FieldInfo corresponding to this transformed field, never null
      • addAnnotation

        FieldConfig addAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Adds a marker annotation of given type to this field. Does not allow configuring annotation members.
        Specified by:
        addAnnotation in interface DeclarationConfig
        Parameters:
        annotationType - the annotation type, must not be null
        Returns:
        this configurator object, to allow fluent usage
      • addAnnotation

        FieldConfig addAnnotation​(jakarta.enterprise.lang.model.AnnotationInfo annotation)
        Adds given annotation to this field. The AnnotationInfo can be obtained from an annotation target, or constructed from scratch using AnnotationBuilder.
        Specified by:
        addAnnotation in interface DeclarationConfig
        Parameters:
        annotation - the annotation to add to this field, must not be null
        Returns:
        this configurator object, to allow fluent usage
      • addAnnotation

        FieldConfig addAnnotation​(java.lang.annotation.Annotation annotation)
        Adds given annotation to this field. The annotation instance is typically a subclass of AnnotationLiteral.
        Specified by:
        addAnnotation in interface DeclarationConfig
        Parameters:
        annotation - the annotation to add to this field, must not be null
        Returns:
        this configurator object, to allow fluent usage
      • removeAnnotation

        FieldConfig removeAnnotation​(java.util.function.Predicate<jakarta.enterprise.lang.model.AnnotationInfo> predicate)
        Removes all annotations matching given predicate from this field.
        Specified by:
        removeAnnotation in interface DeclarationConfig
        Parameters:
        predicate - an annotation predicate, must not be null
        Returns:
        this configurator object, to allow fluent usage