private void addPolicies(AbstractServiceFactoryBean factory, Endpoint endpoint, Class<?> cls,
List<Policy> list, Policy.Placement defaultPlace) {
ListIterator<Policy> it = list.listIterator();
InterfaceInfo inf = endpoint.getEndpointInfo().getInterface();
BindingInfo binf = endpoint.getBinding().getBindingInfo();
ServiceInfo si = endpoint.getService().getServiceInfos().get(0);
while (it.hasNext()) {
Policy p = it.next();
Policy.Placement place = p.placement();
if (place == Policy.Placement.DEFAULT) {
place = defaultPlace;
}
switch (place) {
case PORT_TYPE: {
addPolicy(inf, si, p, cls,
inf.getName().getLocalPart() + "PortTypePolicy");
it.remove();
break;
}
case BINDING: {
addPolicy(binf, si, p, cls,
binf.getName().getLocalPart() + "BindingPolicy");
it.remove();
break;
}
case SERVICE: {
addPolicy(si, si, p, cls,
si.getName().getLocalPart() + "ServicePolicy");
it.remove();
break;
}
case SERVICE_PORT: {
addPolicy(endpoint.getEndpointInfo(), si, p, cls,