code: public static <T> T implement(Class<T> type, Object object)
      {
          if (type.isInstance(object)) return type.cast(object);
  
          return type.cast(Proxy.newProxyInstance(type.getClassLoader(),
                  new Class[]{type}, new DuckType(object)));
      }
docs: Causes object to implement the interfaceToImplement and returns
  an instance of the object implementing interfaceToImplement even
  if interfaceToImplement was not declared in object.getClass()'s
  implements declaration.
  <p/>
  This works as long as all methods declared in interfaceToImplement
  are present on object.
  
  @param type   The Java class of the interface to implement
  @param object The object to force to implement interfaceToImplement
  @param <T> a T object.
  @return a T object.