Package xyz.ressor

Class RessorBuilder<ServiceType,​DataType>

  • Type Parameters:
    ServiceType - service public type

    public class RessorBuilder<ServiceType,​DataType>
    extends java.lang.Object
    The builder for the Ressor service proxy class, which will be built and loaded by a ClassLoader at runtime.

    If T is a class, it will be extended by the proxy class. If T doesn't have a default constructor, Ressor will scan it for the mostly short and public constructor available, which will be used for the proxy instance creation (which happens once). This can't be avoided since this is how the JVM inheritance mechanism works - we should call at least one constructor of a super type.

    Otherwise, you can mark your constructor with ProxyConstructor annotation, which will tell Ressor to use it explicitly. If constructor has parameters, Ressor will guess and pass the default ones, based on the underlying parameter type (null for object references, 0 for numbers, empty collections, etc). Alternatively, you can provide your own param values with proxyDefaultArguments(Object...).

    By default, Ressor will also find the constructor to create the actual instances of your service. You can alternatively mark the desired constructor/factory method with ServiceFactory annotation. It must have a single parameter, which will be of type of your selected Translator.

    If T is an interface, it will be implemented by the proxy class. In that case you should provide a factory(Function) which will be in charge of creating the actual instances of your service based on the Translator.