All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dm.jrt.proxy.builder.ProxyRoutineBuilder Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.dm.jrt.proxy.builder;

import com.github.dm.jrt.builder.ConfigurableBuilder;
import com.github.dm.jrt.builder.ProxyConfigurableBuilder;
import com.github.dm.jrt.util.ClassToken;

import javax.annotation.Nonnull;

/**
 * Interface defining a builder of routines wrapping an object methods.
 * 

* Created by davide-maestroni on 03/07/2015. */ public interface ProxyRoutineBuilder extends ConfigurableBuilder, ProxyConfigurableBuilder { /** * Returns a proxy object enabling asynchronous call of the target instance methods. *

* The routines used for calling the methods will honor the attributes specified in any * optional {@link com.github.dm.jrt.annotation.Alias Alias}, * {@link com.github.dm.jrt.annotation.Input Input}, * {@link com.github.dm.jrt.annotation.Inputs Inputs}, * {@link com.github.dm.jrt.annotation.Output Output}, * {@link com.github.dm.jrt.annotation.Priority Priority}, * {@link com.github.dm.jrt.annotation.ShareGroup ShareGroup}, * {@link com.github.dm.jrt.annotation.Timeout Timeout} and * {@link com.github.dm.jrt.annotation.TimeoutAction TimeoutAction} annotations.
* Note that such annotations will override any configuration set through the builder. *

* The proxy object is created through code generation based on the interfaces annotated with * {@link com.github.dm.jrt.proxy.annotation.Proxy Proxy}. The generated class name and package * will be chosen according to the specific annotation attributes.
* It is actually possible to avoid the use of reflection for the proxy object instantiation by * explicitly calling the <generated_class_name>.on() methods.
* Note, however, that, since the class is generated, a generic IDE may highlight an error even * if the compilation is successful. * * @param itf the interface implemented by the return object. * @param the interface type. * @return the proxy object. * @throws java.lang.IllegalArgumentException if the specified class does not represent an * interface. */ @Nonnull TYPE buildProxy(@Nonnull Class itf); /** * Returns a proxy object enabling asynchronous call of the target instance methods. *

* The routines used for calling the methods will honor the attributes specified in any * optional {@link com.github.dm.jrt.annotation.Alias Alias}, * {@link com.github.dm.jrt.annotation.Input Input}, * {@link com.github.dm.jrt.annotation.Inputs Inputs}, * {@link com.github.dm.jrt.annotation.Output Output}, * {@link com.github.dm.jrt.annotation.Priority Priority}, * {@link com.github.dm.jrt.annotation.ShareGroup ShareGroup}, * {@link com.github.dm.jrt.annotation.Timeout Timeout} and * {@link com.github.dm.jrt.annotation.TimeoutAction TimeoutAction} annotations.
* Note that such annotations will override any configuration set through the builder. *

* The proxy object is created through code generation based on the interfaces annotated with * {@link com.github.dm.jrt.proxy.annotation.Proxy Proxy}. The generated class name and package * will be chosen according to the specific annotation attributes.
* It is actually possible to avoid the use of reflection for the proxy object instantiation by * explicitly calling the <generated_class_name>.on() methods.
* Note, however, that, since the class is generated, a generic IDE may highlight an error even * if the compilation is successful. * * @param itf the token of the interface implemented by the return object. * @param the interface type. * @return the proxy object. * @throws java.lang.IllegalArgumentException if the specified class does not represent an * interface. */ @Nonnull TYPE buildProxy(@Nonnull ClassToken itf); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy