private static Object applyToProperty( Object obj, String name, Object value )
		throws UnknownStyleException, IllegalArgumentException
	{
		Class<?> cls = obj.getClass();
		String getterName = buildMethodName( "get", name );
		String setterName = buildMethodName( "set", name );

		try {
			Method getter;
			try {
				getter = cls.getMethod( getterName );
			} catch( NoSuchMethodException ex ) {
				getter = cls.getMethod( buildMethodName( "is", name ) );
			}
			Method setter = cls.getMethod( setterName, getter.getReturnType() );
			Object oldValue = getter.invoke( obj );
			setter.invoke( obj, convertToEnum( value, getter.getReturnType() ) );
			return oldValue;
		} catch( NoSuchMethodException ex ) {
			throw new UnknownStyleException( name );
		} catch( Exception ex ) {
			throw new IllegalArgumentException( "failed to invoke property methods '" + cls.getName() + "."
				+ getterName + "()' or '" + setterName + "(...)'", ex );
		}
	}
Applies the given value to a property of the given object.
Works only for properties that have public getter and setter methods.
First the property getter is invoked to get the old value,
then the property setter is invoked to set the new value.

@param obj the object
@param name the name of the property
@param value the new value
@return the old value of the property
@throws UnknownStyleException if object does not have a property with given name
@throws IllegalArgumentException if value type does not fit to expected type
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatStylingSupport.java