public MJsonArray clone() {
MJsonArray tmpMJsonArray = null;
try {
- tmpMJsonArray = new MJsonArray(this.getFormattedValue());
+ tmpMJsonArray = new MJsonArray(this.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
/* Formatter */
- public String getFormattedValue() {
+ public String getJsonValue() {
StringBuilder s = new StringBuilder("");
s.append("[");
for (int i = 0; i < this.countValues(); i++) {
if (i > 0) {
s.append(", ");
}
- s.append(this.getValuesReference().get(i).getFormattedValue());
+ s.append(this.getValuesReference().get(i).getJsonValue());
}
s.append("]");
return s.toString();
/* */
- public MJsonBoolean(boolean x) throws MInvalidValueJsonException {
- this((new Boolean(x)).toString());
+ public MJsonBoolean() throws MInvalidValueJsonException {
+ this("false");
}
public MJsonBoolean(String x) throws MInvalidValueJsonException {
public MJsonBoolean clone() {
MJsonBoolean tmpMJsonBoolean = null;
try {
- tmpMJsonBoolean = new MJsonBoolean(this.getFormattedValue());
+ tmpMJsonBoolean = new MJsonBoolean(this.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
/* Formatter */
- public String getFormattedValue() {
+ public String getJsonValue() {
return this.getValue().toString();
}
public MJsonNull clone() {
MJsonNull tmpMJsonNull = null;
try {
- tmpMJsonNull = new MJsonNull(this.getFormattedValue());
+ tmpMJsonNull = new MJsonNull(this.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
return tmpMJsonNull;
}
- /* Value handler */
-
- public String getValue() {
- return "null";
- }
-
/* Parsers */
protected static int getTokenLength(String x) {
/* Formatter */
- public String getFormattedValue() {
- return this.getValue();
+ public String getJsonValue() {
+ return "null";
}
}
/* */
- public MJsonNumber(byte x) throws MInvalidValueJsonException {
- this((new Byte(x)).toString());
- }
-
- public MJsonNumber(double x) throws MInvalidValueJsonException {
- this((new Double(x)).toString());
- }
-
- public MJsonNumber(float x) throws MInvalidValueJsonException {
- this((new Float(x)).toString());
- }
-
- public MJsonNumber(int x) throws MInvalidValueJsonException {
- this((new Integer(x)).toString());
- }
-
- public MJsonNumber(long x) throws MInvalidValueJsonException {
- this((new Long(x)).toString());
- }
-
- public MJsonNumber(short x) throws MInvalidValueJsonException {
- this((new Short(x)).toString());
+ public MJsonNumber() throws MInvalidValueJsonException {
+ this("0");
}
public MJsonNumber(String x) throws MInvalidValueJsonException {
public MJsonNumber clone() {
MJsonNumber tmpMJsonNumber = null;
try {
- tmpMJsonNumber = new MJsonNumber(this.getFormattedValue());
+ tmpMJsonNumber = new MJsonNumber(this.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
/* Formatter */
- public String getFormattedValue() {
+ public String getJsonValue() {
return this.getValueReference().toString();
}
public MJsonObject clone() {
MJsonObject tmpMJsonObject = null;
try {
- tmpMJsonObject = new MJsonObject(this.getFormattedValue());
+ tmpMJsonObject = new MJsonObject(this.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
/* Formatter */
- public String getFormattedValue() {
+ public String getJsonValue() {
StringBuilder s = new StringBuilder("");
s.append("{");
int k = 0;
}
s.append("\"" + MJsonString.getEscapedString(key, false) + "\"");
s.append(": ");
- s.append(this.getValuesReference().get(key).getFormattedValue());
+ s.append(this.getValuesReference().get(key).getJsonValue());
k++;
}
s.append("}");
public MJsonString clone() {
MJsonString tmpMJsonString = null;
try {
- tmpMJsonString = new MJsonString(this.getFormattedValue());
+ tmpMJsonString = new MJsonString(this.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
/* Formatter */
- public String getFormattedValue() {
+ public String getJsonValue() {
return "\"" + MJsonString.getEscapedString(this.getValue(), this.getExtendedEscapeMode()) + "\"";
}
/* Formatter */
- public abstract String getFormattedValue();
+ public abstract String getJsonValue();
}
MJsonObject returnValue = null;
try {
returnValue = new MJsonObject();
- returnValue.setValue("errorMode", new MJsonNumber(MWebApplicationServlet.ErrorMode.CLEAN.ordinal()));
+ returnValue.setValue("errorMode", new MJsonNumber("" + MWebApplicationServlet.ErrorMode.CLEAN.ordinal()));
MJsonString jsonParameter = new MJsonString();
jsonParameter.setValue(new String(content, MInformation.TEXT_ENCODING));
returnValue.setValue("parameter", jsonParameter);
}
catch (MInvalidValueJsonException exception) { // cannot happen
}
- responseContent = returnValue.getFormattedValue().getBytes(MInformation.TEXT_ENCODING);
+ responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING);
}
else {
responseContent = content;
MJsonObject returnValue = null;
try {
returnValue = new MJsonObject();
- returnValue.setValue("errorMode", new MJsonNumber(errorMode.ordinal()));
+ returnValue.setValue("errorMode", new MJsonNumber("" + errorMode.ordinal()));
MJsonString jsonParameter = new MJsonString();
if (null != content.getMessage()) {
jsonParameter.setValue(content.getClass().getName() + ": " + content.getMessage());
}
catch (MInvalidValueJsonException exception) { // should not happen
}
- responseContent = returnValue.getFormattedValue().getBytes(MInformation.TEXT_ENCODING);
+ responseContent = returnValue.getJsonValue().getBytes(MInformation.TEXT_ENCODING);
}
else {
if (null != content.getMessage()) {
//
MWebBrowserPage browserPage = this.getViewReference().getBrowserPageReference();
String destinationUrl = this.getApplicationContextReference().getRequestReference().getRequestURL().toString();
- String parameters = "securityId=" + browserPage.getSecurityId() + "&message=" + downloadMessage.getFormattedValue();
+ String parameters = "securityId=" + browserPage.getSecurityId() + "&message=" + downloadMessage.getJsonValue();
//
this.getApplicationContextReference().addPlainTextResponseContent(String.format("$('m_downloader').src = '%s?%s';", destinationUrl, parameters));
}
public MWebMessage clone() {
try {
MJsonString tmpString = null;
- MJsonObject tmpMessage = new MJsonObject("{}");
+ MJsonObject tmpMessage = new MJsonObject();
//
- tmpString = new MJsonString("\"\"");
+ tmpString = new MJsonString();
tmpString.setValue(this.getWidgetId());
tmpMessage.setValue("widgetId", tmpString);
//
- tmpString = new MJsonString("\"\"");
+ tmpString = new MJsonString();
tmpString.setValue(this.getEvent());
tmpMessage.setValue("event", tmpString);
//
- MJsonObject tmpMessageParameters = new MJsonObject("{}");
+ MJsonObject tmpMessageParameters = new MJsonObject();
for (String parameterKey: this.getParametersReference().keySet()) {
- tmpString = new MJsonString("\"\"");
+ tmpString = new MJsonString();
tmpString.setValue(this.getParameters().get(parameterKey));
tmpMessageParameters.setValue(parameterKey, tmpString);
}
tmpMessage.setValue("parameters", tmpMessageParameters);
//
- return new MWebMessage(tmpMessage.getFormattedValue());
+ return new MWebMessage(tmpMessage.getJsonValue());
}
catch (MInvalidValueJsonException exception) { // cannot happen
return null; // necessary to avoid Java compilation errors