我是靠谱客的博主 俊逸皮皮虾,最近开发中收集的这篇文章主要介绍java node 获取属性,类'java.util.HashMap $ Node'没有可写的属性'key',觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

How to solve this issue:

I want to Change key of my bean map with celledit feature from primefaces.

For editing the value of map it works well.

For changing the key i get following error:

javax.el.PropertyNotWritableException: The class 'java.util.HashMap$Node' does not have a writable property 'key'.

editable="true" editMode="cell" >

update=":form:msgs" />

解决方案

The reason that you get an error is that the keys in an entrySet are immutable. The entrySet() method returns a Set. If you look at the javadocs for Map.Entry you will see:

a V getValue() method,

a void setValue(V) method,

a K getKey() method, but

no void setKey(K) method

Basically, the key property is read-only per the JavaBeans convention. That's actually a good thing, because if you could modify a key in an Set you would have the difficult problem of what to do if the new key was the same as the key of another entry in the original map.

最后

以上就是俊逸皮皮虾为你收集整理的java node 获取属性,类'java.util.HashMap $ Node'没有可写的属性'key'的全部内容,希望文章能够帮你解决java node 获取属性,类'java.util.HashMap $ Node'没有可写的属性'key'所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(68)

评论列表共有 0 条评论

立即
投稿
返回
顶部