Utility object for working with the Renderer typeclass. Provides methods to build, manipulate, and use instances of Renderer for rendering various types as strings.
Attributes
Members list
Value members
Concrete methods
Method which allows us to wrap a function as a Renderer.
Method which allows us to wrap a function as a Renderer.
Type parameters
- T
-
the type to be rendered.
Value parameters
- function
-
the function to be wrapped. It has the same signature as this apply method so it is simply a syntactic convenience.
Attributes
- Returns
-
a Renderer[T].
Method to create a lazy Renderer[T] from an explicit Renderer[T] which is call-by-name. The purpose of this method is to break the infinite recursion caused when implicit values are defined recursively. See the Play JSON library method in JsPath called lazyRead.
Method to create a lazy Renderer[T] from an explicit Renderer[T] which is call-by-name. The purpose of this method is to break the infinite recursion caused when implicit values are defined recursively. See the Play JSON library method in JsPath called lazyRead.
Type parameters
- T
-
the underlying type of the Renderer required.
Value parameters
- tr
-
a Renderer[T].
Attributes
- Returns
-
a Renderer[T].
Determines an attribute name based on the given index and product element name, with an option to override behavior using a flag.
Determines an attribute name based on the given index and product element name, with an option to override behavior using a flag.
Value parameters
- index
-
the zero-based index of the element to inspect in the product.
- r
-
the instance of a Product from which the attribute name is determined.
- useName
-
a flag indicating whether to use the element name directly if no attribute extraction is possible; defaults to false.
Attributes
- Returns
-
an Option containing the determined attribute name as a String, or None if no valid attribute name can be resolved.
Render the T value using the implicitly found Renderer[T]. Debug-log the renderer and its result.
Render the T value using the implicitly found Renderer[T]. Debug-log the renderer and its result.
Type parameters
- T
-
the type of t.
Value parameters
- format
-
the Format.
- stateR
-
the StateR.
- t
-
the value to be rendered.
Attributes
- Returns
-
a String.
Renders an attribute in a string format based on the given name and value. If a name is provided in maybeName, the result will be formatted as name="value". Otherwise, only the value will be returned as a string.
Renders an attribute in a string format based on the given name and value. If a name is provided in maybeName, the result will be formatted as name="value". Otherwise, only the value will be returned as a string.
Value parameters
- maybeName
-
an optional string representing the attribute name.
- w
-
the value to be rendered as a
CharSequence.
Attributes
- Returns
-
a
Try[String]containing the rendered attribute or an exception if the operation fails.