aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/MiscFormatter.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-15 11:51:45 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-15 11:51:45 +1200
commit5cf1061cfcc5baf214bce145961512fd4f672621 (patch)
tree32efac22ba11abddec21656685c3e0ba730b1e47 /src/org/traccar/model/MiscFormatter.java
parent34a70e81ecb613c3216fcdd581a9724216137b41 (diff)
downloadtraccar-server-5cf1061cfcc5baf214bce145961512fd4f672621.tar.gz
traccar-server-5cf1061cfcc5baf214bce145961512fd4f672621.tar.bz2
traccar-server-5cf1061cfcc5baf214bce145961512fd4f672621.zip
Rename other field to attributes
Diffstat (limited to 'src/org/traccar/model/MiscFormatter.java')
-rw-r--r--src/org/traccar/model/MiscFormatter.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/org/traccar/model/MiscFormatter.java b/src/org/traccar/model/MiscFormatter.java
index 7a1e69082..38aa853d4 100644
--- a/src/org/traccar/model/MiscFormatter.java
+++ b/src/org/traccar/model/MiscFormatter.java
@@ -44,12 +44,12 @@ public class MiscFormatter {
}
}
- public static String toXmlString(Map<String, Object> other) {
+ public static String toXmlString(Map<String, Object> attributes) {
StringBuilder result = new StringBuilder();
result.append("<").append(xmlRootNode).append(">");
- for (Map.Entry<String, Object> entry : other.entrySet()) {
+ for (Map.Entry<String, Object> entry : attributes.entrySet()) {
result.append("<").append(entry.getKey()).append(">");
result.append(format(entry.getValue()));
@@ -61,10 +61,10 @@ public class MiscFormatter {
return result.toString();
}
- public static JsonObject toJson(Map<String, Object> other) {
+ public static JsonObject toJson(Map<String, Object> attributes) {
JsonObjectBuilder json = Json.createObjectBuilder();
- for (Map.Entry<String, Object> entry : other.entrySet()) {
+ for (Map.Entry<String, Object> entry : attributes.entrySet()) {
if (entry.getValue() instanceof String) {
json.add(entry.getKey(), (String) entry.getValue());
} else if (entry.getValue() instanceof Integer) {
@@ -87,35 +87,35 @@ public class MiscFormatter {
public static Map<String, Object> fromJson(JsonObject json) {
- Map<String, Object> other = new LinkedHashMap<>();
+ Map<String, Object> attributes = new LinkedHashMap<>();
for (Map.Entry<String, JsonValue> entry : json.entrySet()) {
switch (entry.getValue().getValueType()) {
case STRING:
- other.put(entry.getKey(), ((JsonString) entry.getValue()).getString());
+ attributes.put(entry.getKey(), ((JsonString) entry.getValue()).getString());
break;
case NUMBER:
JsonNumber number = (JsonNumber) entry.getValue();
if (number.isIntegral()) {
- other.put(entry.getKey(), number.longValue());
+ attributes.put(entry.getKey(), number.longValue());
} else {
- other.put(entry.getKey(), number.doubleValue());
+ attributes.put(entry.getKey(), number.doubleValue());
}
break;
case TRUE:
- other.put(entry.getKey(), true);
+ attributes.put(entry.getKey(), true);
break;
case FALSE:
- other.put(entry.getKey(), false);
+ attributes.put(entry.getKey(), false);
break;
}
}
- return other;
+ return attributes;
}
- public static String toJsonString(Map<String, Object> other) {
- return toJson(other).toString();
+ public static String toJsonString(Map<String, Object> attributes) {
+ return toJson(attributes).toString();
}
}