the return type of this method is boolean.It return true when the operation succeeds,and false otherwise.
So i would like to know examples or situation when it would return false?
Returns false if the container implementing this does not allow removing container properties.
so how do i make the container allow that?
Use a container that allows it. For example IndexedContainer (which is also used by default in the Table)
Isn’t that what the UnsupportedOperationException is for.
/**
* Removes a Property specified by the given Property ID from the Container.
* Note that the Property will be removed from all Items in the Container.
*
* This functionality is optional.
*
* @param propertyId
* ID of the Property to remove
* @return <code>true</code> if the operation succeeded, <code>false</code>
* if not
*/
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException;
True. My mistake. Sorry.
API is quite loosely documented on what is the difference between returning false and UnsupportedOperationException. It should be more clearly stated that the UnsupportedOperationException is only thrown if the container does not support such operation at all and false is returned if just this specific property could not be removed at the time (and some other property could be removed or this property could be removed in some other state of the container).
Stll - API design could be better for this. This is also my mistake ;-) (from year 2002).