/** * Returns a PropertyProxy suitable for the given instance and registers * the selected PropertyProxy for the Class of the instance. Note that * the PropertyProxy is not cloned so either the PropertyProxy should be * used as a template else you must first call clone() on the returned * PropertyProxy and then set the instance as the default on the resulting * clone. * * @param instance the type to search for a suitable PropertyProxy. * @return PropertyProxy suitable for the instance type. */ public static PropertyProxy getProxyAndRegister(Object instance) { if (instance instanceof PropertyProxy) return (PropertyProxy)instance; Class c = instance.getClass(); PropertyProxy proxy = getRegistry().getProxyAndRegister(c); if (proxy == null) { proxy = guessProxy(instance); getRegistry().register(c, proxy); } return proxy; }
/** * Returns a PropertyProxy suitable for the given instance but does not * register the selected PropertyProxy for the Class of the instance. Note * that the PropertyProxy is not cloned so either the PropertyProxy should * be used as a template else you must first call clone() on the returned * PropertyProxy and then set the instance as the default on the resulting * clone. * * @param instance the type to search for a suitable PropertyProxy. * @return PropertyProxy suitable for the instance type. */ public static PropertyProxy getProxy(Object instance) { if (instance instanceof PropertyProxy) return (PropertyProxy)instance; Class c = instance.getClass(); PropertyProxy proxy = getRegistry().getProxy(c); if (proxy == null) { proxy = guessProxy(instance); } proxy = (PropertyProxy)proxy.clone(); proxy.setDefaultInstance(instance); return proxy; }
/** * Returns a PropertyProxy suitable for the given instance but does not * register the selected PropertyProxy for the Class of the instance. Note * that the PropertyProxy is not cloned so either the PropertyProxy should * be used as a template else you must first call clone() on the returned * PropertyProxy and then set the instance as the default on the resulting * clone. * * @param instance the type to search for a suitable PropertyProxy. * @return PropertyProxy suitable for the instance type. */ public static PropertyProxy getProxy(Object instance) { if (instance instanceof PropertyProxy) return (PropertyProxy)instance; Class c = instance.getClass(); PropertyProxy proxy = getRegistry().getProxy(c); if (proxy == null) { proxy = guessProxy(instance); } proxy = (PropertyProxy)proxy.clone(); proxy.setDefaultInstance(instance); return proxy; }
/** * Returns a PropertyProxy suitable for the given instance and registers * the selected PropertyProxy for the Class of the instance. Note that * the PropertyProxy is not cloned so either the PropertyProxy should be * used as a template else you must first call clone() on the returned * PropertyProxy and then set the instance as the default on the resulting * clone. * * @param instance the type to search for a suitable PropertyProxy. * @return PropertyProxy suitable for the instance type. */ public static PropertyProxy getProxyAndRegister(Object instance) { if (instance instanceof PropertyProxy) return (PropertyProxy)instance; Class c = instance.getClass(); PropertyProxy proxy = getRegistry().getProxyAndRegister(c); if (proxy == null) { proxy = guessProxy(instance); getRegistry().register(c, proxy); } return proxy; }
/** * Returns a PropertyProxy suitable for the given instance and registers * the selected PropertyProxy for the Class of the instance. Note that * the PropertyProxy is not cloned so either the PropertyProxy should be * used as a template else you must first call clone() on the returned * PropertyProxy and then set the instance as the default on the resulting * clone. * * @param instance the type to search for a suitable PropertyProxy. * @return PropertyProxy suitable for the instance type. */ public static PropertyProxy getProxyAndRegister(Object instance) { if (instance instanceof PropertyProxy) return (PropertyProxy)instance; Class c = instance.getClass(); PropertyProxy proxy = getRegistry().getProxyAndRegister(c); if (proxy == null) { proxy = guessProxy(instance); getRegistry().register(c, proxy); } return proxy; }
/** * Returns a PropertyProxy suitable for the given instance but does not * register the selected PropertyProxy for the Class of the instance. Note * that the PropertyProxy is not cloned so either the PropertyProxy should * be used as a template else you must first call clone() on the returned * PropertyProxy and then set the instance as the default on the resulting * clone. * * @param instance the type to search for a suitable PropertyProxy. * @return PropertyProxy suitable for the instance type. */ public static PropertyProxy getProxy(Object instance) { if (instance instanceof PropertyProxy) return (PropertyProxy)instance; Class c = instance.getClass(); PropertyProxy proxy = getRegistry().getProxy(c); if (proxy == null) { proxy = guessProxy(instance); } proxy = (PropertyProxy)proxy.clone(); proxy.setDefaultInstance(instance); return proxy; }