Package ca.phon.session.format
Class AgeFormatter
java.lang.Object
ca.phon.session.format.AgeFormatter
@FormatterType(java.time.Period.class)
public class AgeFormatter
extends Object
implements Formatter<Period>
Create formatters for ages stored in
Period
objects.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
ageToString
(Period age) Format aPeriod
object as an age string.Convert the given object into a formatted String.Parse the given string into a new object instancestatic Period
stringToAge
(String text) Return an age string as aPeriod
object
-
Field Details
-
AGE_FORMAT
- See Also:
-
-
Constructor Details
-
AgeFormatter
public AgeFormatter()
-
-
Method Details
-
ageToString
Format aPeriod
object as an age string.- Parameters:
age
-- Returns:
- age as a string
-
stringToAge
Return an age string as aPeriod
object- Parameters:
text
-- Returns:
- age
- Throws:
IllegalArgumentException
- if the string is not formatted correctly
-
format
Description copied from interface:Formatter
Convert the given object into a formatted String. -
parse
Description copied from interface:Formatter
Parse the given string into a new object instance- Specified by:
parse
in interfaceFormatter<Period>
- Returns:
- parsed object
- Throws:
ParseException
- if there was a problem parsing the given text
-