We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
null
get/is/hashCode...
所有输出都为 bob
public static void main(String[] args) throws Exception { User user = new User("bob"); JSONObject userJsonObject = JSONObject.from(user, JSONWriter.Feature.IgnoreNonFieldGetter); String userJsonString = JSONObject.toJSONString(user); // ... // transport via http/redis/file // ... // Normal interface method call LivingObject normal = new User("bob"); log.info(normal.getSignature().toString()); // -> "bob" log.info(normal.getSignatureString()); // -> "bob" log.info(normal.withSignatureString()); // -> "bob" // Normal deserialize LivingObject deserializeLiving = userJsonObject.to(LivingObject.class); log.info(deserializeLiving.getSignature().toString()); // -> "bob" log.info(deserializeLiving.getSignatureString()); // -> "bob" log.info(deserializeLiving.withSignatureString()); // -> This method 'withSignatureString' is not a getter // Unknown instance type LivingObject living = JSONObject.parseObject(userJsonString, LivingObject.class); log.info(living.getSignature().toString()); // -> "null" log.info(living.getSignatureString()); // -> "bob" log.info(living.withSignatureString()); // -> This method 'withSignatureString' is not a getter } public static interface LivingObject { String getName(); String withName(); public default Signature getSignature() { return new Signature(getName()); } public default String getSignatureString() { return new Signature(getName()).toString(); } public default String withSignatureString() { return withName(); } } public static class Signature { private String sign; public Signature(String sign) { this.sign = sign; } @Override public String toString() { return sign; } } public static class User implements LivingObject { private String name; public User(String name) { this.name = name; } public String getName() { return name; } public String withName() { return name; } }
The text was updated successfully, but these errors were encountered:
improve proxy support, for issue #1396
64450df
https://github.com/alibaba/fastjson2/releases/tag/2.0.29 请用新版本
Sorry, something went wrong.
No branches or pull requests
请描述您的问题
null
?get/is/hashCode...
则提示 This method 'xxx' is not a getter?期望
所有输出都为 bob
示例代码
The text was updated successfully, but these errors were encountered: