Git Product home page Git Product logo

Comments (4)

xychen5 avatar xychen5 commented on June 23, 2024 1

@sjtuzbk 请问能让我试试吗?

from higress.

johnlanni avatar johnlanni commented on June 23, 2024

@sjtuzbk 帮忙看看

from higress.

sjtuzbk avatar sjtuzbk commented on June 23, 2024

是的,目前只支持List里存放一些基础的类型,对于object可以研究下尝试通过递归来实现。已将此issue置为help wanted,感兴趣的话可以认领

from higress.

xychen5 avatar xychen5 commented on June 23, 2024
MyResponse getPosition(Position pos);

public class Position implements Serializable {

    public String name;
    
    public Long age;

    public Integer weight;

    public Float height;

    private Date born;

    private List<TagsModel> innerTags;

    private Map<String, TagsModel> innerMap;

    private TagsModel outerTag;

    private List<String> funs;
}

# 服务端日志
# getPosition get pos = Position(name=jim, age=7, weight=60, height=187.0, born=Mon Jan 01 19:00:29 CST 2024, innerTags=[null, null], innerMap={a=TagsModel{id=1, name='null', postId=null, addBy='ssss'}, b=TagsModel{id=3, name='null', postId=null, addBy='bbbb'}}, outerTag=TagsModel{id=10, name='ffff', postId=null, addBy='null'}, funs=[a, b, c])

定义上面的dubbo接口,解析字段中List 解析出来为[null, null],Map解析出来为nnerMap={a=TagsModel{id=1, name='null', postId=null, addBy='ssss'},看起来List应该还不支持结构体类型的元素 从代码来看也能应证

void DubboUtility::createUntypedListObjcet(const json& object,
                                           Hessian2::Object::UntypedList& untyped_list) {
  auto type = object.type();
  switch (type) {
  case json::value_t::string:
    untyped_list.emplace_back(std::make_unique<Hessian2::StringObject>(object.get<std::string>()));
    break;
  case json::value_t::number_unsigned:
  case json::value_t::number_integer:
    untyped_list.emplace_back(std::make_unique<Hessian2::IntegerObject>(object.get<int64_t>()));
    break;
  case json::value_t::number_float:
    untyped_list.emplace_back(std::make_unique<Hessian2::DoubleObject>(object.get<double>()));
    break;
  case json::value_t::boolean:
    untyped_list.emplace_back(std::make_unique<Hessian2::BooleanObject>(object.get<bool>()));
    break;
  case json::value_t::binary:
    untyped_list.emplace_back(std::make_unique<Hessian2::BinaryObject>(object.get_binary()));
    break;
  case json::value_t::null:
  default:
    untyped_list.emplace_back(std::make_unique<Hessian2::NullObject>());
    break;
  }
}

请问可否提供一个简单的demo?@lionelStuart

from higress.

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.