public Reference(StringMap params) { super(); this.type = params.get(TYPE); this.key = params.get(KEY); this.label = ""; full = params; }
public void addTierUtilizationPercentage(Map<String, String> tierUtilizationPercentage) { if (null == _tierUtilizationPercentage) { setTierUtilizationPercentage(new StringMap()); } else { _tierUtilizationPercentage.clear(); } if (tierUtilizationPercentage.size() > 0) { _tierUtilizationPercentage.putAll(tierUtilizationPercentage); } }
public StringMap getFull() { if (full == null) { full = new StringMap(); } full.put(TYPE, this.type); full.put(KEY, this.key); full.put(LABEL, this.label); return full; }
private boolean validKeys(Set<String> keys) { for (String key : keys) { if (key == null) { return false; } if (key.length() < map.minKey() || key.length() > map.maxKey()) { return false; } } return true; }
private boolean validValues(Collection<String> values) { for (String value : values) { if (value == null) { return false; } if (value.length() < map.minValue() || value.length() > map.maxValue()) { return false; } } return true; }
public String getQuery() { StringBuffer ref = new StringBuffer(); ref.append(KEY).append("=").append(key); if (full != null) { for (String k : full.keySet()) { ref.append("&").append(k).append("=").append(full.get(k)); } } if (!type.equals(CALL)) { ref.append("&").append(TYPE).append("=").append(type); } return ref.toString(); }
/** * Removes each mapping from the reservedCapacityMap * * @param objectIdStrings - list of Volume/BlockObject ids */ public void removeReservedCapacityForVolumes(Collection<String> objectIdStrings) { if (objectIdStrings != null && _reservedCapacityMap != null) { for (String idString : objectIdStrings) { _reservedCapacityMap.remove(idString); } } }
public void updateContext(DrawContext ctx) { Coloring c = (Coloring) stringMap.get(ctx.getBuffer(), ctx.getTokenOffset(), ctx.getTokenLength()); if (c != null) { c.apply(ctx); } }
public void addControllerParams(Map<String, String> controllerParams) { if (controllerParams == null) { return; } setControllerParams(new StringMap()); _controllerParams.putAll(controllerParams); }
/** Adds the ExportMap's exportKey and exportData as a key,value pair to this Map */ public void set(ExportMap map) { if (map == null) { throw new IllegalArgumentException("invalid (null) map"); } exportData.set(map.getExportKey(), map.getExportData()); }
@Override public boolean isValid( final Map<String, String> value, final ConstraintValidatorContext context) { if (!map.required() && value == null) { return true; } boolean valid = value != null && validKeys(value.keySet()) && validValues(value.values()); if (!valid) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(map.message()).addConstraintViolation(); } return valid; }
public Reference addItem(String k, String v) { if (full == null) { full = new StringMap(); } full.put(k, v); return this; }
/** * Adds the given key,value pair to this Map * * @param key * @param value */ public void set(String key, String value) { if (key == null) { throw new IllegalArgumentException("invalid (null) key"); } if (value == null) { throw new IllegalArgumentException("invalid (null) value - key=" + key); } exportData.set(key, value); }
/** * Helper method to get total reserved capacity of the pool. * * @return reserved capacity in KBytes */ private Long calculateReservedCapacity() { Long reservedCapacity = 0L; if (_reservedCapacityMap != null) { Collection<String> capacityCollection = _reservedCapacityMap.values(); for (String capacity : capacityCollection) { reservedCapacity = reservedCapacity + Long.valueOf(capacity); } } Long reservedCapacityKB = (reservedCapacity % KB == 0) ? reservedCapacity / KB : reservedCapacity / KB + 1; return reservedCapacityKB; // in KB }
public void put(String s, Coloring c) { stringMap.put(s, c); }
public Map<String, String> queryHostIPAddressesMap() { if (!hostIPv4AddressMap.isEmpty()) return hostIPv4AddressMap; return hostIPv6AddressMap; }
public String queryLoopBackAddress() { if (!hostIPv4AddressMap.isEmpty()) return "127.0.0.1"; return "[::1]"; }