Class DynamicType.Builder.MethodDefinition.ParameterDefinition.Simple.Annotatable.AbstractBase.Adapter<X>

    • Constructor Detail

      • Adapter

        protected Adapter()
    • Method Detail

      • withParameter

        public DynamicType.Builder.MethodDefinition.ParameterDefinition.Simple.Annotatable<X> withParameter​(TypeDefinition type)
        Defines the specified parameter for the currently defined method as the last parameter of the currently defined method.
        Parameters:
        type - The parameter's type. Can also be TargetType if the parameter type should be equal to the currently instrumented type.
        Returns:
        A new builder that is equal to the current builder but where the currently defined method appends the specified parameter.
      • throwing

        public DynamicType.Builder.MethodDefinition.ExceptionDefinition<X> throwing​(java.util.Collection<? extends TypeDefinition> types)
        Defines a method variable to be declared by the currently defined method.
        Parameters:
        types - The type of the exception being declared by the currently defined method.
        Returns:
        A new builder that is equal to the current builder but where the currently defined method declares the specified exception type.
      • typeVariable

        public DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable<X> typeVariable​(java.lang.String symbol,
                                                                                                       java.util.Collection<? extends TypeDefinition> bounds)
        Defines a method variable to be declared by the currently defined method.
        Parameters:
        symbol - The symbol of the type variable.
        bounds - The bounds of the type variables. Can also be TargetType for any type if a bound type should be equal to the currently instrumented type.
        Returns:
        A new builder that is equal to the current builder but where the currently defined method declares the specified type variable.
      • intercept

        public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<X> intercept​(Implementation implementation)
        Implements the previously defined or matched method by the supplied implementation. A method interception is typically implemented in one of the following ways:
        1. If a method is declared by the instrumented type and the type builder creates a subclass or redefinition, any preexisting method is replaced by the given implementation. Any previously defined implementation is lost.
        2. If a method is declared by the instrumented type and the type builder creates a rebased version of the instrumented type, the original method is preserved within a private, synthetic method within the instrumented type. The original method therefore remains invokeable and is treated as the direct super method of the new method. When rebasing a type, it therefore becomes possible to invoke a non-virtual method's super method when a preexisting method body is replaced.
        3. If a virtual method is inherited from a super type, it is overridden. The overridden method is available for super method invocation.
        Parameters:
        implementation - The implementation for implementing the previously defined or matched method.
        Returns:
        A new builder where the previously defined or matched method is implemented by the supplied implementation.
      • withoutCode

        public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<X> withoutCode()
        Defines the previously defined or matched method not to declare a method body. This implies the method to be abstract unless it was already declared to be native.
        Returns:
        A new builder where the previously defined or matched method is implemented to be abstract.