use of org.nhindirect.policy.x509.X509FieldType in project nhin-d by DirectProject.
the class SimpleTextV1LexiconPolicyParser method buildX509Field.
/**
* Builds a certificate reference expression that is an {@link X509Field}.
* @param token The token used to build the field.
* @return An {@link X509Field} object that represents the token. Returns null if the token does not represent an {@link X509Field}.
* @throws PolicyParseException
*/
protected PolicyExpression buildX509Field(String token) throws PolicyParseException {
X509Field<?> retVal = null;
final X509FieldType fieldType = X509FieldType.fromToken(token);
if (fieldType != null) {
try {
Class<? extends X509Field<?>> fieldRefClass = fieldType.getReferenceClass();
if (fieldRefClass == null)
throw new PolicyParseException("X509Field with token name " + token + " has not been implemented yet.");
retVal = fieldRefClass.newInstance();
} catch (PolicyParseException ex) {
throw ex;
}///CLOVER:OFF
catch (Exception e) {
throw new PolicyParseException("Error building X509Field", e);
}
///CLOVER:ON
}
return retVal;
}
Aggregations