com.safelayer.rap.impl.resolvers.ValueMappingResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pki-connector-restapi Show documentation
Show all versions of pki-connector-restapi Show documentation
The PKI Connector RESTAPI is a library that helps developing new PKI Connectors for TrustedX
The newest version!
package com.safelayer.rap.impl.resolvers;
import java.util.List;
import com.safelayer.rap.api.model.issuance.RegistrationParameters;
import com.safelayer.rap.api.model.mapping.ByLabelsValueMapping;
import com.safelayer.rap.api.model.mapping.DynamicValueMapping;
import com.safelayer.rap.api.model.mapping.StaticValueMapping;
import com.safelayer.rap.api.model.mapping.ValueMapping;
public class ValueMappingResolver {
private DynamicValueResolver templateResolver;
private List labels;
public ValueMappingResolver(RegistrationParameters params, List labels) {
this.templateResolver = new DynamicValueResolver(params);
this.labels = labels;
}
public String resolve(ValueMapping valueMapping) throws Exception {
if (valueMapping instanceof StaticValueMapping)
return ((StaticValueMapping) valueMapping).getValue();
if (valueMapping instanceof DynamicValueMapping)
return templateResolver.resolve(((DynamicValueMapping) valueMapping).getTemplate());
ByLabelsValueResolver labelsResolver = new ByLabelsValueResolver((ByLabelsValueMapping) valueMapping);
return labelsResolver.resolve(labels);
}
}