class ObjectFunction {

   @FunctionMeta(description = "Check if the value is equal or is one of value in the given values.", example = "${w:in(values, value)}")
   @SuppressWarnings("unchecked")
   public static boolean in(Object values, Object value) {
      if (values == null || value == null) {
         return false;
      }

      if (values instanceof List) {
         for (Object v : (List<Object>) values) {
            if (v != null && value.toString().equals(v.toString())) {
               return true;
            }
         }

         return false;
      } else if (values.getClass().isArray()) {
         int len = Array.getLength(values);

         for (int i = 0; i < len; i++) {
            Object v = Array.get(values, i);

            if (v != null && value.toString().equals(v.toString())) {
               return true;
            }
         }

         return false;
      } else {
         return values.toString().equals(value.toString());
      }
   }

}