/** * This method is called after all the properties (except IDREF) are unmarshalled for this object, * but before this object is set to the parent object. */ @SuppressWarnings("PMD") private void afterUnmarshal(final Unmarshaller unmarshaller, final Object parentObject) { // The XMLID must start with the #AUTHORIZATION_PATH_XMLID_PREFIX if (!this.xmlID.startsWith(AUTHORIZATION_PATH_XMLID_PREFIX)) { throw new IllegalStateException( "Illegal XMLID value found while unmarshalling. " + "Must start with '" + AUTHORIZATION_PATH_XMLID_PREFIX + "'"); } final String toParse = this.xmlID.substring(AUTHORIZATION_PATH_XMLID_PREFIX.length()); final AuthorizationPath tmp = parse(toParse); // Assign the internal state this.realm = tmp.getRealm(); this.group = tmp.getGroup(); this.qualifier = tmp.getQualifier(); }
/** * Splices the supplied toParse string into a SortedSet of AuthorizationPaths. * * @param toParse A non-empty string to splice and parse into a set of AuthorizationPaths. * @return A non-null SortedSet containing AuthorizationPaths. */ public static SortedSet<SemanticAuthorizationPath> spliceAndParse(final String toParse) { // Check sanity Validate.notEmpty(toParse, "toParse"); final SortedSet<SemanticAuthorizationPath> toReturn = new TreeSet<>(); // Splice on separators, then delegate to the parse method. Stream.of(toParse.split(SemanticAuthorizationPath.PATTERN_SEPARATOR_STRING, -1)) .forEach(splitPattern -> toReturn.add(AuthorizationPath.parse(splitPattern))); // All Done. return toReturn; }