001
014
015 package com.liferay.portal.json;
016
017 import com.liferay.portal.kernel.json.JSONArray;
018 import com.liferay.portal.kernel.json.JSONObject;
019 import com.liferay.portal.kernel.log.Log;
020 import com.liferay.portal.kernel.log.LogFactoryUtil;
021
022 import java.util.Collections;
023 import java.util.Date;
024 import java.util.Iterator;
025 import java.util.List;
026
027
030 public class UnmodifiableJSONObjectImpl extends JSONObjectImpl {
031
032 @Override
033 public Iterator<String> keys() {
034 List<String> list = Collections.emptyList();
035
036 return list.iterator();
037 }
038
039 @Override
040 public JSONObject put(String key, boolean value) {
041 if (_log.isWarnEnabled()) {
042 _log.warn("Modifications are unsupported");
043 }
044
045 return this;
046 }
047
048 @Override
049 public JSONObject put(String key, Date value) {
050 if (_log.isWarnEnabled()) {
051 _log.warn("Modifications are unsupported");
052 }
053
054 return this;
055 }
056
057 @Override
058 public JSONObject put(String key, double value) {
059 if (_log.isWarnEnabled()) {
060 _log.warn("Modifications are unsupported");
061 }
062
063 return this;
064 }
065
066 @Override
067 public JSONObject put(String key, int value) {
068 if (_log.isWarnEnabled()) {
069 _log.warn("Modifications are unsupported");
070 }
071
072 return this;
073 }
074
075 @Override
076 public JSONObject put(String key, JSONArray value) {
077 if (_log.isWarnEnabled()) {
078 _log.warn("Modifications are unsupported");
079 }
080
081 return this;
082 }
083
084 @Override
085 public JSONObject put(String key, JSONObject value) {
086 if (_log.isWarnEnabled()) {
087 _log.warn("Modifications are unsupported");
088 }
089
090 return this;
091 }
092
093 @Override
094 public JSONObject put(String key, long value) {
095 if (_log.isWarnEnabled()) {
096 _log.warn("Modifications are unsupported");
097 }
098
099 return this;
100 }
101
102 @Override
103 public JSONObject put(String key, String value) {
104 if (_log.isWarnEnabled()) {
105 _log.warn("Modifications are unsupported");
106 }
107
108 return this;
109 }
110
111 @Override
112 public JSONObject putException(Exception exception) {
113 if (_log.isWarnEnabled()) {
114 _log.warn("Modifications are unsupported");
115 }
116
117 return this;
118 }
119
120 @Override
121 public Object remove(String key) {
122 if (_log.isWarnEnabled()) {
123 _log.warn("Modifications are unsupported");
124 }
125
126 return null;
127 }
128
129 private static Log _log = LogFactoryUtil.getLog(
130 UnmodifiableJSONObjectImpl.class);
131
132 }