Package org.apache.calcite.util.format
Interface FormatElement
- All Known Implementing Classes:
- FormatElementEnum
public interface FormatElement
A format element in a format string. Knows how to parse and unparse itself.
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidflatten(Consumer<FormatElement> consumer) Applies a consumer to a format element.voidformat(StringBuilder sb, Date date) Formats a date to its appropriate string representation for the element.Returns the description of an element.voidAdds the appropriateSimpleDateFormatpattern for the element to provided StringBuilder.
- 
Method Details- 
formatFormats a date to its appropriate string representation for the element.
- 
toPatternAdds the appropriateSimpleDateFormatpattern for the element to provided StringBuilder.Note that certain FormatElements may not have a Java equivalent. In such cases, calling this method will throw an UnsupportedOperationException. SeeFormatElementEnum.Qas an example.- Throws:
- UnsupportedOperationException
 
- 
getDescriptionString getDescription()Returns the description of an element.For example, %Hin MySQL represents the hour in 24-hour format (e.g., 00..23). This method returns the string "The hour (24-hour clock) as a decimal number (00-23)", which is the description ofFormatElementEnum.HH24.
- 
flattenApplies a consumer to a format element.
 
-