- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
假设对象的确切类是已知的,将任意对象与其字符串表示形式相互转换的普遍接受的方法是什么?也就是说,我需要实现一些类似于下面的方法:
public interface Converter {
/**
* Convert this object to its String representation.
*/
public String asString(Object obj);
/**
* Take the String representation of an object produced by asString,
* and convert it back to an object of the appropriate class.
*/
public Object asObject(String stringRepresentation, Class clazz);
}
理想情况下,解决方案应该:
我知道有很多现成的解决方案可以做到这一点(例如 Google 的 Protocol Buffer ),而且我自己可以轻松实现一次性解决方案。我的问题不是“我如何解决这个问题”,而是“众多现成的解决方案中哪一个是当前的行业标准?”。
最佳答案
My question is not, "how do I solve this problem", but rather, "which one of the many ready-made solutions is the current industry standard ?".
它们都没有成为事实上的标准。
最接近的“默认”XML serialization mechanism顺便说一句,如果你假装手写它们就很糟糕(当你自动使用它们时它就足够了)
下一个最接近标准的东西是日常使用的 JSON 到 Java,但是,你知道,它不是 Java Java
关于java - 在 Java 中将对象与字符串相互转换的公认做法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1678305/
如果您想分享更多信息,可以在这里找到整个资源 指针: https://github.com/sergiotapia/DreamInCode.Net 基本上,我的API将为其他开发人员提供
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
我不是 SCM 工具的经验丰富的用户,尽管我确信它们的用处,当然。 我在以前的工作中使用了一些不起眼的商业工具,在当前的工作中使用了 Perforce,并在我的小型个人项目中使用了 TortoiseS
所以我想知道一些我应该避免在 javascript 中做的事情以获得良好的 SEO 排名。在我的下一个站点中,我将广泛使用 jquery 和 javascript,但不想牺牲 SEO。那么您认为我应该
基本上,我想知道什么是避免 future CSS 代码出现问题和混淆的最佳方法... 像这样命名 CSS 属性: div#content ul#navigation div.float-left (真
我是一名优秀的程序员,十分优秀!