/** * Accessor for the current object managed by this factory instance. */ public T get() { Builder<T> b = this.builder; if (b == null) { log.warn("DWR has not been initialized properly"); return null; } return b.get(); }
/** * Internal method to allow us to get the Builder from which we will get * created objects. Do NOT call this method from outside of DWR. * This function should <em>only</em> be called during startup. * our Container Builder from. */ public T attach(Container container) { this.builder = container.getBean(created); return builder.attach(container); }
/** * Accessor for the current object in more complex setups. * For some setups DWR may not be able to discover the correct environment * (i.e. ServletContext), so we need to tell it. This generally happens if * you have DWR configured twice in a single context. Unless you are writing * code that someone else will configure, it is probably safe to use the * simpler {@link #get()} method. * @param ctx The servlet context to allow us to bootstrap * @return The current object accessed by this Factory. */ public T get(ServerContext ctx) { Builder<T> b = this.builder; if (b == null) { log.warn("DWR has not been initialized properly"); return null; } return b.get(ctx); }