Giter Site home page Giter Site logo

Comments (10)

danielsawan avatar danielsawan commented on July 20, 2024

With SnackSerializer it seems to work but i have a problem when both method in interface have the same name. Then i get a "java.lang.IllegalArgumentException: argument type mismatch" because i guess he is calling the first method with a list instead of calling the second method.

example

@Mapping(value = "/helloService", method = MethodType.SOCKET)
@Remoting
public class HelloServiceImpl implements HelloService {

	public String hello(String name) {
		return "hello " + name;
	}

	public String hello(List<User> users) {
		return "" + users.size();
	}
}

from solon.

noear avatar noear commented on July 20, 2024

因为资料不全,给你带来不便,非常抱歉。

from solon.

noear avatar noear commented on July 20, 2024

需要把:
solon.serialization.jackson
nami.coder.jackson

换成:
solon.serialization.snack3
nami.coder.snack3

//jackson 目前适配得还不是很好

from solon.

noear avatar noear commented on July 20, 2024

或者换成:
solon.serialization.fastjson
nami.coder.fastjson

//目前 jackson 的编码适配,只适用于非泛型的 //我个人对它不是很熟,所以适配差了点儿

from solon.

noear avatar noear commented on July 20, 2024

支持序列化方案

通道 说明
Form 表单模式
Json 适配有:snack3、fastjson (推荐)
Hessian 通道 适配有:hessian (推荐)
Protostuff 通道 适配有:protostuff

from solon.

noear avatar noear commented on July 20, 2024
//使用Nami构建,指定编码器
HelloService rpc = Nami.builder().url("tcp://localhost:28080/demoe/rpc")
                                   .encoder(SnackTypeEncoder.instance)
                                   .create(HelloService.class);

具体看下官网的优化过的文章:http://solon.noear.org/article/67

from solon.

danielsawan avatar danielsawan commented on July 20, 2024

杰克逊允许通过以下代码将jsonArray绑定到列表中

ObjectMapper mapper = new ObjectMapper()
List<Person> personList = mapper.readValue(jsonString, new TypeReference<List<Person>>() {});

如果我理解,我不应该使用jackson,而应该使用Snack3,对吗?但是我需要在我的项目中忽略一些字段。在Snack3中是否有与@JsonIgnore相当的东西?

谢谢你的帮助 !

from solon.

noear avatar noear commented on July 20, 2024

Snack3 有两种方式可以控制相同效果:

  1. @ONodeAttr 注解
  2. transient 关键字

from solon.

noear avatar noear commented on July 20, 2024
List<Person> personList = mapper.readValue(jsonString, new TypeReference<List<Person>>() {});

//这种特性snack3也支持的
List<Person> personList = ONode.deserialize(jsonString, (new ArrayList<Person>(){}).getClass());
//或者
List<Person> personList = ONode.deserialize(jsonString, new TypeRef<List<Person>>(){}.getType());

from solon.

danielsawan avatar danielsawan commented on July 20, 2024

Thank you very much !

from solon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.