litesoft
@ 898
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 99 100 101 102 103 104 105 106 107 |
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! */ @SuppressWarnings("UnusedDeclaration") public final class CalendarY extends AbstractCalendarY<CalendarY, AbstractCalendarY.Mutable> implements SQLdateable { private static final long serialVersionUID = 1L; private int mYear; @Override public int getYear() { return mYear; } public CalendarY( int pYear ) { mYear = pYear; } @SuppressWarnings({"deprecation", "UnusedDeclaration"}) @Deprecated /** for Serialization */ protected CalendarY() { this( 0 ); } 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.wall( 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
Revision | Author | Commited | Message |
---|---|---|---|
898 Diff | GeorgeS | Sun 17 Mar, 2013 21:46:33 +0000 | Temporal!!! |
897 Diff | GeorgeS | Mon 25 Feb, 2013 02:04:34 +0000 | |
893 Diff | GeorgeS | Mon 14 Jan, 2013 01:18:30 +0000 | |
864 Diff | GeorgeS | Mon 19 Nov, 2012 01:48:25 +0000 | |
862 Diff | GeorgeS | Thu 15 Nov, 2012 02:23:36 +0000 | On the Way... |
861 Diff | GeorgeS | Mon 05 Nov, 2012 13:55:32 +0000 | |
859 | GeorgeS | Mon 05 Nov, 2012 01:26:38 +0000 |