Interface ClassConfig

  • All Superinterfaces:
    DeclarationConfig

    public interface ClassConfig
    extends DeclarationConfig
    Allows adding annotations to and removing annotations from a class. Note that the class 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
      ClassConfig addAnnotation​(jakarta.enterprise.lang.model.AnnotationInfo annotation)
      Adds given annotation to this class.
      ClassConfig addAnnotation​(java.lang.annotation.Annotation annotation)
      Adds given annotation to this class.
      ClassConfig addAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      Adds a marker annotation of given type to this class.
      java.util.Collection<MethodConfig> constructors()
      Returns a collection of MethodConfig objects for each constructor of this class, as defined by ClassInfo.constructors.
      java.util.Collection<FieldConfig> fields()
      Returns a collection of FieldConfig objects for each field of this class, as defined by ClassInfo.fields.
      jakarta.enterprise.lang.model.declarations.ClassInfo info()
      Returns the ClassInfo corresponding to this transformed class.
      java.util.Collection<MethodConfig> methods()
      Returns a collection of MethodConfig objects for each method of this class, as defined by ClassInfo.methods.
      ClassConfig removeAllAnnotations()
      Removes all annotations from this class.
      ClassConfig removeAnnotation​(java.util.function.Predicate<jakarta.enterprise.lang.model.AnnotationInfo> predicate)
      Removes all annotations matching given predicate from this class.
    • Method Detail

      • info

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

        ClassConfig addAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Adds a marker annotation of given type to this class. 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

        ClassConfig addAnnotation​(jakarta.enterprise.lang.model.AnnotationInfo annotation)
        Adds given annotation to this class. 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 class, must not be null
        Returns:
        this configurator object, to allow fluent usage
      • addAnnotation

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

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

        java.util.Collection<MethodConfig> constructors()
        Returns a collection of MethodConfig objects for each constructor of this class, as defined by ClassInfo.constructors.
        Returns:
        immutable collection of MethodConfig objects, never null
      • methods

        java.util.Collection<MethodConfig> methods()
        Returns a collection of MethodConfig objects for each method of this class, as defined by ClassInfo.methods.
        Returns:
        immutable collection of MethodConfig objects, never null
      • fields

        java.util.Collection<FieldConfig> fields()
        Returns a collection of FieldConfig objects for each field of this class, as defined by ClassInfo.fields.
        Returns:
        immutable collection of FieldConfig objects, never null