I suspect that few if any people have actually tried to implement
their own fields.

In theory, you just need your own DurationFieldType and DurationField.
There is no need for your own Chronlogy. The DurationField does the
actual work of calculation. You can probably do all the calculations
simply by calling on to the month field of the chronology you are
given (multiplying everything by 3).

Stephen


On 15 August 2013 11:44, Przemysław Sokół <falcon...@gmail.com> wrote:
> I'm trying to supply my application with my own DurationFieldType -
> QuarterDurationFieldType - that will represent a quarter of a year. In the
> Javadoc I've found that:
>
> "If required, you can create your own field, for example a quarters. You
> must create a subclass of DurationFieldType that defines the field type.
> This class returns the actual calculation engine from getField(Chronology)."
> source:
> http://joda-time.sourceforge.net/apidocs/org/joda/time/DurationFieldType.html
>
> I've done so, but I'm a little bit confused of how to implement it right.
> Should I implement my own Chronology or just a DurationField (for the sake
> of getField's returned value)? Also, I'm not quite sure where and how should
> I specify how long the single quarter lasts. Should it be rather calculated
> using milliseconds or derived from year and month data somehow?
>
> Thank you for help in advance.
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to