/** * Call this method on a new instance created by the no-arg constructor * to create an independent copy of the configuration from the given object. * @param other the AdvisedSupport object to copy configuration from */ protected void copyConfigurationFrom(AdvisedSupport other) { copyConfigurationFrom(other, other.targetSource, new ArrayList<>(other.advisors)); }
/** * Call this method on a new instance created by the no-arg constructor * to create an independent copy of the configuration from the other. * @param other AdvisedSupport to copy configuration from */ protected void copyConfigurationFrom(AdvisedSupport other) { copyConfigurationFrom(other, other.targetSource, other.advisors); }
/** * Call this method on a new instance created by the no-arg constructor * to create an independent copy of the configuration from the given object. * @param other the AdvisedSupport object to copy configuration from */ protected void copyConfigurationFrom(AdvisedSupport other) { copyConfigurationFrom(other, other.targetSource, new ArrayList<Advisor>(other.advisors)); }
/** * Call this method on a new instance created by the no-arg constructor * to create an independent copy of the configuration from the given object. * @param other the AdvisedSupport object to copy configuration from */ protected void copyConfigurationFrom(AdvisedSupport other) { copyConfigurationFrom(other, other.targetSource, new ArrayList<>(other.advisors)); }
/** * Serialize a copy of the state of this class, ignoring * subclass state. */ protected Object writeReplace() throws ObjectStreamException { if (logger.isDebugEnabled()) { logger.debug("Disconnecting " + this); } // Copy state to avoid dependencies // on BeanFactories etc. that subclasses may have. AdvisedSupport copy = this; // If we're in a non-serializable subclass, // copy into an AdvisedSupport object. if (getClass() != AdvisedSupport.class) { copy = new AdvisedSupport(); copy.copyConfigurationFrom(this); } // may return this return copy; }
/** * Create a new prototype instance of this class's created proxy object, * backed by an independent advisedSupport configuration * @return a totally independent proxy, whose advice we may manipulate in isolation */ private synchronized Object newPrototypeInstance() { // In the case of a prototype, we need to give the proxy // an independent instance of the configuration. // In this case, no proxy will have an instance of this object's configuration, // but will have an independent copy. if (logger.isDebugEnabled()) { logger.debug("Creating copy of prototype ProxyFactoryBean config: " + this); } AdvisedSupport copy = new AdvisedSupport(); // The copy needs a fresh advisor chain, and a fresh TargetSource. copy.copyConfigurationFrom(this, freshTargetSource(), freshAdvisorChain()); copy.setFrozen(this.freezeProxy); if (logger.isDebugEnabled()) { logger.debug("Copy has config: " + copy); } return getProxy(copy.createAopProxy()); }