Search in sources :

Example 26 with LinkedHashMapEx

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;
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 27 with LinkedHashMapEx

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;
    }
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 28 with LinkedHashMapEx

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;
    }
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 29 with LinkedHashMapEx

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;
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 30 with LinkedHashMapEx

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());
    }
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Aggregations

LinkedHashMapEx (com.revolsys.collection.map.LinkedHashMapEx)39 MapEx (com.revolsys.collection.map.MapEx)38 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)3 Map (java.util.Map)3 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 UrlResource (com.revolsys.spring.resource.UrlResource)2 Component (java.awt.Component)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 PropertyChangeArrayList (com.revolsys.collection.PropertyChangeArrayList)1 MapSerializerMap (com.revolsys.collection.map.MapSerializerMap)1 LasPoint (com.revolsys.elevation.cloud.las.pointformat.LasPoint)1 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)1 ClockDirection (com.revolsys.geometry.model.ClockDirection)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 PathName (com.revolsys.io.PathName)1 Resource (com.revolsys.spring.resource.Resource)1 ValueField (com.revolsys.swing.component.ValueField)1 PasswordField (com.revolsys.swing.field.PasswordField)1