+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package oic.simulator.clientcontroller.utils;
import java.util.Map;
import org.oic.simulator.AttributeValue;
import org.oic.simulator.AttributeValueVisitor;
-import org.oic.simulator.SimulatorResourceAttribute;
import org.oic.simulator.SimulatorResourceModel;
public class AttributeValueStringConverter implements
@Override
public String visitingValue(String value) {
- return new String(value);
+ return value;
}
@Override
StringBuilder result = new StringBuilder();
result.append("{");
boolean first = true;
- for (Map.Entry<String, SimulatorResourceAttribute> entry : value
- .getAttributes().entrySet()) {
+ for (Map.Entry<String, AttributeValue> entry : value.get().entrySet()) {
if (!first)
result.append(", ");
first = false;
result.append("\"" + entry.getKey() + "\":");
- AttributeValue attributeValue = entry.getValue().value();
+ AttributeValue attributeValue = entry.getValue();
result.append(new AttributeValueStringConverter(attributeValue)
.toString());
}