Interface InstrumentedType.WithFlexibleName

All Superinterfaces:
AnnotationSource, ByteCodeElement, DeclaredByType, InstrumentedType, Iterable<TypeDefinition>, ModifierReviewable, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration, NamedElement, NamedElement.WithDescriptor, NamedElement.WithRuntimeName, TypeDefinition, TypeDescription, TypeVariableSource
All Known Implementing Classes:
InstrumentedType.Default, InstrumentedType.Frozen
Enclosing interface:
InstrumentedType

public static interface InstrumentedType.WithFlexibleName extends InstrumentedType
Implementations represent an InstrumentedType with a flexible name.
  • Method Details

    • withField

      Creates a new instrumented type that includes a new field.
      Specified by:
      withField in interface InstrumentedType
      Parameters:
      token - A token that represents the field's shape.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the additional field.
    • withAuxiliaryField

      Creates a new instrumented type that includes a new field.
      Specified by:
      withAuxiliaryField in interface InstrumentedType
      Parameters:
      token - A token that represents the field's shape.
      value - The value that this assigned to this field.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the additional field.
    • withMethod

      Creates a new instrumented type that includes a new method or constructor.
      Specified by:
      withMethod in interface InstrumentedType
      Parameters:
      token - A token that represents the method's shape.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the additional method.
    • withRecordComponent

      Creates a new instrumented type that includes a new record component.
      Specified by:
      withRecordComponent in interface InstrumentedType
      Parameters:
      token - A token that represents the record component's shape.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the additional record component.
    • withModifiers

      InstrumentedType.WithFlexibleName withModifiers(int modifiers)
      Creates a new instrumented type with changed modifiers.
      Specified by:
      withModifiers in interface InstrumentedType
      Parameters:
      modifiers - The instrumented type's modifiers.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the given modifiers.
    • withInterfaces

      InstrumentedType.WithFlexibleName withInterfaces(TypeList.Generic interfaceTypes)
      Creates a new instrumented type with the given interfaces implemented.
      Specified by:
      withInterfaces in interface InstrumentedType
      Parameters:
      interfaceTypes - The interface types to implement.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the given interfaces implemented.
    • withNestHost

      Creates a new instrumented type with the supplied nest host. An instrumented type can be its own nest host. Setting a nest host removes all nest members from the instrumented type.
      Specified by:
      withNestHost in interface InstrumentedType
      Parameters:
      nestHost - The nest host of the created instrumented type.
      Returns:
      A new instrumented type with the supplied type as its nest host.
    • withNestMembers

      InstrumentedType.WithFlexibleName withNestMembers(TypeList nestMembers)
      Creates a new instrumented types with the supplied nest members added to this instrumented type. The instrumented type is defined as a nest host if this method is invoked. Any previous nest members are prepended to the supplied types.
      Specified by:
      withNestMembers in interface InstrumentedType
      Parameters:
      nestMembers - The nest members to add to the created instrumented type.
      Returns:
      A new instrumented type that applies the supplied nest members.
    • withEnclosingType

      Creates a new instrumented type with the supplied enclosing type.
      Specified by:
      withEnclosingType in interface InstrumentedType
      Parameters:
      enclosingType - The type to define as the created instrumented type's enclosing type.
      Returns:
      A new instrumented type with the supplied type as its enclosing type.
    • withEnclosingMethod

      Creates a new instrumented type with the supplied enclosing method.
      Specified by:
      withEnclosingMethod in interface InstrumentedType
      Parameters:
      enclosingMethod - The method to define as the created instrumented type's enclosing method.
      Returns:
      A new instrumented type with the supplied method as its enclosing method.
    • withDeclaringType

      Creates a new instrumented type that is declared by the supplied type.
      Specified by:
      withDeclaringType in interface InstrumentedType
      Parameters:
      declaringType - The type that declares the instrumented type or null if no such type exists.
      Returns:
      A new instrumented type that is declared by the instrumented type.
    • withDeclaredTypes

      InstrumentedType.WithFlexibleName withDeclaredTypes(TypeList declaredTypes)
      Creates a new instrumented type that indicates that it declared the supplied types.
      Specified by:
      withDeclaredTypes in interface InstrumentedType
      Parameters:
      declaredTypes - The types to add to the created instrumented type as declared types.
      Returns:
      A new instrumented type that indicates that it has declared the supplied types.
    • withPermittedSubclasses

      InstrumentedType.WithFlexibleName withPermittedSubclasses(@MaybeNull TypeList permittedSubclasses)
      Creates a new instrumented type that includes the supplied permitted subclasses or unseals the type.
      Specified by:
      withPermittedSubclasses in interface InstrumentedType
      Parameters:
      permittedSubclasses - A list of permitted subclasses to include or null to unseal the type.
      Returns:
      A new instrumented type that includes the supplied permitted subclasses or unseals the type.
    • withLocalClass

      InstrumentedType.WithFlexibleName withLocalClass(boolean localClass)
      Creates a new instrumented type that indicates that is defined as a local class. Setting this property resets the anonymous class property.
      Specified by:
      withLocalClass in interface InstrumentedType
      Parameters:
      localClass - true if the instrumented type is supposed to be treated as a local class.
      Returns:
      A new instrumented type that is treated as a local class.
    • withAnonymousClass

      InstrumentedType.WithFlexibleName withAnonymousClass(boolean anonymousClass)
      Creates a new instrumented type that indicates that it is defined as an anonymous class. Setting this property resets the local class property.
      Specified by:
      withAnonymousClass in interface InstrumentedType
      Parameters:
      anonymousClass - true if the instrumented type is supposed to be treated as an anonymous class.
      Returns:
      A new instrumented type that is treated as an anonymous class.
    • withRecord

      InstrumentedType.WithFlexibleName withRecord(boolean record)
      Creates a new instrumented type that indicates that it defined as a record type. Setting this property to false removes all record components.
      Specified by:
      withRecord in interface InstrumentedType
      Parameters:
      record - true if the instrumented type is supposed to be a record.
      Returns:
      A new instrumented type that is defined as a record.
    • withTypeVariable

      InstrumentedType.WithFlexibleName withTypeVariable(TypeVariableToken typeVariable)
      Creates a new instrumented type with the given type variable defined.
      Specified by:
      withTypeVariable in interface InstrumentedType
      Parameters:
      typeVariable - The type variable to declare.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the given type variable declared.
    • withAnnotations

      InstrumentedType.WithFlexibleName withAnnotations(List<? extends AnnotationDescription> annotationDescriptions)
      Creates a new instrumented type with the given annotations.
      Specified by:
      withAnnotations in interface InstrumentedType
      Parameters:
      annotationDescriptions - The annotations to add to the instrumented type.
      Returns:
      A new instrumented type that is equal to this instrumented type but annotated with the given annotations
    • withInitializer

      InstrumentedType.WithFlexibleName withInitializer(LoadedTypeInitializer loadedTypeInitializer)
      Creates a new instrumented type that includes the given LoadedTypeInitializer.
      Specified by:
      withInitializer in interface InstrumentedType
      Parameters:
      loadedTypeInitializer - The type initializer to include.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the additional type initializer.
    • withInitializer

      InstrumentedType.WithFlexibleName withInitializer(ByteCodeAppender byteCodeAppender)
      Creates a new instrumented type that executes the given initializer in the instrumented type's type initializer.
      Specified by:
      withInitializer in interface InstrumentedType
      Parameters:
      byteCodeAppender - The byte code to add to the type initializer.
      Returns:
      A new instrumented type that is equal to this instrumented type but with the given stack manipulation attached to its type initializer.
    • withName

      Creates a new instrumented type with a changed name.
      Parameters:
      name - The name of the instrumented type.
      Returns:
      A new instrumented type that has the given name.
    • withTypeVariables

      Applies a transformation onto all existing type variables of this instrumented type. A transformation is potentially unsafe and it is the responsibility of the supplier to return a valid type variable token from the transformer.
      Parameters:
      matcher - The matcher to decide what type variables to transform.
      transformer - The transformer to apply on all matched type variables.
      Returns:
      A new instrumented type with all matched type variables transformed.