use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.
the class BaseLasPoint method toMap.
@Override
public MapEx toMap() {
final MapEx map = new LinkedHashMapEx();
addToMap(map, "x", getX());
addToMap(map, "y", getY());
addToMap(map, "z", getZ());
return map;
}
use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.
the class Node method getProperties.
@Override
public MapEx getProperties() {
if (this.graph == null) {
return MapEx.EMPTY;
} else {
final Map<Integer, MapEx> propertiesById = this.graph.getNodePropertiesById();
MapEx properties = propertiesById.get(this.id);
if (properties == null) {
properties = new LinkedHashMapEx();
propertiesById.put(this.id, properties);
}
return properties;
}
}
use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.
the class MapObjectFactory method toObject.
@SuppressWarnings("unchecked")
static <V> V toObject(final Map<String, ? extends Object> map) {
if (map == null) {
return null;
} else {
// final long startTime = System.currentTimeMillis();
final MapEx objectMap = new LinkedHashMapEx();
for (final Entry<String, ? extends Object> entry : map.entrySet()) {
final String key = entry.getKey();
Object value = entry.getValue();
value = objectToObject(value);
objectMap.put(key, value);
}
final String typeClass = getTypeClass(objectMap);
final V object;
if (Property.hasValue(typeClass)) {
final Constructor<V> configConstructor = JavaBeanUtil.getConstructor(typeClass, Map.class);
if (configConstructor == null) {
object = (V) JavaBeanUtil.createInstance(typeClass);
ObjectWithProperties.setProperties(object, objectMap);
} else {
object = JavaBeanUtil.invokeConstructor(configConstructor, objectMap);
}
} else {
final String type = getType(objectMap);
final MapObjectFactory objectFactory = MapObjectFactoryRegistry.getFactory(type);
if (objectFactory == null) {
object = (V) objectMap;
} else {
object = (V) objectFactory.mapToObject(objectMap);
}
}
// Dates.debugEllapsedTime(MapObjectFactory.class, map.toString(), startTime);
return object;
}
}
use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.
the class AbstractConnection method getConfig.
@Override
public MapEx getConfig() {
final MapEx config = new LinkedHashMapEx(this.config);
config.putAll(getProperties());
return config;
}
use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.
the class JsonParser method getMap.
public MapEx getMap() {
if (getEvent() == EventType.startObject || hasNext() && next() == EventType.startObject) {
EventType event = getEvent();
final MapEx map = new LinkedHashMapEx();
do {
if (hasNext() && next() == EventType.string) {
final String key = getStringIntern();
if (hasNext()) {
if (next() == EventType.colon) {
if (hasNext()) {
final Object value = getValue();
if (value instanceof EventType) {
throw new IllegalStateException("Exepecting a value, not: " + key + "=" + value);
}
if (key != null) {
map.put(key, value);
}
}
}
}
event = next();
} else {
event = getEvent();
}
} while (event == EventType.comma);
if (event != EventType.endObject) {
throw new IllegalStateException("Exepecting end object, not:" + event);
}
return map;
} else {
throw new IllegalStateException("Exepecting end object, not:" + getEvent());
}
}
Aggregations