|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.mvcsys.rsql.RsqlDate
Klasse zur Darstellung von Datum/Timestamp als Zeichenketten. Es wird die rein numerische und die SQL-Darstellung unterstützt Die einzelnen Subfelder sind zugreifbar, für Berechnungen wird ein java.util.Calendar-Objekt gespeichert.
Field Summary | |
protected static SimpleDateFormat |
defaultFormatter
Formatierungshilfe (Default) |
static int |
F_DAY
Erste Stelle ist der Tag |
static int |
F_FRACTION
Erste Stelle ist der Bruchteil |
static int |
F_HOUR
Erste Stelle ist die Stunde |
static int |
F_MINUTE
Erste Stelle ist die Minute |
static int |
F_MONTH
Erste Stelle ist der Monat |
static int |
F_SECOND
Erste Stelle ist die Sekunde |
static int |
F_YEAR
Erste Stelle ist das Jahr |
protected int |
first
1. |
protected static DecimalFormat |
microFormatter
Formatierungshilfe (Microsekunden) |
protected int |
micros
Mikrosekunden |
protected int |
precision
Anzahl der Nachkommastellen der Sekunden. |
protected int |
size
Anzahl der Stellen (Ziffern ohne Trennzeichen) |
protected static SimpleDateFormat |
sqlFormatter
Formatierungshilfe (SQL-Format) |
protected static int[] |
sqlOffsets
Start-Offsets für SQL-Darstellung |
protected int |
sqlSize
Anzahl der Stellen (Ziffern mit Trennzeichen) |
protected String |
sqlText
String im Format "yyyy-MM-dd:HH:mm:ss..." |
protected String |
text
String im Format "yyyyMMddHHmmss..." |
protected static SimpleDateFormat |
textFormatter
Formatierungshilfe (internes Format) |
protected static int[] |
textOffsets
Start-Offsets für Text-Darstellung |
protected SimpleDateFormat |
toStringFormatter
Formatierungshilfe (für toString()) |
protected Calendar |
value
Wert als Calendar-Object |
Constructor Summary | |
RsqlDate()
Default-Konstruktor. |
|
RsqlDate(byte[] value,
int offset,
int size)
Konstruktor mit Byte-Array, Länge und Skalierung. |
|
RsqlDate(Date value)
Konstruktor mit Date-Objekt. |
|
RsqlDate(Date value,
int precision)
Konstruktor mit Date-Objekt und Precision. |
|
RsqlDate(Date value,
int micros,
int precision)
Konstruktor mit Date-Objekt, Mikrosekunden und precision. |
|
RsqlDate(long value)
Konstruktor mit Juliantimestamp. |
|
RsqlDate(String value)
Konstruktor mit String. |
|
RsqlDate(String value,
int first)
Konstruktor mit String. |
Method Summary | |
void |
dump()
Debug-Ausgabe des Objekts |
void |
getBytes(byte[] dest,
int offset)
Gebe den Zahlenstring als Bytes zurück |
int |
getPrecision()
Ermittle die Skalierung |
int |
getSize()
Ermittle die Anzahl der Stellen |
void |
getSqlBytes(byte[] dest,
int offset)
Gebe den SQL-Text als Bytes zurück |
int |
getSqlSize()
Ermittle die Anzahl der Stellen des SQL-Textes |
String |
getSqlText()
Gebe den SQL-Text zurück |
String |
getText()
Gebe den Zahlenstring zurück |
Date |
getTime()
Ermittle die Zeit |
Calendar |
getValue()
Ermittle den Wert |
protected void |
init(Date date,
int micros,
int precision)
Worker für Konstruktor |
protected void |
init(String string,
int first)
Worker für Konstruktor |
static void |
main(String[] args)
Test-Hauptprogramm |
void |
setFirst(int first)
Setze die erste Stelle |
void |
setFormat(String format)
Setze den Format-String für toString() Beispiel "yyyy-MM-dd:HH:mm:ss" |
void |
setValue(byte[] value,
int offset)
Setze den Wert aus einem Byte-Array |
void |
setValue(byte[] value,
int offset,
int size)
Setze den Wert aus einem Zahlen-Byte-Array Die Länge wird übergeben |
void |
setValue(Date value)
Setze den Wert aus einem Date-Objekt. |
void |
setValue(Date value,
int micros)
Setze den Wert aus einem Date-Objekt und Mikrosekunden |
void |
setValue(String value)
Setze den Wert aus einem Zahlenstring Wenn der String mit 4 Ziffern und einem "-" beginnt, dann wird ein SQL-Timestamp angenommen Besteht der String nur aus Zahlen, dann hat er das Format von text |
String |
toString()
Implementierung von Object.toString() |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static SimpleDateFormat defaultFormatter
public static final int F_DAY
public static final int F_FRACTION
public static final int F_HOUR
public static final int F_MINUTE
public static final int F_MONTH
public static final int F_SECOND
public static final int F_YEAR
protected int first
protected static final DecimalFormat microFormatter
protected int micros
protected int precision
protected int size
protected static SimpleDateFormat sqlFormatter
protected static final int[] sqlOffsets
protected int sqlSize
protected String sqlText
protected String text
protected static SimpleDateFormat textFormatter
protected static final int[] textOffsets
protected SimpleDateFormat toStringFormatter
protected Calendar value
Constructor Detail |
public RsqlDate()
public RsqlDate(byte[] value, int offset, int size) throws ParseException, StringIndexOutOfBoundsException
value
- Byte-Array mit Zahlenstringoffset
- Offset innerhalb des Arrayssize
- Anzahl der StellenParseException
- Ungültige Zeichen im ArrayStringIndexOutOfBoundsException
- Array ist zu kurzpublic RsqlDate(Date value)
value
- Datum/Timestamp als Date-Objektpublic RsqlDate(Date value, int precision) throws IllegalArgumentException
value
- Datum/Timestamp als Date-Objektprecision
- Nachkommastellen der SekundenIllegalArgumentException
- Überlauf in precisionpublic RsqlDate(Date value, int micros, int precision) throws IllegalArgumentException
value
- Datum/Timestamp als Date-Objektmicros
- Mikrosekunden ganze Zahlprecision
- Nachkommastellen der SekundenIllegalArgumentException
- Überlauf in precisionpublic RsqlDate(long value) throws IllegalArgumentException
value
- Juliantimestamp oder ms seit 1970.
Die Unterscheidung erfolgt nach dem WertIllegalArgumentException
- Überlauf in precisionpublic RsqlDate(String value) throws ParseException
text
value
- Wert als ZeichenketteParseException
- Ungültiger Stringpublic RsqlDate(String value, int first) throws ParseException
text
value
- Wert als Zeichenkettefirst
- F_...-Konstante für den BeginnParseException
- Ungültiger StringMethod Detail |
public void dump()
public void getBytes(byte[] dest, int offset)
public int getPrecision()
public int getSize()
public void getSqlBytes(byte[] dest, int offset)
public int getSqlSize()
public String getSqlText()
public String getText()
public Date getTime()
getValue()
.getTime()
public Calendar getValue()
protected void init(Date date, int micros, int precision) throws IllegalArgumentException
value
- Wert als Date-Objektmicros
- Micro-Sekundenprecision
- Skalierung (positiv oder negativ)IllegalArgumentException
- Überlauf in precisionprotected void init(String string, int first) throws ParseException
value
- Wert als Stringfirst
- Anfang der ZeichenketteParseException
- Ungültige Zeichen im Stringpublic static void main(String[] args) throws ParseException
public void setFirst(int first)
first
- eine der F_...-Konstantenpublic void setFormat(String format)
format
- FormatString (siehe java.text.SimpleDateFormat)public void setValue(byte[] value, int offset) throws ParseException
value
- Wert als Byte-Arrayoffset
- Offset innerhalb des ArraysParseException
- Ungültige Zeichen im Arraypublic void setValue(byte[] value, int offset, int size) throws ParseException
value
- Unskalierter Wert als Byte-Arrayoffset
- Offset innerhalb des Arrayssize
- Länge innerhalb des ArraysParseException
- Ungültige Zeichen im Arraypublic void setValue(Date value)
value
- Datum/Timestamp als Date-Objektpublic void setValue(Date value, int micros)
value
- Datum/Timestamp als Date-Objektpublic void setValue(String value) throws ParseException
text
value
- Wert als ZeichenketteParseException
- Ungültiger Stringpublic String toString()
toString
in class Object
setFormat(String)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |