Skip to content

Commit

Permalink
adapt javadoc and delete unused code
Browse files Browse the repository at this point in the history
Signed-off-by: Yannic Klem <Yannic.Klem@bosch.io>
  • Loading branch information
Yannic92 committed Mar 3, 2022
1 parent 78014a0 commit e4bafb8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 277 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public Set<SubjectId> getSubjectIds(final DittoHeaders dittoHeaders, final JsonW
PlaceholderFactory.newPlaceholderResolver(JwtPlaceholder.getInstance(), jwt)
);
return expressionResolver.resolvePartially(subjectTemplate, Set.of(JwtPlaceholder.PREFIX))
.toStream()
.map(SubjectId::newInstance)
.collect(Collectors.toCollection(LinkedHashSet::new));
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ default PipelineElement resolve(final String expressionTemplate) {
* @param expressionTemplate the expressionTemplate to resolve {@link Placeholder}s and execute optional
* pipeline stages
* @param forbiddenUnresolvedExpressionPrefixes a collection of expression prefixes which must be resolved
* @return the resolved String, a signifier for resolution failure, or one for deletion.
* @return the resolved PipelineElement.
* @throws PlaceholderFunctionTooComplexException thrown if the {@code expressionTemplate} contains a placeholder
* function chain which is too complex (e.g. too much chained function calls)
* @throws UnresolvedPlaceholderException if placeholders could not be resolved which contained prefixed in the
* provided {@code forbiddenUnresolvedExpressionPrefixes} list.
* @since 2.0.0
* @since 2.4.0
*/
default Stream<String> resolvePartially(final String expressionTemplate,
default PipelineElement resolvePartially(final String expressionTemplate,
final Collection<String> forbiddenUnresolvedExpressionPrefixes) {

return ExpressionResolver.substitute(expressionTemplate, expression -> {
Expand All @@ -102,7 +102,7 @@ default Stream<String> resolvePartially(final String expressionTemplate,
}
return PipelineElement.resolved("{{" + expression + "}}");
});
}).toStream();
});
}

/**
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ private Pipeline getPipelineFromExpressions(final List<String> pipelineStagesExp
return new ImmutablePipeline(ImmutableFunctionExpression.INSTANCE, pipelineStages);
}

private ArrayPipeline getArrayPipelineFromExpressions(final List<String> pipelineStagesExpressions,
final int skip) {
final List<String> pipelineStages = pipelineStagesExpressions.stream()
.skip(skip) // ignore pre-processed expressions
.collect(Collectors.toList());
return new ImmutableArrayPipeline(ImmutableArrayFunctionExpression.INSTANCE, pipelineStages);
}

private Optional<String> getPlaceholderPrefix(final String placeholder) {
final int separatorIndex = placeholder.indexOf(SEPARATOR);
if (separatorIndex == -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.stream.Collectors;

/**
* Resolves a passed in placeholder {@code name} from the {@link #getPlaceholderSources()} () resolver}.
* Resolves a passed in placeholder {@code name} from the {@link #getPlaceholderSources() sources}.
* If this PlaceholderResolver is only used for validation, a constant value of {@code "valid"} is returned instead
* of asking the resolver.
*/
Expand All @@ -27,6 +27,12 @@ public interface PlaceholderResolver<T> extends Placeholder<T> {
*/
List<T> getPlaceholderSources();

/**
* Resolves the passed in {@code name} from the {@link #getPlaceholderSources() sources}.
*
* @param name the placeholder name to resolve from the resolver.
* @return the resolved value or an empty optional if it could not be resolved.
*/
default List<String> resolve(final String name) {
return getPlaceholderSources().stream()
.flatMap(source -> resolve(source, name).stream())
Expand Down

0 comments on commit e4bafb8

Please sign in to comment.