use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class MultiStopLinearGradient method toMap.
@Override
public MapEx toMap() {
final MapEx map = newTypeMap("multiStopLinearGradient");
addToMap(map, "stops", this.stops);
return map;
}
use of com.revolsys.collection.map.MapEx 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;
}
}
use of com.revolsys.collection.map.MapEx 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;
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class MapSerializer method writeToFile.
default void writeToFile(final Object target) {
if (target != null) {
final MapEx map = toMap();
Json.writeMap(map, target, true);
}
}
use of com.revolsys.collection.map.MapEx 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;
}
}
}
}
Aggregations