Skip to content

Commit 4da5ca9

Browse files
committed
version bump and javadoc
1 parent f09b211 commit 4da5ca9

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@
146146
<plugin>
147147
<groupId>org.apache.maven.plugins</groupId>
148148
<artifactId>maven-checkstyle-plugin</artifactId>
149-
<version>3.3.1</version>
149+
<version>3.6.0</version>
150150
<configuration>
151-
<!-- Use Google's standard Java style guide -->
152151
<configLocation>google_checks.xml</configLocation>
153152
<encoding>UTF-8</encoding>
154153
<consoleOutput>true</consoleOutput>
@@ -157,7 +156,7 @@
157156
</configuration>
158157
<executions>
159158
<execution>
160-
<id>validate</id>
159+
<id>check-style</id>
161160
<phase>validate</phase>
162161
<goals>
163162
<goal>check</goal>

samples/bookshop/srv/src/main/java/customer/bookshop/handlers/CatalogServiceHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ public void discountBooks(Stream<Books> books) {
6060
.forEach(b -> b.setTitle(b.getTitle() + " (discounted)"));
6161
}
6262

63-
}
63+
}

srv/src/main/java/sap/capire/emoji_template/EmojiHandler.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package sap.capire.emoji_template;
22

3-
import java.util.HashSet;
4-
import java.util.Set;
5-
import java.util.stream.Collectors;
6-
73
import com.sap.cds.Result;
84
import com.sap.cds.reflect.CdsElement;
95
import com.sap.cds.reflect.CdsStructuredType;
@@ -13,31 +9,36 @@
139
import com.sap.cds.services.handler.EventHandler;
1410
import com.sap.cds.services.handler.annotations.After;
1511
import com.sap.cds.services.handler.annotations.ServiceName;
12+
import java.util.HashSet;
13+
import java.util.Set;
14+
import java.util.stream.Collectors;
1615

16+
/**
17+
* Event handler that decorates fields annotated with @emoji by appending an emoji.
18+
*/
1719
@ServiceName(value = "*", type = ApplicationService.class)
1820
public class EmojiHandler implements EventHandler {
19-
2021
private static final String EMOJI_ANNOTATION_NAME = "@emoji";
2122

2223
@After(event = CqnService.EVENT_READ)
23-
public void decorateEmoji(CdsReadEventContext ctx) {
24+
public void decorateEmoji(final CdsReadEventContext ctx) {
2425

2526
ctx.getResult().list().forEach(row -> {
2627
Set<String> emojiAnnotatedElments = checkForEmojiAnnotatedElments(ctx.getResult());
2728
row.keySet().forEach(key -> {
28-
if(emojiAnnotatedElments.contains(key)) {
29+
if (emojiAnnotatedElments.contains(key)) {
2930
row.put(key, row.get(key) + " 🙃");
3031
}
3132
});
32-
}
33-
);
33+
});
3434
}
3535

36-
private Set<String> checkForEmojiAnnotatedElments(Result result) {
36+
private Set<String> checkForEmojiAnnotatedElments(final Result result) {
3737
Set<String> annotatedElementNames = new HashSet<>();
38-
CdsStructuredType rowType = result.rowType();//.annotations().anyMatch(anno -> anno.getName().equals("@emoji")))
39-
for(CdsElement element : rowType.elements().collect(Collectors.toList())) {
40-
if(element.findAnnotation(EMOJI_ANNOTATION_NAME).isPresent()) {
38+
CdsStructuredType rowType = result.rowType();// .annotations().anyMatch(anno ->
39+
// anno.getName().equals("@emoji")))
40+
for (CdsElement element : rowType.elements().collect(Collectors.toList())) {
41+
if (element.findAnnotation(EMOJI_ANNOTATION_NAME).isPresent()) {
4142
annotatedElementNames.add(element.getName());
4243
}
4344
}

0 commit comments

Comments
 (0)