@Override public ValueNode rawValueNode(RawValue value) { return new POJONode(value); }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ @Override public ValueNode pojoNode(Object pojo) { return new POJONode(pojo); }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ @Override public ValueNode pojoNode(Object pojo) { return new POJONode(pojo); }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ public POJONode POJONode(Object pojo) { return new POJONode(pojo); } }
@Override public ValueNode rawValueNode(RawValue value) { return new POJONode(value); }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ @Override public ValueNode pojoNode(Object pojo) { return new POJONode(pojo); }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ @Override public ValueNode pojoNode(Object pojo) { return new POJONode(pojo); }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ public POJONode POJONode(Object pojo) { return new POJONode(pojo); } }
/** * Factory method for constructing a wrapper for POJO * ("Plain Old Java Object") objects; these will get serialized * using data binding, usually as JSON Objects, but in some * cases as JSON Strings or other node types. */ @Override public ValueNode pojoNode(Object pojo) { return new POJONode(pojo); }
@Override public ValueNode rawValueNode(RawValue value) { return new POJONode(value); }
/** * @deprecated Since 2.3 Use {@link #pojoNode} instead. */ @Deprecated public POJONode POJONode(Object pojo) { return new POJONode(pojo); }
/** * @deprecated Since 2.3 Use {@link #pojoNode} instead. */ @Deprecated public POJONode POJONode(Object pojo) { return new POJONode(pojo); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // Check that it's a JSON-RPC method MethodMetadata methodMetadata = classMetadata.getMethods().get(method); if (methodMetadata == null) { throw new IllegalStateException("Method '" + method.getName() + "' is not JSON-RPC available"); } // Get method name (annotation or the actual name), params and id generator String methodName = methodMetadata.getName(); JsonNode params = getParams(methodMetadata, args, getParamsType(classMetadata, methodMetadata)); IdGenerator<?> idGenerator = userIdGenerator != null ? userIdGenerator : classMetadata.getIdGenerator(); // Construct a request ValueNode id = new POJONode(idGenerator.generate()); String textResponse = execute(request(id, methodName, params)); // Parse a response JsonNode responseNode = mapper.readTree(textResponse); JsonNode result = responseNode.get(RESULT); JsonNode error = responseNode.get(ERROR); if (result != null) { JavaType returnType = mapper.getTypeFactory().constructType(method.getGenericReturnType()); if (returnType.getRawClass() == void.class) { return null; } return mapper.convertValue(result, returnType); } else { ErrorMessage errorMessage = mapper.treeToValue(error, ErrorMessage.class); throw new JsonRpcException(errorMessage); } }