In package com.caseyjbrooks.clog.parseltongue

public class TheStandardBookOfSpells extends Object

A collection of all the Spells available by default within Parseltongue formatters.

Constructors

Parameters:
  • No parameters

Methods

public static String toUpper(Object data)

Calls '.toString()' on an object, then formats the output as uppercase

Clog example: #{ $1 | uppercase }

Parameters:
  • Object data

    the object to format

public static String toLower(Object data)

Calls '.toString()' on an object, then formats the output as lowercase

Clog example: #{ $1 | lowercase }

Parameters:
  • Object data

    the object to format

public static String trim(Object data)

Calls '.toString()' on an object, then trims whitespace from its output

Clog example: #{ $1 | trim }

Parameters:
  • Object data

    the object to format

public static String split(Object data, String delimiter)

Calls '.toString()' on an object, then splits it into an array of String based on a given delimiter

Clog example: #{ $1 | split('.') }

Parameters:
  • Object data

    the object to format

  • String delimiter
public static String capitalize(Object data)

Calls '.toString()' on an object, then capitalizes the output

Clog example: #{ $1 | capitalize }

Parameters:
  • Object data

    the object to format

public static String repeat(Object data, String template)

Repeats the input data for each element of the array, applying the corresponding Clog format String.

Clog example: #{ $1 | repeat('* #{ $1 }') }

Parameters:
  • Object data

    the data to repeat

  • String template

    the Clog template to render for each element

public static String repeat(Iterable<> data, String template)

Repeats the input data for each element of the Iterable, applying the corresponding Clog format String.

Clog example: #{ $1 | repeat('#{ $1 }') }

Parameters:
  • Iterable<> data

    the data to repeat

  • String template

    the Clog template to render for each element

public static String join(Object data, String separator)

Calls '.toString()' on every element in the array, then joins them with a specified separator String. Based on the Android Open Source Project TestUtils.java class.

Clog example: #{ $1 | join(', ') }

Parameters:
  • Object data

    an Array of any type to join

  • String separator

    a String to concatenate between every element's String representation

public static String join(Iterable<> data, String separator)

Calls '.toString()' on every element in the Iterable, then joins them with a specified separator String. Based on the Android Open Source Project TestUtils.java class.

Clog example: #{ $1 | join(', ') }

Parameters:
  • Iterable<> data

    an Iterable of any type to join

  • String separator

    a String to concatenate between every element's String representation

public static String getClassName(Object data)

Converts any Object to the simple Class name String of that Object

Clog example: #{ $1 | className }

Parameters:
  • Object data

    any object to display the simple Class name

public static int length(String data)

Get the number of characters in a String

Clog example: #{ $1 | length }

Parameters:
  • String data

    a String to find the length of

public static int length(Object data)

Get the number of elements in an Array

Clog example: #{ $1 | length }

Parameters:
  • Object data

    an Array of any type to find the length of

public static int length(Collection<> data)

Get the number of elements in a Collection

Clog example: #{ $1 | length }

Parameters:
  • Collection<> data

    a Collection of any type to find the length of

public static Object date(Calendar data)

Formats a Calendar object with to human-readable date of the form 'yyyy/MM/dd HH:mm:ss'

Clog example: #{ $1 | date }

Parameters:
  • Calendar data

    a Calendar object to get the date of

public static Object date(Calendar data, String formatString)

Formats a Calendar object with to human-readable date of the form specified

Clog example: #{ $1 | date('yyyy-MM-dd') }

Parameters:
  • Calendar data

    a Calendar object to get the date of

  • String formatString

    the String used to format the Calendar object

public static Object ansiForegroundColorStart(Object data, String color)

Inserts the appropriate ANSI codes to change the foreground color of the text. The foreground color will be used until an ANSI 'reset' character is added with the 'reset' Spell. Should only be used when output is intended to be displayed in a Terminal. Works on both Unix/Linux terminals and Windows command prompt.

Available Colors (case insensitive): BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, DEFAULT

Clog example: #{ $0 | fg('cyan') }

Parameters:
  • Object data

    ignored

  • String color

    the color to change the foreground to.

public static Object ansiBackgroundColorStart(Object data, String color)

Inserts the appropriate ANSI codes to change the background color of the text. The background color will be used until an ANSI 'reset' character is added with the 'reset' Spell. Should only be used when output is intended to be displayed in a Terminal. Works on both Unix/Linux terminals and Windows command prompt.

Available Colors (case insensitive): BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, DEFAULT

Clog example: #{ $0 | bg('yellow') }

Parameters:
  • Object data

    ignored

  • String color

    the color to change the background to.

public static Object ansiStop(Object data)

Inserts the appropriate ANSI codes to reset the terminal text colors. Should only be used when output is intended to be displayed in a Terminal. Works on both Unix/Linux terminals and Windows command prompt.

Parameters:
  • Object data

    ignored