From 737c955911a45fb89c8637cbe08d27a0c193a40b Mon Sep 17 00:00:00 2001 From: p29876 <165825455+p29876@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:06:42 +0000 Subject: [PATCH] Gh-63 Add new Java type helpers (#64) float and double --- src/gafferpy/gaffer_types.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/gafferpy/gaffer_types.py b/src/gafferpy/gaffer_types.py index 811bfaeb..01dc23d8 100755 --- a/src/gafferpy/gaffer_types.py +++ b/src/gafferpy/gaffer_types.py @@ -153,6 +153,32 @@ def long(value: int) -> Dict[str, int]: return {"java.lang.Long": value} +def float_(value: float) -> Dict[str, float]: + """ + Convert float value to an object that Gaffer can serialise into a Java Float type. + + Args: + value: Float value to convert + + Returns: + Dictionary that can be serialised to a Java Float. + """ + return {"java.lang.Float": value} + + +def double(value: float) -> Dict[str, float]: + """ + Convert float value to an object that Gaffer can serialise into a Java Double type. + + Args: + value: Float value to convert + + Returns: + Dictionary that can be serialised to a Java Double. + """ + return {"java.lang.Double": value} + + def date(value: int) -> Dict[str, int]: """ Convert integer value to an object that Gaffer can serialise into a Java Date type.