Package org.neo4j.ogm.types.adapter
Class TemporalAmountAdapter
java.lang.Object
org.neo4j.ogm.types.adapter.TemporalAmountAdapter
- All Implemented Interfaces:
Function<TemporalAmount,TemporalAmount>
public class TemporalAmountAdapter
extends Object
implements Function<TemporalAmount,TemporalAmount>
This adapter maps a Driver or embedded based
In cases a user has used Cypher and its
The Java Driver uses a
TemporalAmount to a valid Java temporal amount. It tries
to be as specific as possible: If the amount can be reliable mapped to a Period, it returns
a period. If only fields are present that are no estimated time unites, than it returns a Duration.
In cases a user has used Cypher and its
duration() function, i.e. like so
CREATE (s:SomeTime {isoPeriod: duration('P13Y370M45DT25H120M')}) RETURN s
a duration object has been created that cannot be represented by either a Period or Duration. The user
has to map it to a plain TemporalAmount in this cases.
The Java Driver uses a
org.neo4j.driver.v1.types.IsoDuration, embedded uses
org.neo4j.values.storable.DurationValue for representing a temporal amount, but in the end, they can be
treated the same.
However be aware that the temporal amount returned in that case may not be equal to the other one, only represents
the same amount after normalization.- Author:
- Michael J. Simons
-
Constructor Details
-
TemporalAmountAdapter
public TemporalAmountAdapter()
-
-
Method Details
-
apply
- Specified by:
applyin interfaceFunction<TemporalAmount,TemporalAmount>
-