Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package org.litesoft.core.simpletypes.temporal;

import org.litesoft.core.*;

/**
 * A Calendar Year, or partial "date" with resolution only to the Year ("Wall" relative).
 * <p/>
 * Note: This class supports Gregorian dates only and has no concept of time or TimeZones.  As such when working with
 * Java Util Date(s) (or it's descendants) the local (or "Wall") date is all that is considered!
 */
public final class CalendarY extends AbstractCalendarY<CalendarY, AbstractCalendarY.Mutable> implements SQLdateable
{
    private static final long serialVersionUID = 1L;

    @SuppressWarnings({"deprecation", "UnusedDeclaration"}) @Deprecated /** for Serialization */
    protected CalendarY()
    {
        this( 0 );
    }

    public CalendarY( int pYear )
    {
        super( pYear );
    }

    public CalendarY( CalendarAccessorY pAccessor )
    {
        this( pAccessor.getYear() );
    }

    @Override
    public TemporalResolution getResolution()
    {
        return TemporalResolution.ToYear;
    }

    @Override
    public String toString()
    {
        return YearFormatAccessor.get().format( this );
    }

    public static String toString( CalendarY pCalendar )
    {
        return (pCalendar != null) ? pCalendar.toString() : null;
    }

    public static String toY( CalendarY pCalendar )
    {
        return (pCalendar != null) ? pCalendar.toY() : null;
    }

    public String toY()
    {
        return formatSortableDisplayFormY( this, new StringBuilder() ).toString();
    }

    public static CalendarY fromY( String pToY )
            throws IllegalArgumentException
    {
        return fromStringForm( pToY );
    }

    public final String toSQLvalue()
    {
        return formatSQLvalueY( this, new StringBuilder() ).toString();
    }

    public static CalendarY fromSQLvalue( String pToSQLvalue )
    {
        return fromStringForm( pToSQLvalue );
    }

    private static CalendarY fromStringForm( String pStringForm )
    {
        return pStringForm == null ? null : new CalendarY( parseYear( pStringForm, pStringForm.trim() ) );
    }

    @Override
    public UtilDateAdaptor toUtilDateAdaptor()
    {
        return UtilDateAdaptor.currentWall( getYear() );
    }

    // vvvvvvvvvvvvvvvvvv Support methods vvvvvvvvvvvvvvvvv

    @Override
    protected CalendarY createTypeFrom( Mutable pMutable )
    {
        return new CalendarY( pMutable.getYear() );
    }

    @Override
    protected Mutable createMutable( int pNewYear )
    {
        return new Mutable( pNewYear );
    }
}

Commits for litesoft/trunk/Java/core/Anywhere/src/org/litesoft/core/simpletypes/temporal/CalendarY.java

Diff revisions: vs.
Revision Author Commited Message
912 Diff Diff GeorgeS picture GeorgeS Fri 28 Jun, 2013 06:48:05 +0000

Revert to mixed & Working (PEDS & Prioritizer) code!

898 Diff Diff GeorgeS picture GeorgeS Sun 17 Mar, 2013 21:46:33 +0000

Temporal!!!

897 Diff Diff GeorgeS picture GeorgeS Mon 25 Feb, 2013 02:04:34 +0000
893 Diff Diff GeorgeS picture GeorgeS Mon 14 Jan, 2013 01:18:30 +0000
864 Diff Diff GeorgeS picture GeorgeS Mon 19 Nov, 2012 01:48:25 +0000
862 Diff Diff GeorgeS picture GeorgeS Thu 15 Nov, 2012 02:23:36 +0000

On the Way...

861 Diff Diff GeorgeS picture GeorgeS Mon 05 Nov, 2012 13:55:32 +0000
859 GeorgeS picture GeorgeS Mon 05 Nov, 2012 01:26:38 +0000