diff --git a/rewrite-java/src/main/java/org/openrewrite/java/trait/Literal.java b/rewrite-java/src/main/java/org/openrewrite/java/trait/Literal.java index 8302740949b..07c8715eeed 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/trait/Literal.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/trait/Literal.java @@ -54,6 +54,10 @@ public boolean isNotNull() { return !isNull(); } + public String getString() { + return getValue(String.class); + } + public <@Nullable T> T getValue(Class type) { return getValue(mapper.constructType(type)); }