From d306200c1ae6231cae706131260d4c8e7de18f57 Mon Sep 17 00:00:00 2001 From: p29876 <165825455+p29876@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:15:57 +0000 Subject: [PATCH] Gh-63 Add new Java type helpers 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.