if (policyType.isInstance(p)) {
policies.add(policyType.cast(p));
}
if (p instanceof PolicyExpression) {
PolicyExpression exp = (PolicyExpression)p;
if (policyType.isInstance(exp.getPolicy())) {
policies.add(policyType.cast(exp.getPolicy()));
}
// TODO - some code to handle the case where the
// policy expression is a WS-Policy
// Experimental at the moment.
if (PolicyContainer.class.isInstance(exp.getPolicy())){
Object policy = ((PolicyContainer)exp.getPolicy()).getChildPolicy(policyType);
if(policy != null){
policies.add(policyType.cast(policy));
}
}
}