Java Code Examples for net.bytebuddy.implementation.bytecode.assign.Assigner#DEFAULT

The following examples show how to use net.bytebuddy.implementation.bytecode.assign.Assigner#DEFAULT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodDelegation.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new method delegation.
 *
 * @param implementationDelegate The implementation delegate to use by this method delegator.
 * @param parameterBinders       The parameter binders to use by this method delegator.
 * @param ambiguityResolver      The ambiguity resolver to use by this method delegator.
 * @param bindingResolver        The binding resolver being used to select the relevant method binding.
 */
protected MethodDelegation(ImplementationDelegate implementationDelegate,
                           List<TargetMethodAnnotationDrivenBinder.ParameterBinder<?>> parameterBinders,
                           MethodDelegationBinder.AmbiguityResolver ambiguityResolver,
                           MethodDelegationBinder.BindingResolver bindingResolver) {
    this(implementationDelegate,
            parameterBinders,
            ambiguityResolver,
            MethodDelegationBinder.TerminationHandler.Default.RETURNING,
            bindingResolver,
            Assigner.DEFAULT);
}
 
Example 2
Source File: MethodCall.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
/**
 * Invokes the given constructor in order to create an instance.
 *
 * @param methodDescription A description of the constructor to invoke.
 * @return A method call that invokes the given constructor without providing any arguments.
 */
public static MethodCall construct(MethodDescription methodDescription) {
    if (!methodDescription.isConstructor()) {
        throw new IllegalArgumentException("Not a constructor: " + methodDescription);
    }
    return new MethodCall(new MethodLocator.ForExplicitMethod(methodDescription),
            TargetHandler.ForConstructingInvocation.Factory.INSTANCE,
            Collections.<ArgumentLoader.Factory>emptyList(),
            MethodInvoker.ForContextualInvocation.Factory.INSTANCE,
            TerminationHandler.Simple.RETURNING,
            Assigner.DEFAULT,
            Assigner.Typing.STATIC);
}
 
Example 3
Source File: MethodCall.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new method call without a specified target.
 *
 * @param methodLocator The method locator to use.
 */
protected WithoutSpecifiedTarget(MethodLocator.Factory methodLocator) {
    super(methodLocator,
            TargetHandler.ForSelfOrStaticInvocation.Factory.INSTANCE,
            Collections.<ArgumentLoader.Factory>emptyList(),
            MethodInvoker.ForContextualInvocation.Factory.INSTANCE,
            TerminationHandler.Simple.RETURNING,
            Assigner.DEFAULT,
            Assigner.Typing.STATIC);
}
 
Example 4
Source File: FixedValue.java    From byte-buddy with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new fixed value appender for the origin type.
 */
protected ForOriginType() {
    this(Assigner.DEFAULT, Assigner.Typing.STATIC);
}
 
Example 5
Source File: FixedValue.java    From byte-buddy with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an implementation that returns the instance of the instrumented type.
 */
protected ForThisValue() {
    super(Assigner.DEFAULT, Assigner.Typing.STATIC);
}
 
Example 6
Source File: InvocationHandlerAdapter.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates an implementation for any instance of an {@link java.lang.reflect.InvocationHandler} that delegates
 * all method interceptions to the given instance which will be stored in a {@code static} field.
 *
 * @param invocationHandler The invocation handler to which all method calls are delegated.
 * @param fieldName         The name of the field.
 * @return An implementation that delegates all method interceptions to the given invocation handler.
 */
public static InvocationHandlerAdapter of(InvocationHandler invocationHandler, String fieldName) {
    return new ForInstance(fieldName, CACHED, UNPRIVILEGED, Assigner.DEFAULT, invocationHandler);
}
 
Example 7
Source File: InvocationHandlerAdapter.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates an implementation for any {@link java.lang.reflect.InvocationHandler} that delegates
 * all method interceptions to a field with the given name. This field has to be of a subtype of invocation
 * handler and needs to be set before any invocations are intercepted. Otherwise, a {@link java.lang.NullPointerException}
 * will be thrown.
 *
 * @param name                The name of the field.
 * @param fieldLocatorFactory The field locator factory
 * @return An implementation that delegates all method interceptions to an instance field of the given name.
 */
public static InvocationHandlerAdapter toField(String name, FieldLocator.Factory fieldLocatorFactory) {
    return new ForField(name, CACHED, UNPRIVILEGED, Assigner.DEFAULT, fieldLocatorFactory);
}
 
Example 8
Source File: MethodCallProxy.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new method call proxy for a given method and uses a default assigner for assigning the method's return
 * value to either the {@link java.util.concurrent.Callable#call()} or {@link Runnable#run()} method returns.
 *
 * @param specialMethodInvocation The special method invocation which should be invoked by this method call proxy.
 * @param serializableProxy       Determines if the generated proxy should be serializableProxy.
 */
public MethodCallProxy(Implementation.SpecialMethodInvocation specialMethodInvocation, boolean serializableProxy) {
    this(specialMethodInvocation, serializableProxy, Assigner.DEFAULT);
}
 
Example 9
Source File: FixedValue.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new fixed value implementation that returns a method's argument.
 *
 * @param index The argument's index.
 */
protected ForArgument(int index) {
    this(Assigner.DEFAULT, Assigner.Typing.STATIC, index);
}
 
Example 10
Source File: FixedValue.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new constant pool fixed value implementation.
 *
 * @param valueLoadInstruction The instruction that is responsible for loading the constant pool value onto the
 *                             operand stack.
 * @param loadedType           A type description representing the loaded type.
 */
protected ForPoolValue(StackManipulation valueLoadInstruction, TypeDescription loadedType) {
    this(Assigner.DEFAULT, Assigner.Typing.STATIC, valueLoadInstruction, loadedType);
}
 
Example 11
Source File: FixedValue.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new static field fixed value implementation.
 *
 * @param fieldName The name of the field for storing the fixed value.
 * @param value     The fixed value to be returned.
 */
protected ForValue(String fieldName, Object value) {
    this(Assigner.DEFAULT, Assigner.Typing.STATIC, fieldName, value);
}
 
Example 12
Source File: FieldAccessor.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a field accessor for an implicit property.
 *
 * @param fieldLocation The field's location.
 */
protected ForImplicitProperty(FieldLocation fieldLocation) {
    this(fieldLocation, Assigner.DEFAULT, Assigner.Typing.STATIC);
}