-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: coercion on json pointer values (#1178)
* FIX: coercion on jsonpointer values Signed-off-by: Chen <[email protected]> * MAINT: compactify type checking Signed-off-by: Chen <[email protected]> * STY: unused import Signed-off-by: Chen <[email protected]> * ENH: use bean injection instead of static variable Signed-off-by: Chen <[email protected]> * STY: unused import Signed-off-by: Chen <[email protected]>
- Loading branch information
1 parent
5ebe995
commit 02a9050
Showing
4 changed files
with
128 additions
and
31 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
.../main/java/org/opensearch/dataprepper/expression/LiteralTypeConversionsConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.expression; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
|
||
import javax.inject.Named; | ||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
@Named | ||
class LiteralTypeConversionsConfiguration { | ||
@Bean | ||
public Map<Class<? extends Serializable>, Function<Object, Object>> literalTypeConversions() { | ||
return new HashMap<Class<? extends Serializable>, Function<Object, Object>>() {{ | ||
put(String.class, Function.identity()); | ||
put(Boolean.class, Function.identity()); | ||
put(Integer.class, Function.identity()); | ||
put(Float.class, Function.identity()); | ||
put(Double.class, o -> ((Double) o).floatValue()); | ||
}}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters