class ObjectFunction {

   @FunctionMeta(description = "size of colection, or map", example = "${w:size(obj)}")
   public static Object size(Object obj) {
      if (obj == null) {
         return null;
      } else if (obj instanceof Collection) {
         return ((Collection<?>) obj).size();
      } else if (obj instanceof Map) {
         return ((Map<?, ?>) obj).size();
      } else {
         try {
            return Reflects.forMethod().invokeMethod(obj, "getSize", (Object[]) null);
         } catch (Exception e) {
            return null;
         }
      }
   }

}