public static List<String> parseDelimitedString(String value, String delim) { return parseDelimitedString(value, delim, true); }
public static List<String> parseDelimitedString(String value, String delim) { return parseDelimitedString(value, delim, true); }
/** * Create a capability. * @param res The resource associated with the capability. * @param ns The namespace of the capability. * @param attrs The attributes of the capability. * @param dirs The directives of the capability. */ public CapabilityImpl(Resource res, String ns, Map<String, String> dirs, Map<String, Object> attrs) { super(res, ns, dirs, attrs); // Handle mandatory directive Set<String> mandatory = Collections.emptySet(); String value = this.directives.get(Constants.MANDATORY_DIRECTIVE); if (value != null) { List<String> names = ResourceBuilder.parseDelimitedString(value, ","); mandatory = new HashSet<>(names.size()); for (String name : names) { // If attribute exists, then record it as mandatory. if (this.attributes.containsKey(name)) { mandatory.add(name); // Otherwise, report an error. } else { throw new IllegalArgumentException("Mandatory attribute '" + name + "' does not exist."); } } } this.mandatory = mandatory; }
/** * Create a capability. * @param res The resource associated with the capability. * @param ns The namespace of the capability. * @param attrs The attributes of the capability. * @param dirs The directives of the capability. */ public CapabilityImpl(Resource res, String ns, Map<String, String> dirs, Map<String, Object> attrs) { super(res, ns, dirs, attrs); // Handle mandatory directive Set<String> mandatory = Collections.emptySet(); String value = this.directives.get(Constants.MANDATORY_DIRECTIVE); if (value != null) { List<String> names = ResourceBuilder.parseDelimitedString(value, ","); mandatory = new HashSet<>(names.size()); for (String name : names) { // If attribute exists, then record it as mandatory. if (this.attributes.containsKey(name)) { mandatory.add(name); // Otherwise, report an error. } else { throw new IllegalArgumentException("Mandatory attribute '" + name + "' does not exist."); } } } this.mandatory = mandatory; }
private static boolean matchMandatory(Capability cap, SimpleFilter sf) { if (cap instanceof CapabilityImpl) { for (Entry<String, Object> entry : cap.getAttributes().entrySet()) { if (((CapabilityImpl) cap).isAttributeMandatory(entry.getKey()) && !matchMandatoryAttribute(entry.getKey(), sf)) { return false; } } } else { String value = cap.getDirectives().get(Constants.MANDATORY_DIRECTIVE); if (value != null) { List<String> names = ResourceBuilder.parseDelimitedString(value, ","); for (Entry<String, Object> entry : cap.getAttributes().entrySet()) { if (names.contains(entry.getKey()) && !matchMandatoryAttribute(entry.getKey(), sf)) { return false; } } } } return true; }
private static boolean matchMandatory(Capability cap, SimpleFilter sf) { if (cap instanceof CapabilityImpl) { for (Entry<String, Object> entry : cap.getAttributes().entrySet()) { if (((CapabilityImpl) cap).isAttributeMandatory(entry.getKey()) && !matchMandatoryAttribute(entry.getKey(), sf)) { return false; } } } else { String value = cap.getDirectives().get(Constants.MANDATORY_DIRECTIVE); if (value != null) { List<String> names = ResourceBuilder.parseDelimitedString(value, ","); for (Entry<String, Object> entry : cap.getAttributes().entrySet()) { if (names.contains(entry.getKey()) && !matchMandatoryAttribute(entry.getKey(), sf)) { return false; } } } } return true; }
List<String> tokens = parseDelimitedString( clause.attrs.get(entry.getKey()).toString(), ",", false); List<Object> values = new ArrayList<>(tokens.size());
private static List<Requirement> parseBreeHeader(String header, Resource resource) { List<String> filters = new ArrayList<>(); for (String entry : parseDelimitedString(header, ",")) { List<String> names = parseDelimitedString(entry, "/"); List<String> left = parseDelimitedString(names.get(0), "-"); Version rVer = null; if (names.size() > 1) { List<String> right = parseDelimitedString(names.get(1), "-"); rName = right.get(0); try {
List<String> tokens = parseDelimitedString( clause.attrs.get(entry.getKey()).toString(), ",", false); List<Object> values = new ArrayList<>(tokens.size());
List<String> tokens = parseDelimitedString( clause.attrs.get(entry.getKey()).toString(), ",", false); List<Object> values = new ArrayList<>(tokens.size());
List<String> tokens = parseDelimitedString( clause.attrs.get(entry.getKey()).toString(), ",", false); List<Object> values = new ArrayList<>(tokens.size());
private static List<Requirement> parseBreeHeader(String header, Resource resource) { List<String> filters = new ArrayList<>(); for (String entry : parseDelimitedString(header, ",")) { List<String> names = parseDelimitedString(entry, "/"); List<String> left = parseDelimitedString(names.get(0), "-"); Version rVer = null; if (names.size() > 1) { List<String> right = parseDelimitedString(names.get(1), "-"); rName = right.get(0); try {