/** * Builds a certificate reference expression that is an {@link ExtensionField}. * @param token The token used to build the field. * @return An {@link ExtensionField} object that represents the token. Returns null if the token does not represent an {@link ExtensionField}. * @throws PolicyParseException */ public IPolicyExpression BuildExtensionField(String token) //throws PolicyParseException { IPolicyExpression retVal = null; ExtensionIdentifier fieldType = ExtensionIdentifier.FromToken(token); bool required = token.EndsWith("+"); if (fieldType != null) { try { Type retType = fieldType.GetReferenceClass(token, required); if (retType == null) { throw new PolicyParseException("ExtensionField with token name " + token + " has not been implemented yet."); } var ctor = retType.Ctor <bool, IPolicyExpression>(); retVal = ctor(required); } catch (PolicyParseException ex) { throw ex; } catch (Exception e) { throw new PolicyParseException("Error building ExtensionField", e); } } return(retVal); }