test_class.file: recipe-generator/src/test/java/ca/derekcormier/recipe/generator/filter/JavaValueFilterTest.java
test_class.identifier: JavaValueFilterTest
test_case.body: @Test
    public void testApply_convertsArrayOfEnums() {
      Cookbook cookbook =
          new Cookbook(
              "test",
              new ArrayList<>(),
              Lists.newArrayList(new Enum("MyEnum", Lists.newArrayList("A", "B", "C"))));
      Filter filter = new JavaValueFilter(cookbook);
  
      assertEquals(
          "new MyEnum[]{MyEnum.A, MyEnum.B, MyEnum.C}",
          filter.apply(Lists.newArrayList("A", "B", "C"), "MyEnum[]"));
    }
test_case.class_method_signature: JavaValueFilterTest.testApply_convertsArrayOfEnums()
test_case.full_signature: @Test public void testApply_convertsArrayOfEnums()
test_case.identifier: testApply_convertsArrayOfEnums
test_case.invocations: newArrayList newArrayList assertEquals apply newArrayList
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testApply_convertsArrayOfEnums()
focal_class.file: recipe-generator/src/main/java/ca/derekcormier/recipe/generator/filter/JavaValueFilter.java
focal_class.identifier: JavaValueFilter
focal_class.class_method_signature: JavaValueFilter.JavaValueFilter(Cookbook cookbook)
focal_class.full_signature: public  JavaValueFilter(Cookbook cookbook)
focal_class.identifier: JavaValueFilter
focal_class.modifiers: public
focal_class.parameters: (Cookbook cookbook)
focal_class.signature:  JavaValueFilter(Cookbook cookbook)
focal_class.class_method_signature: JavaValueFilter.apply(Object value, Object... params)
focal_class.full_signature: @Override public Object apply(Object value, Object... params)
focal_class.identifier: apply
focal_class.modifiers: @Override public
focal_class.parameters: (Object value, Object... params)
focal_class.return: Object
focal_class.signature: Object apply(Object value, Object... params)
focal_class.superclass: extends RecipeFilter
focal_method.body: @Override
    public Object apply(Object value, Object... params) {
      if (params.length != 1) {
        throw new IllegalArgumentException("must pass a type parameter to " + name);
      }
  
      String strType = super.asString(params[0]);
      ParamType paramType = CookbookUtils.parseType(strType, getCookbook());
      Type type = paramType.getType();
  
      if (paramType.isVararg() || type instanceof ArrayType) {
        Type baseType = paramType.isVararg() ? type : ((ArrayType) type).getBaseType();
  
        String values =
            StringUtil.join(
                ((List<Object>) value)
                    .stream().map(v -> apply(v, baseType.name())).collect(Collectors.toList()),
                ", ");
  
        return "new " + new JavaTypeFilter(getCookbook()).apply(strType, true) + "{" + values + "}";
      } else if (type instanceof PrimitiveType) {
        PrimitiveType primitive = (PrimitiveType) type;
        switch (primitive.getPrimitive()) {
          case BOOLEAN:
            return super.asString(value);
          case INTEGER:
            return super.asString(value);
          case FLOAT:
            return super.asString(value) + "f";
          case STRING:
            return value == null ? "null" : "\"" + super.asString(value).replace("\"", "\\\"") + "\"";
          default:
            throw new IllegalArgumentException("unknown primitive type " + type.name());
        }
      } else if (type instanceof EnumType) {
        return type.name() + "." + super.asString(value);
      }
  
      return super.asString(value);
    }
focal_method.class_method_signature: JavaValueFilter.apply(Object value, Object... params)
focal_method.full_signature: @Override public Object apply(Object value, Object... params)
focal_method.identifier: apply
focal_method.invocations: asString parseType getCookbook getType isVararg isVararg getBaseType join collect map stream apply name toList apply getCookbook getPrimitive asString asString asString replace asString name name asString asString
focal_method.modifiers: @Override public
focal_method.parameters: (Object value, Object... params)
focal_method.return: Object
focal_method.signature: Object apply(Object value, Object... params)