private Object readResolve() throws ObjectStreamException { try { return new PlaceholderSatisfaction(removedType.resolve()); } catch (ClassNotFoundException e) { InvalidObjectException ex = new InvalidObjectException("class not found"); ex.initCause(e); throw ex; } } }
@Override public BindingFunction transform(BindingFunction bindFunction) { if (bindFunction instanceof RuleBasedBindingFunction) { RuleBasedBindingFunction rbf = (RuleBasedBindingFunction) bindFunction; ListMultimap<ContextMatcher, BindRule> bindings = rbf.getRules(); ListMultimap<ContextMatcher, BindRule> newBindings = ArrayListMultimap.create(); for (Map.Entry<ContextMatcher, BindRule> entry: bindings.entries()) { BindRule rule = entry.getValue(); BindRuleBuilder builder = rule.newCopyBuilder(); Class<?> type = builder.getDependencyType(); newBindings.put(entry.getKey(), builder.setSatisfaction(new PlaceholderSatisfaction(type)) .build()); } return new RuleBasedBindingFunction(newBindings); } else { throw new IllegalArgumentException("cannot transform bind function " + bindFunction); } } };
private Object readResolve() throws ObjectStreamException { try { return new PlaceholderSatisfaction(removedType.resolve()); } catch (ClassNotFoundException e) { InvalidObjectException ex = new InvalidObjectException("class not found"); ex.initCause(e); throw ex; } } }
@Override public BindingFunction transform(BindingFunction bindFunction) { if (bindFunction instanceof RuleBasedBindingFunction) { RuleBasedBindingFunction rbf = (RuleBasedBindingFunction) bindFunction; ListMultimap<ContextMatcher, BindRule> bindings = rbf.getRules(); ListMultimap<ContextMatcher, BindRule> newBindings = ArrayListMultimap.create(); for (Map.Entry<ContextMatcher, BindRule> entry: bindings.entries()) { BindRule rule = entry.getValue(); BindRuleBuilder builder = rule.newCopyBuilder(); Class<?> type = builder.getDependencyType(); newBindings.put(entry.getKey(), builder.setSatisfaction(new PlaceholderSatisfaction(type)) .build()); } return new RuleBasedBindingFunction(newBindings); } else { throw new IllegalArgumentException("cannot transform bind function " + bindFunction); } } };