/** * Wrap the object if required. * This is used for the wrapper policy support and EJB. */ public Object wrapObject(Object implementation, AbstractSession session) { if (!this.hasWrapperPolicy) { return implementation; } if (implementation == null) { return null; } // PERF: Using direct variable access. // Check if already wrapped. if ((!this.descriptor.hasWrapperPolicy()) || this.descriptor.getWrapperPolicy().isWrapped(implementation)) { return implementation; } // Allow for inheritance, the concrete wrapper must always be used. if (this.descriptor.hasInheritance() && this.descriptor.getInheritancePolicy().hasChildren() && (implementation.getClass() != this.descriptor.getJavaClass())) { ClassDescriptor descriptor = session.getDescriptor(implementation); if (descriptor != this.descriptor) { return descriptor.getObjectBuilder().wrapObject(implementation, session); } } return this.descriptor.getWrapperPolicy().wrapObject(implementation, session); }
/** * Wrap the object if required. * This is used for the wrapper policy support and EJB. */ public Object wrapObject(Object implementation, AbstractSession session) { if (!this.hasWrapperPolicy) { return implementation; } if (implementation == null) { return null; } // PERF: Using direct variable access. // Check if already wrapped. if ((!this.descriptor.hasWrapperPolicy()) || this.descriptor.getWrapperPolicy().isWrapped(implementation)) { return implementation; } // Allow for inheritance, the concrete wrapper must always be used. if (this.descriptor.hasInheritance() && this.descriptor.getInheritancePolicy().hasChildren() && (implementation.getClass() != this.descriptor.getJavaClass())) { ClassDescriptor descriptor = session.getDescriptor(implementation); if (descriptor != this.descriptor) { return descriptor.getObjectBuilder().wrapObject(implementation, session); } } return this.descriptor.getWrapperPolicy().wrapObject(implementation, session); }
/** * Wrap the object if required. * This is used for the wrapper policy support and EJB. */ public Object wrapObject(Object implementation, AbstractSession session) { if (!this.hasWrapperPolicy) { return implementation; } if (implementation == null) { return null; } // PERF: Using direct variable access. // Check if already wrapped. if ((!this.descriptor.hasWrapperPolicy()) || this.descriptor.getWrapperPolicy().isWrapped(implementation)) { return implementation; } // Allow for inheritance, the concrete wrapper must always be used. if (this.descriptor.hasInheritance() && this.descriptor.getInheritancePolicy().hasChildren() && (implementation.getClass() != this.descriptor.getJavaClass())) { ClassDescriptor descriptor = session.getDescriptor(implementation); if (descriptor != this.descriptor) { return descriptor.getObjectBuilder().wrapObject(implementation, session); } } return this.descriptor.getWrapperPolicy().wrapObject(implementation, session); } }