summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-10-10 12:20:46 +0200
committerJon Bratseth <bratseth@gmail.com>2022-10-10 12:20:46 +0200
commitfcebd40eb93e31e0a6206215a5a27afd4c310c92 (patch)
treecefac472a23a0243bb04508c532613c8b16be52d /config-model
parent240a62de8a9b3c93fb9f7031f5e204264d414817 (diff)
Cleanup - no functional changes
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryTransform.java54
1 files changed, 17 insertions, 37 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryTransform.java b/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryTransform.java
index e94518c988d..d1d22886642 100644
--- a/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryTransform.java
+++ b/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryTransform.java
@@ -37,33 +37,20 @@ public enum SummaryTransform {
/** Returns the bolded version of this transform if possible, throws if not */
public SummaryTransform bold() {
- switch (this) {
- case NONE:
- case BOLDED:
- return BOLDED;
-
- case DYNAMICBOLDED:
- case DYNAMICTEASER:
- return DYNAMICBOLDED;
-
- default:
- throw new IllegalArgumentException("Can not bold a '" + this + "' field.");
- }
+ return switch (this) {
+ case NONE, BOLDED -> BOLDED;
+ case DYNAMICBOLDED, DYNAMICTEASER -> DYNAMICBOLDED;
+ default -> throw new IllegalArgumentException("Can not bold a '" + this + "' field.");
+ };
}
/** Returns the unbolded version of this transform */
public SummaryTransform unbold() {
- switch (this) {
- case NONE:
- case BOLDED:
- return NONE;
-
- case DYNAMICBOLDED:
- return DYNAMICTEASER;
-
- default:
- return this;
- }
+ return switch (this) {
+ case NONE, BOLDED -> NONE;
+ case DYNAMICBOLDED -> DYNAMICTEASER;
+ default -> this;
+ };
}
/** Returns whether this value is bolded */
@@ -83,23 +70,16 @@ public enum SummaryTransform {
/** Returns whether this transform always gets its value by accessing memory only */
public boolean isInMemory() {
- switch (this) {
- case ATTRIBUTE:
- case DISTANCE:
- case POSITIONS:
- case GEOPOS:
- case RANKFEATURES:
- case SUMMARYFEATURES:
- case ATTRIBUTECOMBINER:
- case MATCHED_ATTRIBUTE_ELEMENTS_FILTER:
- return true;
-
- default:
- return false;
- }
+ return switch (this) {
+ case ATTRIBUTE, DISTANCE, POSITIONS, GEOPOS, RANKFEATURES, SUMMARYFEATURES, ATTRIBUTECOMBINER, MATCHED_ATTRIBUTE_ELEMENTS_FILTER ->
+ true;
+ default -> false;
+ };
}
+ @Override
public String toString() {
return name;
}
+
}