private static Object[] pathSpecToPathMatchPattern(PathSpec pathSpec) { List<String> pathComponents = pathSpec.getPathComponents(); Object[] results = new Object[pathComponents.size()]; int i = 0; for (String pathComponent : pathComponents) { if (pathComponent == PathSpec.WILDCARD) { results[i++] = Wildcard.ANY_ONE; } else { results[i++] = pathComponent; } } return results; }
@Override public String toString() { StringBuilder rep = new StringBuilder(); for (String s: getPathComponents()) { rep.append(SEPARATOR); rep.append(s); } boolean beforeAttributes = true; if (!_attributes.isEmpty()) { for (Map.Entry<String, Object> attribute: _attributes.entrySet()) { rep.append(beforeAttributes ? PATH_ATTR_SEPARATOR : ATTR_SEPARATOR); rep.append(attribute.getKey()); rep.append(ATTR_KEY_VALUE_SEPARATOR); rep.append(attribute.getValue()); beforeAttributes = false; } } return rep.toString(); }
final List<String> components = p.getPathComponents(); DataMap currentMap = filteredPathSpecs; boolean isPresent = true;
PathSpec subpath = new PathSpec(path.getPathComponents(), segment); Object value = entry.getValue(); if (value instanceof Integer)
/** * Adds the operation op to the key path. * * @param path the path to a field in the object * @param op the operation to apply to the path */ public void addOperation(PathSpec path, PatchOperation op) { List<String> segments = path.getPathComponents(); DataMap map = _representation; for (int ii = 0; ii<segments.size() - 1; ++ii) { String segment = Escaper.escapePathSegment(segments.get(ii)); Object o = map.get(segment); if (o == null) { DataMap childMap = new DataMap(); map.put(segment, childMap); map = childMap; } else { map = (DataMap)o; } } String lastSegment = Escaper.escapePathSegment(segments.get(segments.size()-1)); op.store(map, lastSegment); }
final List<String> components = p.getPathComponents(); DataMap currentMap = pathSpecMap;
List<String> segments = path.getPathComponents(); Map<String, Object> attributes = path.getPathAttributes();