private void callTypeContributors( ListMultimap<Operation, Method> typeContributors, InterleavedPlan plan, InterleavedPlanBuilder planBuilder, DeploymentPlanningContext context) { if (typeContributors == null) return; for (Delta dOp : plan.getDeltas()) { List<Method> methods = typeContributors.get(dOp.getOperation()); @SuppressWarnings("rawtypes") Deployed deployed = getActiveDeployed(dOp); for (Method method : methods) { Type type = Type.valueOf(method.getDeclaringClass()); if (type.equals(deployed.getType())) { invokeTypeContributer(context, dOp, method); } else { Descriptor descriptor = DescriptorRegistry.getDescriptor(deployed.getType()); if (descriptor.isAssignableTo(type)) { invokeTypeContributer(context, dOp, method); } } } } }
private Deployed<?, ?> getActiveDeployed(Delta dOp) { if (dOp.getOperation() == Operation.DESTROY) { return dOp.getPrevious(); } return dOp.getDeployed(); }