/** * Sets the instance used by this property. * <p> * The new instance must be of the same type as the old instance * <p> * To be consistent with {@link #setValue(Object)}, this method will fire a * value change event even if the value stays the same * * @param instance * the instance to use * @since 7.7.7 */ public void setInstance(Object instance) { if (this.instance.getClass() != instance.getClass()) { throw new IllegalArgumentException("The new instance is of type " + instance.getClass().getName() + " which does not match the old instance type " + this.instance.getClass().getName()); } this.instance = instance; fireValueChange(); }
/** * Sets the value of the property. * * Note that since Vaadin 7, no conversions are performed and the value must * be of the correct type. * * @param newValue * the New value of the property. * @throws <code>Property.ReadOnlyException</code> * if the object is in read-only mode. * @see #invokeSetMethod(Object) */ @Override public void setValue(T newValue) throws Property.ReadOnlyException { // Checks the mode if (isReadOnly()) { throw new Property.ReadOnlyException(); } invokeSetMethod(newValue); fireValueChange(); }