/** * Parses the selector string and returns an ordered List of {@link SelectorPart} objects that * represent each clause between <code>><code> symbols. * * @param value the value * @return the list * @throws InvalidParameterException the invalid parameter exception */ public static SelectorPath parse(String value) throws InvalidParameterException { List<SelectorPart> selectorParts = new ArrayList<>(); if (value == null) { return new SelectorPath(selectorParts); } String[] parts = value.split("\\s*>\\s*"); for (String part : parts) { if (StringUtils.isNotEmpty(part)) { int colon = part.indexOf(':'); if (colon != -1) { String[] typeAndQualifier = part.split(":"); selectorParts.add(new SelectorPart(getType(typeAndQualifier[0]), typeAndQualifier[1])); } else { selectorParts.add(new SelectorPart(getType(part))); } } } return new SelectorPath(selectorParts); }
/** * Parses the selector string and returns an ordered List of {@link SelectorPart} objects that * represent each clause between <code>><code> symbols. * * @param value the value * @return the list * @throws InvalidParameterException the invalid parameter exception */ public static SelectorPath parse(String value) throws InvalidParameterException { List<SelectorPart> selectorParts = new ArrayList<>(); if (value == null) { return new SelectorPath(selectorParts); } String[] parts = value.split("\\s*>\\s*"); for (String part : parts) { if (StringUtils.isNotEmpty(part)) { int colon = part.indexOf(':'); if (colon != -1) { String[] typeAndQualifier = part.split(":"); selectorParts.add(new SelectorPart(getType(typeAndQualifier[0]), typeAndQualifier[1])); } else { selectorParts.add(new SelectorPart(getType(part))); } } } return new SelectorPath(selectorParts); }