Class Pipes

java.lang.Object
io.inverno.mod.irt.Pipes

public final class Pipes extends Object

A collection of pipes used to transform basic values including: strings transformation, date formatting, number formatting, escaping...

Since:
1.2
Author:
Jeremy Kuhn
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a pipe which formats a number as an amount in the default locale currency.
    currency(int minIntegerDigits, int minFractionDigits, int maxFractionDigits)
    Returns a pipe which formats a number as an amount in the default locale currency according to the specified limits.
    currency(int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)
    Returns a pipe which formats a number as an amount in the specified locale currency according to the specified limits.
    currency(String currencyCode)
    Returns a pipe which formats a number as an amount in the specified currency using default locale format.
    currency(String currencyCode, int minIntegerDigits, int minFractionDigits, int maxFractionDigits)
    Returns a pipe which formats a number as an amount in the specified currency using default locale format according to the specified limits.
    currency(String currencyCode, int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)
    Returns a pipe which formats a number as an amount in the specified currency using the specified locale format according to the specified limits.
    currency(String currencyCode, Locale locale)
    Returns a pipe which formats a number as an amount in the specified currency using specified locale format.
    currency(Currency currency)
    Returns a pipe which formats a number as an amount in the specified currency using default locale format.
    currency(Currency currency, int minIntegerDigits, int minFractionDigits, int maxFractionDigits)
    Returns a pipe which formats a number as an amount in the specified currency using default locale format according to the specified limits.
    currency(Currency currency, int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)
    Returns a pipe which formats a number as an amount in the specified currency using the specified locale format according to the specified limits.
    currency(Currency currency, Locale locale)
    Returns a pipe which formats a number as an amount in the specified currency using the specified locale format.
    currency(Locale locale)
    Returns a pipe which formats a number as an amount in the specified locale currency.
    date(FormatStyle dateStyle)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date using the specified format style.
    date(FormatStyle dateStyle, Locale locale)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date using the specified format style and locale.
    dateTime(String pattern)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern.
    dateTime(String pattern, ZoneId zone)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern and zone.
    dateTime(String pattern, ZoneId zone, Locale locale)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern, zone and locale.
    dateTime(String pattern, Locale locale)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern and locale.
    Returns a pipe which formats a temporal object (date, time, date-time...) using the specified formatter.
    dateTime(FormatStyle dateTimeStyle)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style.
    dateTime(FormatStyle dateTimeStyle, ZoneId zone)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style and zone.
    dateTime(FormatStyle dateTimeStyle, ZoneId zone, Locale locale)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style, zone and locale.
    dateTime(FormatStyle dateTimeStyle, Locale locale)
    Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style and locale.
    Returns a pipe which escapes a string using HTML entities.
    Returns a pipe which escapes a string using Json string rules rules.
    Returns a pipe which escapes a string using XML entities.
    Returns a pipe which formats a number as an integer.
    integer(Locale locale)
    Returns a pipe which formats a number as an integer for the specified locale.
    Returns a pipe which converts all characters in a string to lower case.
    Returns a pipe which formats a number using the default format.
    number(int minIntegerDigits, int minFractionDigits, int maxFractionDigits)
    Returns a pipe which formats a number according to the specified limits.
    number(int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)
    Returns a pipe which formats a number for the specified locale according to the specified limits.
    number(NumberFormat formatter)
    Returns a pipe which formats a number using the specified format.
    number(Locale locale)
    Returns a pipe which formats a number using the format for the specified locale.
    Returns a pipe which formats a number as a percentage using default locale format.
    percent(int minIntegerDigits, int minFractionDigits, int maxFractionDigits)
    Returns a pipe which formats a number as a percentage using default locale format according to the specified limits.
    percent(int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)
    Returns a pipe which formats a number as a percentage using the specified locale format according to the specified limits.
    percent(Locale locale)
    Returns a pipe which formats a number as a percentage using the specified locale format.
    Returns a pipe which changes the first character in a string to title case.
    Returns a pipe which converts all characters in a string to upper case.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Pipes

      public Pipes()
  • Method Details

    • uppercase

      public static Pipe<String,String> uppercase()

      Returns a pipe which converts all characters in a string to upper case.

      Returns:
      a pipe
    • lowercase

      public static Pipe<String,String> lowercase()

      Returns a pipe which converts all characters in a string to lower case.

      Returns:
      a pipe
    • titlecase

      public static Pipe<String,String> titlecase()

      Returns a pipe which changes the first character in a string to title case.

      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(DateTimeFormatter formatter)

      Returns a pipe which formats a temporal object (date, time, date-time...) using the specified formatter.

      Parameters:
      formatter - a date time formatter
      Returns:
      a pipe
    • date

      public static Pipe<TemporalAccessor,String> date(FormatStyle dateStyle)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date using the specified format style.

      Parameters:
      dateStyle - a date format style
      Returns:
      a pipe
    • date

      public static Pipe<TemporalAccessor,String> date(FormatStyle dateStyle, Locale locale)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date using the specified format style and locale.

      Parameters:
      dateStyle - a date format style
      locale - a locale
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(FormatStyle dateTimeStyle)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style.

      Parameters:
      dateTimeStyle - a date-time format style
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(FormatStyle dateTimeStyle, ZoneId zone)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style and zone.

      Parameters:
      dateTimeStyle - a date-time format style
      zone - a zone
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(FormatStyle dateTimeStyle, Locale locale)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style and locale.

      Parameters:
      dateTimeStyle - a date-time format style
      locale - a locale
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(FormatStyle dateTimeStyle, ZoneId zone, Locale locale)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified format style, zone and locale.

      Parameters:
      dateTimeStyle - a date-time format style
      zone - a zone
      locale - a locale
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(String pattern)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern.

      Parameters:
      pattern - a date-time pattern
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(String pattern, ZoneId zone)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern and zone.

      Parameters:
      pattern - a date-time pattern
      zone - a zone
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(String pattern, Locale locale)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern and locale.

      Parameters:
      pattern - a date-time pattern
      locale - a locale
      Returns:
      a pipe
    • dateTime

      public static Pipe<TemporalAccessor,String> dateTime(String pattern, ZoneId zone, Locale locale)

      Returns a pipe which formats a temporal object (date, time, date-time...) as a date-time using the specified pattern, zone and locale.

      Parameters:
      pattern - a date-time pattern
      zone - a zone
      locale - a locale
      Returns:
      a pipe
    • number

      public static Pipe<Number,String> number(NumberFormat formatter)

      Returns a pipe which formats a number using the specified format.

      Parameters:
      formatter - a number format
      Returns:
      a pipe
    • number

      public static Pipe<Number,String> number()

      Returns a pipe which formats a number using the default format.

      Returns:
      a pipe
    • number

      public static Pipe<Number,String> number(Locale locale)

      Returns a pipe which formats a number using the format for the specified locale.

      Parameters:
      locale - a locale
      Returns:
      a pipe
    • number

      public static Pipe<Number,String> number(int minIntegerDigits, int minFractionDigits, int maxFractionDigits)

      Returns a pipe which formats a number according to the specified limits.

      Parameters:
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      Returns:
      a pipe
    • number

      public static Pipe<Number,String> number(int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)

      Returns a pipe which formats a number for the specified locale according to the specified limits.

      Parameters:
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      locale - a locale
      Returns:
      a pipe
    • integer

      public static Pipe<Number,String> integer()

      Returns a pipe which formats a number as an integer.

      Returns:
      a pipe
    • integer

      public static Pipe<Number,String> integer(Locale locale)

      Returns a pipe which formats a number as an integer for the specified locale.

      Parameters:
      locale - a locale
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency()

      Returns a pipe which formats a number as an amount in the default locale currency.

      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(Locale locale)

      Returns a pipe which formats a number as an amount in the specified locale currency.

      Parameters:
      locale - a locale
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(int minIntegerDigits, int minFractionDigits, int maxFractionDigits)

      Returns a pipe which formats a number as an amount in the default locale currency according to the specified limits.

      Parameters:
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)

      Returns a pipe which formats a number as an amount in the specified locale currency according to the specified limits.

      Parameters:
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      locale - a locale
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(String currencyCode)

      Returns a pipe which formats a number as an amount in the specified currency using default locale format.

      Parameters:
      currencyCode - a currency code
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(String currencyCode, int minIntegerDigits, int minFractionDigits, int maxFractionDigits)

      Returns a pipe which formats a number as an amount in the specified currency using default locale format according to the specified limits.

      Parameters:
      currencyCode - a currency code
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(String currencyCode, Locale locale)

      Returns a pipe which formats a number as an amount in the specified currency using specified locale format.

      Parameters:
      currencyCode - a currency code
      locale - a locale
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(String currencyCode, int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)

      Returns a pipe which formats a number as an amount in the specified currency using the specified locale format according to the specified limits.

      Parameters:
      currencyCode - a currency code
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      locale - a locale
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(Currency currency)

      Returns a pipe which formats a number as an amount in the specified currency using default locale format.

      Parameters:
      currency - a currency
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(Currency currency, int minIntegerDigits, int minFractionDigits, int maxFractionDigits)

      Returns a pipe which formats a number as an amount in the specified currency using default locale format according to the specified limits.

      Parameters:
      currency - a currency
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(Currency currency, Locale locale)

      Returns a pipe which formats a number as an amount in the specified currency using the specified locale format.

      Parameters:
      currency - a currency
      locale - a locale
      Returns:
      a pipe
    • currency

      public static Pipe<Number,String> currency(Currency currency, int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)

      Returns a pipe which formats a number as an amount in the specified currency using the specified locale format according to the specified limits.

      Parameters:
      currency - a currency
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      locale - a locale
      Returns:
      a pipe
    • percent

      public static Pipe<Number,String> percent()

      Returns a pipe which formats a number as a percentage using default locale format.

      Returns:
      a pipe
    • percent

      public static Pipe<Number,String> percent(Locale locale)

      Returns a pipe which formats a number as a percentage using the specified locale format.

      Parameters:
      locale - a locale
      Returns:
      a pipe
    • percent

      public static Pipe<Number,String> percent(int minIntegerDigits, int minFractionDigits, int maxFractionDigits)

      Returns a pipe which formats a number as a percentage using default locale format according to the specified limits.

      Parameters:
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      Returns:
      a pipe
    • percent

      public static Pipe<Number,String> percent(int minIntegerDigits, int minFractionDigits, int maxFractionDigits, Locale locale)

      Returns a pipe which formats a number as a percentage using the specified locale format according to the specified limits.

      Parameters:
      minIntegerDigits - the minimum number of digits allowed in the integer portion
      minFractionDigits - the minimum number of digits allowed in the fraction portion
      maxFractionDigits - the maximum number of digits allowed in the fraction portion
      locale - a locale
      Returns:
      a pipe
    • escapeHtml

      public static Pipe<String,String> escapeHtml()

      Returns a pipe which escapes a string using HTML entities.

      Returns:
      a pipe
    • escapeJson

      public static Pipe<String,String> escapeJson()

      Returns a pipe which escapes a string using Json string rules rules.

      Returns:
      a pipe
    • escapeXml

      public static Pipe<String,String> escapeXml()

      Returns a pipe which escapes a string using XML entities.

      Returns:
      a pipe