Search in sources :

Example 1 with LinkedHashMapEx

use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.

the class Edge method getProperties.

@Override
public MapEx getProperties() {
    if (this.graph == null) {
        return MapEx.EMPTY;
    } else {
        final Map<Integer, MapEx> propertiesById = this.graph.getEdgePropertiesById();
        MapEx properties = propertiesById.get(this.id);
        if (properties == null) {
            properties = new LinkedHashMapEx();
            propertiesById.put(this.id, properties);
        }
        return properties;
    }
}
Also used : MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 2 with LinkedHashMapEx

use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.

the class JdbcUtils method readMap.

public static MapEx readMap(final ResultSet rs) throws SQLException {
    final MapEx values = new LinkedHashMapEx();
    final ResultSetMetaData metaData = rs.getMetaData();
    for (int i = 1; i <= metaData.getColumnCount(); i++) {
        final String name = metaData.getColumnName(i);
        final Object value = rs.getObject(i);
        values.put(name, value);
    }
    return values;
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 3 with LinkedHashMapEx

use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.

the class MapSerializer method toMapValue.

@SuppressWarnings("rawtypes")
default Object toMapValue(final Object value) {
    if (value == null) {
        return null;
    } else {
        if (value instanceof MapSerializer) {
            final MapSerializer mapSerializer = (MapSerializer) value;
            final Map<String, Object> mapObject = mapSerializer.toMap();
            if (mapObject == null || mapObject.isEmpty()) {
                return null;
            }
            return mapObject;
        } else if (value instanceof Map) {
            final Map<String, Object> mapObject = (Map<String, Object>) value;
            if (mapObject.isEmpty()) {
                return null;
            }
            final MapEx map = new LinkedHashMapEx();
            for (final Entry<String, Object> entry : mapObject.entrySet()) {
                final CharSequence name = entry.getKey();
                final Object object = entry.getValue();
                addToMap(map, name, object);
            }
            return map;
        } else if (value instanceof Collection) {
            final Collection collectionObject = (Collection) value;
            if (collectionObject.isEmpty()) {
                return null;
            }
            final List<Object> list = new ArrayList<>();
            for (final Object object : collectionObject) {
                final Object listValue = toMapValue(object);
                list.add(listValue);
            }
            return list;
        } else if (value instanceof Boolean) {
            return value;
        } else if (value instanceof Number) {
            return value;
        } else if (value instanceof String) {
            final String string = (String) value;
            if (Property.hasValue(string)) {
                return string.trim();
            } else {
                return null;
            }
        } else if (value.getClass().isArray()) {
            return Lists.arrayToList(value);
        } else if (value instanceof Component) {
            return null;
        } else {
            final String string = DataTypes.toString(value);
            if (Property.hasValue(string)) {
                return string.trim();
            } else {
                return null;
            }
        }
    }
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) Collection(java.util.Collection) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) Component(java.awt.Component) Map(java.util.Map)

Example 4 with LinkedHashMapEx

use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.

the class InvokeConstructorMapObjectFactory method toMap.

@Override
public MapEx toMap() {
    final MapEx map = new LinkedHashMapEx();
    map.put("typeName", getTypeName());
    map.put("description", getDescription());
    map.put("typeClass", this.typeClass);
    return map;
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 5 with LinkedHashMapEx

use of com.revolsys.collection.map.LinkedHashMapEx in project com.revolsys.open by revolsys.

the class InvokeMethodMapObjectFactory method toMap.

@Override
public MapEx toMap() {
    final MapEx map = new LinkedHashMapEx();
    map.put("typeName", getTypeName());
    map.put("description", getDescription());
    map.put("typeClass", this.typeClass);
    map.put("methodName", this.methodName);
    return map;
}
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