code: @Override
      public final $.Function<T, Boolean> filter(Map<String, Object> options, BeanSpec container) {
          $.Var<ElementType> typeVar = $.var((ElementType) options.get("elementType"));
          final Class baseClass = targetClass(typeVar, options, container);
          final ElementType elementType = typeVar.get();
          final boolean loadNonPublic = (Boolean)options.get("loadNonPublic");
          final boolean loadAbstract = elementType.loadAbstract() && (Boolean) options.get("loadAbstract");
          final boolean loadRoot = (Boolean) options.get("loadRoot");
          return new $.Predicate<T>() {
              @Override
              public boolean test(T o) {
                  if (elementType == ElementType.BEAN) {
                      Class<?> c = o.getClass();
                      return (loadNonPublic || Modifier.isPublic(c.getModifiers()))
                              && (baseClass.isAssignableFrom(c)
                              && (loadRoot || baseClass != c)
                      );
                  } else {
                      if (o instanceof Class) {
                          Class c = (Class) o;
                          int modifiers = c.getModifiers();
                          boolean yes = loadNonPublic || Modifier.isPublic(modifiers);
                          yes = yes && (loadAbstract || !Modifier.isAbstract(modifiers));
                          yes = yes && baseClass.isAssignableFrom(c);
                          yes = yes && (loadRoot || baseClass != c);
                          return yes;
                      }
                      return false;
                  }
              }
          };
      }
docs: This method returns a predicate function that test the bean instance against the
  class specified by `hint`. If the bean is an instance of the `hint` class, then
  the predicate function returns `true` otherwise it returns `false`
  
  @param options   must contains an entry indexed with "value" and the value should be a Class type
  @param container the bean spec of the container into which the element will be loaded
  @return a predicate function whose behavior is described above