Transformer findTransformer(Class key, Class originalKey) {

        if(key == null) return null;

        // if specific type found
        if (containsKey(key)) {
            if(key != originalKey) {
                return updateTransformers(originalKey, get(key));
            } else {
                return get(key);
            }
        }

        // handle arrays specially if no specific array type handler
        // Arrays.class is used for this because it would never appear
        // in an object that needs to be serialized.
        if (key.isArray()) {
            return updateTransformers(originalKey, get(Arrays.class));
        }

        // check for interface transformer
        for (Class interfaze : key.getInterfaces()) {

            if (containsKey(interfaze)) {
                return updateTransformers(originalKey, get(interfaze));
            } else {
                Transformer t = findTransformer( interfaze, originalKey );
                if( t != null ) return t;
            }
        }

        // if no interface transformers then check superclass
        return findTransformer(key.getSuperclass(), originalKey);

    }