Widget

public class demo.Widget implements Transformer<String>[source]

A widget with a unified Java API and handwritten guides.

Call #convert(int) or the text overload. Types such as Instant, java.util.Map.Entry, and String#substring(int, int) link to configured external Javadoc.

  • Preserves structure and emphasis.

  • Supports nested lists:

    1. Read.

    2. Transform.

Widget widget = new Widget();
 String result = widget.convert(42);
 if (result.length() > 0) {
     System.out.println(result);
 }
First line
Second line
Third line
Last line.

Try query parameters.

An inline snippet:

    String value = widget.convert(7);
    System.out.println(value);
Conversion examples

Call

Result

Notes

widget.convert(42)

"42"

Labelled "widget"; long names such as com.example.widgets.configuration.DefaultWidgetLabelProvider stay inside the table

See also:

Point

Since:

1.0

Constructors

Widget()

Constructs a widget.

Widget(String)

Constructs a named widget.

public Widget()[source]

Constructs a widget.

public Widget(String label)[source]

Constructs a named widget.

Parameters:

label – the label

Fields and constants

LABEL

Default label.

count

A protected extension point.

public static final String LABEL = "widget"[source]

Default label.

protected int count[source]

A protected extension point.

Methods

buildIndex(List, Map)

Builds a generic index.

combine(int[][], String[])

Combines array and variable arguments.

convert(int)

Converts a number to text.

convert(String)

Transforms a value using Widget#convert(int) when needed.

old()

Deprecated. Old entry point.

public <T extends Number & Comparable<T>> Map<T, List<? extends CharSequence>> buildIndex(List<? extends T> values, Map<T, List<? extends CharSequence>> fallback)[source]

Builds a generic index.

Type parameters:

<T> – comparable numeric key

Parameters:
  • values – input values

  • fallback – default entries

Returns:

grouped entries

public String[] combine(int[][] values, String... labels)[source]

Combines array and variable arguments.

Parameters:
  • values – input arrays

  • labels – labels

Returns:

the labels

public String convert(int number)[source]

Converts a number to text.

Parameters:

number – the number

Returns:

decimal text

@Override public String convert(String renamed) throws IllegalArgumentException[source]

Transforms a value using Widget#convert(int) when needed.

The result preserves <angle brackets>.

Parameters:

renamed – the value to transform

Returns:

the transformed value

Throws:

java.lang.IllegalArgumentException – if the value is invalid

if the value is empty

@Deprecated(since="1.0", forRemoval=true) public void old()[source]

Deprecated: Use #convert(int).

Old entry point.