use of org.jboss.metadata.property.SimpleExpressionResolver in project wildfly by wildfly.
the class FunctionalResolverProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final List<Function<String, String>> functions = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_EXPRESSION_RESOLVERS);
if (functions != null) {
SimpleExpressionResolver[] sers = new SimpleExpressionResolver[functions.size()];
for (int i = 0; i < functions.size(); i++) {
Function<String, String> funct = functions.get(i);
sers[i] = expressionContent -> {
String input = "${" + expressionContent + "}";
String resolved = funct.apply(input);
return resolved == null ? null : new SimpleExpressionResolver.ResolutionResult(resolved, false);
};
}
deploymentUnit.addToAttachmentList(Attachments.DEPLOYMENT_PROPERTY_RESOLVERS, new CompositePropertyResolver(sers));
}
}
Aggregations