restygwt/src/main/java/org/fusesource/restygwt/rebind/JsonEncoderDecoderClassCreator.java
private boolean exists(JClassType type, JField field, String fieldName, boolean isSetter) {
        if (field instanceof DummyJField) {
            return true;
        }

        JType[] args;
        if (isSetter) {
            args = new JType[] { field.getType() };
        } else {
            args = new JType[] {};
        }
        JMethod m = type.findMethod(fieldName, args);
        if (null != m) {
            if (isIgnored(m)) {
                return false;
            }
            if (isSetter) {
                return true;
            }
            JClassType returnType = m.getReturnType().isClassOrInterface();
            JClassType fieldType = field.getType().isClassOrInterface();
            if (returnType == null || fieldType == null) {
                // at least one is a primitive type
                return m.getReturnType().equals(field.getType());
            }
            // both are non-primitives
            return returnType.isAssignableFrom(fieldType);
        }
        try {
            JType objectType = find(Object.class, getLogger(), context);
            JClassType superType = type.getSuperclass();
            if (!objectType.equals(superType)) {
                return exists(superType, field, fieldName, isSetter);
            }
        } catch (UnableToCompleteException e) {
            // do nothing
        }
        return false;
    }
private boolean exists(JClassType type, JField field, String fieldName, boolean isSetter) {
        if (field instanceof DummyJField) {
            return true;
        }

        JType[] args;
        if (isSetter) {
            args = new JType[] { field.getType() };
        } else {
            args = new JType[] {};
        }
        JMethod m = type.findMethod(fieldName, args);
        if (null != m) {
            if (isIgnored(m)) {
                return false;
            }
            if (isSetter) {
                return true;
            }
            JClassType returnType = m.getReturnType().isClassOrInterface();
            JClassType fieldType = field.getType().isClassOrInterface();
            if (returnType == null || fieldType == null) {
                // at least one is a primitive type
                return m.getReturnType().equals(field.getType());
            }
            // both are non-primitives
            return returnType.isAssignableFrom(fieldType);
        }
        try {
            JType objectType = find(Object.class, getLogger(), context);
            JClassType superType = type.getSuperclass();
            if (!objectType.equals(superType)) {
                return exists(superType, field, fieldName, isSetter);
            }
        } catch (UnableToCompleteException e) {
            // do nothing
        }
        return false;
    }
private boolean exists ( JClassType type , JField field , String fieldName , boolean isSetter ) { if ( field instanceof DummyJField ) { return true ; } JType [ ] args ; if ( isSetter ) { args = new JType [ ] { field . getType ( ) } ; } else { args = new JType [ ] { } ; } JMethod m = type . findMethod ( fieldName , args ) ; if ( null != m ) { if ( isIgnored ( m ) ) { return false ; } if ( isSetter ) { return true ; } JClassType returnType = m . getReturnType ( ) . isClassOrInterface ( ) ; JClassType fieldType = field . getType ( ) . isClassOrInterface ( ) ; if ( returnType == null || fieldType == null ) { // at least one is a primitive type return m . getReturnType ( ) . equals ( field . getType ( ) ) ; } // both are non-primitives return returnType . isAssignableFrom ( fieldType ) ; } try { JType objectType = find ( Object . class , getLogger ( ) , context ) ; JClassType superType = type . getSuperclass ( ) ; if ( ! objectType . equals ( superType ) ) { return exists ( superType , field , fieldName , isSetter ) ; } } catch ( UnableToCompleteException e ) { // do nothing } return false ; }
checks whether a getter or setter exists on the specified type or any of
its super classes excluding Object. respects JsonIgnore accordingly.

@param type
@param field
@param fieldName
@param isSetter
@return
checks whether a getter or setter exists on the specified type or any of its super classes excluding Object . respects JsonIgnore accordingly .