Skip to content

Commit 95a42d0

Browse files
committed
no need of parent-first, this is the default behaviour ref #1167 ref #1171
1 parent dea1fd4 commit 95a42d0

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

handlebars/src/main/java/com/github/jknack/handlebars/ValueResolver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public interface ValueResolver {
5757
/**
5858
* Default value resolvers. Including:
5959
*
60-
* <p>- {@link MapValueResolver} - {@link JavaBeanValueResolver} - {@link MethodValueResolver}. On
61-
* Java 14 or higher.
60+
* <p>- {@link MapValueResolver} - {@link JavaBeanValueResolver} - {@link MethodValueResolver}.
6261
*
6362
* @return Immutable list of value resolvers.
6463
*/

handlebars/src/test/java/com/github/jknack/handlebars/i1163/Issue1163.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
package com.github.jknack.handlebars.i1163;
77

8-
import java.awt.*;
98
import java.io.IOException;
109
import java.util.List;
1110

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Handlebars.java: https://github.com/jknack/handlebars.java
3+
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
4+
* Copyright (c) 2012 Edgar Espina
5+
*/
6+
package com.github.jknack.handlebars.i1167;
7+
8+
import java.io.IOException;
9+
10+
import org.junit.jupiter.api.Test;
11+
12+
import com.github.jknack.handlebars.v4Test;
13+
14+
public class Issue1167 extends v4Test {
15+
16+
@Test
17+
public void shouldResolveChildProperty() throws IOException {
18+
shouldCompileTo(
19+
"{{typeName}}{{#with prop.arrayItems}} {{typeName}}{{/with}}",
20+
$("hash", $("typeName", "ParentType", "prop", $("arrayItems", $("typeName", "ChildType")))),
21+
"ParentType ChildType");
22+
}
23+
24+
record CodegenType(String typeName) {}
25+
26+
@Test
27+
public void shouldResolveChildPropertyOnRecord() throws IOException {
28+
shouldCompileTo(
29+
"{{typeName}}{{#with prop.arrayItems}} {{typeName}}{{/with}}",
30+
$(
31+
"hash",
32+
$("typeName", "ParentType", "prop", $("arrayItems", new CodegenType("ChildType")))),
33+
"ParentType ChildType");
34+
}
35+
}

0 commit comments

Comments
 (0)