-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor JacksonJodaFormat classes to make it possible to implement more factory methods.
- Loading branch information
Showing
6 changed files
with
208 additions
and
10 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/java/com/fasterxml/jackson/datatype/joda/cfg/BaseFormatSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.fasterxml.jackson.datatype.joda.cfg; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* Class that holds the state of {@link JacksonJodaFormatBase} object. | ||
* @see JacksonJodaFormatBase#JacksonJodaFormatBase(BaseFormatSetup) | ||
* @see JacksonJodaFormatBase#getSetup() | ||
* @since 2.8 | ||
*/ | ||
public class BaseFormatSetup { | ||
|
||
private Boolean _useTimestamp; | ||
|
||
private Locale _locale; | ||
|
||
public BaseFormatSetup(){ | ||
|
||
} | ||
|
||
public BaseFormatSetup(BaseFormatSetup setup){ | ||
this._useTimestamp = setup.isUseTimestamp(); | ||
this._locale = setup._locale; | ||
} | ||
|
||
public Locale getLocale() { | ||
return _locale; | ||
} | ||
|
||
public void setLocale(Locale locale) { | ||
this._locale = locale; | ||
} | ||
|
||
public Boolean isUseTimestamp() { | ||
return _useTimestamp; | ||
} | ||
|
||
public void setUseTimeStamp(Boolean useTimestamp) { | ||
this._useTimestamp = useTimestamp; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/fasterxml/jackson/datatype/joda/cfg/DateFormatSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.fasterxml.jackson.datatype.joda.cfg; | ||
|
||
import org.joda.time.format.DateTimeFormatter; | ||
|
||
import java.util.TimeZone; | ||
|
||
/** | ||
* Class that holds the state of {@link JacksonJodaDateFormat} object. | ||
* @see JacksonJodaDateFormat#JacksonJodaDateFormat(DateFormatSetup) | ||
* @see JacksonJodaDateFormat#getSetup() | ||
* @since 2.8 | ||
*/ | ||
public class DateFormatSetup extends BaseFormatSetup { | ||
|
||
private DateTimeFormatter _formatter; | ||
|
||
private TimeZone _timeZone; | ||
|
||
public DateFormatSetup() { | ||
|
||
} | ||
|
||
public DateFormatSetup(BaseFormatSetup format) { | ||
super(format); | ||
} | ||
|
||
public DateTimeFormatter getFormatter() { | ||
return _formatter; | ||
} | ||
|
||
public void setFormatter(DateTimeFormatter formatter) { | ||
this._formatter = formatter; | ||
} | ||
|
||
public TimeZone getTimeZone() { | ||
return _timeZone; | ||
} | ||
|
||
public void setTimeZone(TimeZone timeZone) { | ||
this._timeZone = timeZone; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/fasterxml/jackson/datatype/joda/cfg/PeriodFormatSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.fasterxml.jackson.datatype.joda.cfg; | ||
|
||
import org.joda.time.format.PeriodFormatter; | ||
|
||
/** | ||
* Class that holds the state of {@link JacksonJodaPeriodFormat} object. | ||
* @see JacksonJodaPeriodFormat#JacksonJodaPeriodFormat(PeriodFormatSetup) | ||
* @see JacksonJodaPeriodFormat#getSetup() | ||
* @since 2.8 | ||
*/ | ||
public class PeriodFormatSetup extends BaseFormatSetup { | ||
|
||
private PeriodFormatter _formatter; | ||
|
||
public PeriodFormatSetup() { | ||
|
||
} | ||
|
||
public PeriodFormatSetup(BaseFormatSetup setup) { | ||
super(setup); | ||
} | ||
|
||
public PeriodFormatter getFormatter() { | ||
return _formatter; | ||
} | ||
|
||
public void setFormatter(PeriodFormatter formatter) { | ||
this._formatter = formatter; | ||
} | ||
} |