@@ -2612,6 +2612,7 @@ public Parameters withParams(List<JRightPadded<J>> parameters) {
2612
2612
@ EqualsAndHashCode (callSuper = false , onlyExplicitlyIncluded = true )
2613
2613
@ Data
2614
2614
final class Literal implements J , Expression {
2615
+
2615
2616
@ EqualsAndHashCode .Include
2616
2617
UUID id ;
2617
2618
@@ -2626,8 +2627,13 @@ final class Literal implements J, Expression {
2626
2627
Object value ;
2627
2628
2628
2629
@ With
2630
+ @ Nullable
2629
2631
String valueSource ;
2630
2632
2633
+ @ With
2634
+ @ Nullable
2635
+ ModifiedUtf8Surrogate modifiedUtf8Surrogate ;
2636
+
2631
2637
/**
2632
2638
* Including String literals
2633
2639
*/
@@ -2640,7 +2646,7 @@ public Literal withType(@Nullable JavaType type) {
2640
2646
return this ;
2641
2647
}
2642
2648
if (type instanceof JavaType .Primitive ) {
2643
- return new Literal (id , prefix , markers , value , valueSource , (JavaType .Primitive ) type );
2649
+ return new Literal (id , prefix , markers , value , valueSource , modifiedUtf8Surrogate , (JavaType .Primitive ) type );
2644
2650
}
2645
2651
return this ;
2646
2652
}
@@ -2655,23 +2661,19 @@ public Coordinates.Literal getCoordinates() {
2655
2661
return new Coordinates .Literal (this );
2656
2662
}
2657
2663
2658
- public <T > String transformValue (Function <T , Object > transform ) {
2659
- Matcher valueMatcher = Pattern .compile ("(.*)" + Pattern .quote (value == null ? "null" : value .toString ()) + "(.*)" )
2660
- .matcher (printTrimmed ().replace ("\\ " , "" ));
2661
- if (valueMatcher .find ()) {
2662
- String prefix = valueMatcher .group (1 );
2663
- String suffix = valueMatcher .group (2 );
2664
-
2665
- //noinspection unchecked
2666
- return prefix + transform .apply ((T ) value ) + suffix ;
2667
- }
2668
- throw new IllegalStateException ("Encountered a literal `" + this + "` that could not be transformed" );
2669
- }
2670
-
2671
2664
@ Override
2672
2665
public String toString () {
2673
2666
return "Literal(" + LiteralToString .toString (this ) + ")" ;
2674
2667
}
2668
+
2669
+ @ Value
2670
+ public static class ModifiedUtf8Surrogate {
2671
+ @ With
2672
+ String escapeSequence ;
2673
+
2674
+ @ With
2675
+ String codePoint ;
2676
+ }
2675
2677
}
2676
2678
2677
2679
@ ToString
0 commit comments