package com.perforce.p4java_ext; import java.util.LinkedHashMap; import java.util.Map; /** * Wrapper around the output of the change command * <p> * This basically exposes a simple map-like interface, dealing with funky string * whitespace issues getting things in and out of the API. */ public class ChangeSpec { private Map<String, Object> changeMap; public ChangeSpec(Map<String, Object> changeMap) { this.changeMap = changeMap; } public Map<String, Object> getChangeMap() { return changeMap; } public void setChangeMap(Map<String, Object> changeMap) { this.changeMap = changeMap; } public Map<String, String> getAll() { Map<String, String> trimmed = new LinkedHashMap<String, String>(); for (String key : changeMap.keySet()) { if (!Character.isLowerCase(key.charAt(0))) { trimmed.put(key, get(key)); } } return trimmed; } public String get(String key) { return ((String) changeMap.get(key)).trim(); } public void put(String key, String value) { changeMap.put(key, value); } public String getStatus() { return get("Status"); } public void setStatus(String s) { put("Status", s); } public String getChange() { return get("Change"); } public String getDescription() { return get("Description"); } public void setDescription(String d) { put("Description", d); } /** * TODO remove this, we don't want to output "specs" like this * * @return */ public String toString() { StringBuilder sb = new StringBuilder(); SpecUtils.appendValues(getAll(), sb); return sb.toString(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 9086 | tjuricek |
0.1.0 Initial release of p4java_ext Mostly just contains enough of the P4 API to build the test data initializer. About 4 commands have minimal testing, so it works. Kind of. |
||
#1 | 9085 | tjuricek | First import of the project, before package refactoring. |