Re: WOComponents, Packages, and Protected variables.

From: Anders Peterson (anders_peterso..ptimatika.se)
Date: Thu Aug 16 2007 - 11:58:40 EDT

  • Next message: Guido Neitzer: "Re: WOComponents, Packages, and Protected variables."

    Anders Peterson wrote:
    > Mike Schrag wrote:
    >> This "bug" is actually fixed in newer builds ... Maybe only in the 3.3
    >> one, not sure, but it's REALLY for the best to fix this properly in
    >> your code.
    >>
    >> ms
    >
    > 3.3... Is this an eclipse bug?
    >
    > From the other answers it seems I misunderstood the original question.
    > I thought David was looking for the KeyValueCodingProtectedAccessor class.
    >
    > I have one of these in every package containing components.
    >
    > /Anders
    >

    package se.optimatika.quesada.gui;

    import java.lang.reflect.*;

    import com.webobjects.foundation.*;

    public class KeyValueCodingProtectedAccessor extends NSKeyValueCoding.ValueAccessor {

        public KeyValueCodingProtectedAccessor() {
            super();
        }

       ..verride
        public Object fieldValue(Object anObject, Field aField) throws IllegalArgumentException, IllegalAccessException {
            return aField.get(anObject);
        }

       ..verride
        public Object methodValue(Object anObject, Method aMethod) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
            return aMethod.invoke(anObject, (Object[]) null);
        }

       ..verride
        public void setFieldValue(Object anObject, Field aField, Object aValue) throws IllegalArgumentException, IllegalAccessException {
            aField.set(anObject, aValue);
        }

       ..verride
        public void setMethodValue(Object anObject, Method aMethod, Object aValue) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
            aMethod.invoke(anObject, new Object[] { aValue });
        }

    }



    This archive was generated by hypermail 2.0.0 : Thu Aug 16 2007 - 12:00:44 EDT