/** {@inheritDoc} */ @Nullable protected IdPAttributeValue<?> decodeValue(@Nonnull final XMLObject object) { Constraint.isNotNull(object, "Object supplied to must not be null"); final String stringValue = getStringValue(object); if (null == stringValue) { return null; } final int offset = stringValue.indexOf(getDelimiter()); if (offset < 0) { return null; } return ScopedStringAttributeValue.valueOf(stringValue.substring(0, offset), stringValue.substring(offset + getDelimiter().length())); }
/** * Builds a {@link ScopedStringAttributeValue} from a {@link StringAttributeValue} whose value contains a delimited * value. * * @param value the original attribute value * * @return the scoped attribute value * * @throws ResolutionException thrown if the given attribute value does not contain a delimited value */ @Nonnull private IdPAttributeValue<?> buildScopedStringAttributeValue( @Nonnull final StringAttributeValue value) throws ResolutionException { Constraint.isNotNull(value, getLogPrefix() + " Attribute value can not be null"); final String[] stringValues = value.getValue().split(scopeDelimiter); if (stringValues.length < 2) { log.error("{} Input attribute value {} does not contain delimiter {} and can not be split", new Object[] { getLogPrefix(), value.getValue(), scopeDelimiter,}); throw new ResolutionException("Input attribute value can not be split."); } log.debug("{} Value '{}' was split into {} at scope delimiter '{}'", new Object[] {getLogPrefix(), value.getValue(), stringValues, scopeDelimiter,}); return ScopedStringAttributeValue.valueOf(stringValues[0], stringValues[1]); }