/** * Adds an argument for pvAccess RPC rpcservice. * * @param name argument name * @param description argument description * @param type the expected type of the argument * @return this */ public RPCServiceMethodDescription addArgument(String name, String fieldName, String description, Class<?> type) { super.addArgument(name, description, relaxArgumentType(type)); strictArguments.put(name, type); orderedParameterNames.put(name, fieldName != null ? fieldName : FIELD_NAME_EQUALS_NAME); return this; }
/** * Creates the service method description for the multiplication service * method. * * @return multiplication service method description */ public static ServiceMethodDescription multiplyMethod() { return new ServiceMethodDescription("multiply", "Multiplies two numbers.") { @Override public ServiceMethod createServiceMethod(ServiceDescription serviceDescription) { return new MultiplyServiceMethod(this, serviceDescription); } }.addArgument("arg1", "First argument", VNumber.class) .addArgument("arg2", "Second argument", VNumber.class) .addResult("result", "The product of arg1 and arg2", VNumber.class); }
/** * Creates the service method description for the addition service method. * * @return addition service method description */ private static ServiceMethodDescription addMethod() { return new ServiceMethodDescription("add", "Adds two numbers.") { @Override public ServiceMethod createServiceMethod(ServiceDescription serviceDescription) { return new AddServiceMethod(this, serviceDescription); } }.addArgument("arg1", "First argument", VNumber.class) .addArgument("arg2", "Second argument", VNumber.class) .addResult("result", "The sum of arg1 and arg2", VNumber.class); }