## 接口的使用
org.redkale.service.Service

- 使用Service的程序包
  程序包 | 说明
  --- | ---
  org.redkale.boot | 提供Redkale服务器的启动、初始化和加载功能
  org.redkale.net.http | HTTP协议包,提供HTTP协议服务器
  org.redkale.net.sncp | SNCP协议包,提供SNCP协议服务器
  org.redkale.service | Service接口和模式配置包

- - ### org.redkale.boot中Service的使用

    类型参数类型为Service的org.redkale.boot中的类
    限定符和类型 | 类和说明
    --- | ---
    `static class` | `NodeInterceptor.InterceptorServiceWrapper<T extends Service>`

    类型参数类型为Service的org.redkale.boot中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static <T extends Service> T` | Application.`singleton(java.lang.Class<T> serviceClass)`
    `static <T extends Service> T` | Application.`singleton(java.lang.String name, java.lang.Class<T> serviceClass)`

    返回变量类型为Service的类型的org.redkale.boot中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected ClassFilter<Service>` | NodeServer.`createServiceClassFilter()`

  - ### org.redkale.net.http中Service的使用

    类型参数类型为Service的org.redkale.net.http中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `<S extends Service,T extends RestHttpServlet> RestHttpServlet` | HttpServer.`addRestServlet(java.lang.String name, java.lang.Class<S> serviceType, S service, java.lang.Class<T> baseServletClass, java.lang.String prefix)`
    `<S extends Service,T extends RestHttpServlet> RestHttpServlet` | HttpServer.`addRestServlet(java.lang.String name, java.lang.Class<S> serviceType, S service, java.lang.Class<T> baseServletClass, java.lang.String prefix, AnyValue conf)`

  - ### org.redkale.net.sncp中Service的使用

    类型参数类型为Service的org.redkale.net.sncp中的类
    限定符和类型 | 类和说明
    --- | ---
    `class` | `ServiceWrapper<T extends Service>` Service对象的封装类 详情见: https://redkale.org

    类型参数类型为Service的org.redkale.net.sncp中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `<T extends Service> void` | SncpServer.`addSncpServlet(java.lang.Class<T> serviceType, java.lang.String name, T service, AnyValue conf)`
    `static <T extends Service> T` | Sncp.`createLocalService(java.lang.String name, java.util.function.Consumer<java.lang.Runnable> executor, ResourceFactory resourceFactory, java.lang.Class<T> serviceClass, java.net.InetSocketAddress clientAddress, Transport sameGroupTransport, java.util.Collection<Transport> diffGroupTransports)` 创建本地模式Service实例
    `protected static <T extends Service> java.lang.Class<? extends T>` | Sncp.`createLocalServiceClass(java.lang.String name, java.lang.Class<T> serviceClass)` public class TestService implements Service{ public String findSomeThing(){ return "hello"; } @RpcMultiRun(selfrun = false) public void createSomeThing(TestBean bean){ //do something } @RpcMultiRun public String updateSomeThing(String id){ return "hello" + id; } } @Resource(name = "") @SncpDyn(remote = false) @ResourceType({TestService.class}) public final class _DynLocalTestService extends TestService{ @Resource private BsonConvert _redkale_bsonConvert; @Resource private JsonConvert _redkale_jsonConvert; private Transport _redkale_sameGroupTransport; private Transport[] _redkale_diffGroupTransports; private SncpClient _redkale_client; private String _redkale_selfstring; @Override public String toString() { return _redkale_selfstring == null ?
    `static <T extends Service> T` | Sncp.`createRemoteService(java.lang.String name, java.util.function.Consumer<java.lang.Runnable> executor, java.lang.Class<T> serviceClass, java.net.InetSocketAddress clientAddress, Transport transport)` @Resource(name = "") @SncpDyn(remote = true) @ResourceType({TestService.class}) public final class _DynRemoteTestService extends TestService{ @Resource private BsonConvert _redkale_bsonConvert; @Resource private JsonConvert _redkale_jsonConvert; private Transport _redkale_transport; private SncpClient _redkale_client; private String _redkale_selfstring; @Override public String toString() { return _redkale_selfstring == null ?

    返回Service的org.redkale.net.sncp中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `Service` | ServiceWrapper.`getService()`

    参数类型为Service的org.redkale.net.sncp中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static SncpDynServlet.SncpServletAction` | SncpDynServlet.SncpServletAction.`create(Service service, DLong actionid, java.lang.reflect.Method method)` public class TestService implements Service { public boolean change(TestBean bean, String name, int id) { } } public class DynActionTestService_change extends SncpServletAction { public TestService service; @Override public void action(final BsonReader in, final BsonWriter out) throws Throwable { TestBean arg1 = convert.convertFrom(paramTypes[1], in); String arg2 = convert.convertFrom(paramTypes[2], in); int arg3 = convert.convertFrom(paramTypes[3], in); Object rs = service.change(arg1, arg2, arg3); _callParameter(out, arg1, arg2, arg3); convert.convertTo(out, paramTypes[0], rs); } }
    `static Transport[]` | Sncp.`getDiffGroupTransports(Service service)`
    `static Transport` | Sncp.`getSameGroupTransport(Service service)`
    `static SncpClient` | Sncp.`getSncpClient(Service service)`
    `static boolean` | Sncp.`isRemote(Service service)`

    类型变量类型为Service的org.redkale.net.sncp中的方法参数
    限定符和类型 | 方法和说明
    --- | ---
    `static java.lang.Class[]` | ServiceWrapper.`parseTypes(java.lang.Class<? extends Service> servicetype)`

    参数类型为Service的org.redkale.net.sncp中的构造器
    构造器和说明
    `SncpDynServlet(BsonConvert convert, java.lang.String serviceName, java.lang.Class<? extends Service> type, Service service)`

    类型变量类型为Service的org.redkale.net.sncp中的构造器参数
    构造器和说明
    `SncpDynServlet(BsonConvert convert, java.lang.String serviceName, java.lang.Class<? extends Service> type, Service service)`

  - ### org.redkale.service中Service的使用

    实现Service的org.redkale.service中的类
    限定符和类型 | 类和说明
    --- | ---
    `class` | `CacheSourceService<K extends java.io.Serializable,V>`
    `class` | `DataCacheListenerService` 详情见: https://redkale.org
    `class` | `DataSourceService` DataSource对应的Service类， 该类主要特点是将所有含FilterBean参数的方法重载成FilterNode对应的方法。
    `class` | `WebSocketNodeService` 详情见: https://redkale.org