Package it.tidalwave.ui.core.role
Interface Displayable
- All Known Subinterfaces:
HtmlDisplayable
,MutableDisplayable
,PlainTextDisplayable
- All Known Implementing Classes:
FileEntity
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The role of an object which can provide its own display name.
- Since:
- 2.0-ALPHA-1
- Author:
- Fabrizio Giudici
- Status: stable API
- Stereotype:
- Role
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Class
<Displayable> static final Displayable
A defaultDisplayable
with an empty display name. -
Method Summary
Modifier and TypeMethodDescriptionstatic Comparator
<it.tidalwave.util.As> Returns aComparator
for comparing two instances of objects implementingAs
that contain theDisplayable
role.static Comparator
<Displayable> Returns aComparator
for comparing two instances ofDisplayable
.default void
Sends the display name in the currentLocale
to a given customer.static Displayable
fromBundle
(Class<?> ownerClass, String key) Creates aDisplayable
from a resource bundle.Returns the display name in the currentLocale
.default String
getDisplayName
(Locale locale) Returns the display name in the givenLocale
.Returns all the display names inMap
where they are indexed byLocale
.Returns the supportedLocale
s.static Displayable
Creates an instance with a given display name.static Displayable
Creates an instance with a given display name iand an explicit label fortoString()
.static <T> Displayable
Creates an instance from aFunction
<T, String>
and a generic object that the function is applied to.static Displayable
Creates an instance from aSupplier
<String>
.default String
Renders the attached object into aString
.default void
Renders the attached object providing the string tu aConsumer
.
-
Field Details
-
_Displayable_
-
DEFAULT
A defaultDisplayable
with an empty display name.
-
-
Method Details
-
getDisplayName
Returns the display name in the currentLocale
.- Returns:
- the display name
-
getDisplayName
Returns the display name in the givenLocale
.- Parameters:
locale
- theLocale
- Returns:
- the display name
- Since:
- 2.0-ALPHA-2
-
getDisplayNames
Returns all the display names inMap
where they are indexed byLocale
.- Returns:
- the display names
- Since:
- 2.0-ALPHA-2
-
getLocales
Returns the supportedLocale
s.- Returns:
- the available
Locale
s - Since:
- 2.0-ALPHA-2
-
display
Sends the display name in the currentLocale
to a given customer.- Parameters:
consumer
- theConsumer
- Since:
- 3.2-ALPHA-15
-
of
Creates an instance with a given display name.- Parameters:
displayName
- the display name- Returns:
- the new instance
- Since:
- 3.2-ALPHA-1 (was
DefaultDisplayable
-
of
Creates an instance with a given display name iand an explicit label fortoString()
.- Parameters:
displayName
- the display nametoStringName
- the name to be rendered whentoString()
is called- Returns:
- the new instance
- Since:
- 3.2-ALPHA-1 (was
DefaultDisplayable
-
of
Creates an instance from aSupplier
<String>
. The supplier is invoked each timegetDisplayName()
is called.- Parameters:
supplier
- theSupplier
- Returns:
- the new instance
- Since:
- 3.2-ALPHA-3
-
of
Creates an instance from aFunction
<T, String>
and a generic object that the function is applied to. The function is invoked each timegetDisplayName()
is called.- Type Parameters:
T
- the type of the object- Parameters:
function
- theFunction
object
- the object- Returns:
- the new instance
- Since:
- 3.2-ALPHA-3
-
fromBundle
Creates aDisplayable
from a resource bundle. The bundle resource file is namedBundle.properties
and it should be placed in the same package as the owner class.- Parameters:
ownerClass
- the class that owns the bundlekey
- the resource key- Returns:
- the new instance
- Since:
- 2.0-ALPHA-2
-
comparing
Returns aComparator
for comparing two instances ofDisplayable
.- Returns:
- the
Comparator
- Since:
- 3.2-ALPHA-6
-
asComparing
Returns aComparator
for comparing two instances of objects implementingAs
that contain theDisplayable
role.- Returns:
- the
Comparator
- Since:
- 3.2-ALPHA-6
-
render
Renders the attached object into aString
. The method accepts optional parameters that can be used to control the format of the rendering; they are usually specific of the object attached to this role.- Parameters:
args
- optional rendering parameters- Returns:
- the string
-
renderTo
Renders the attached object providing the string tu aConsumer
. The method accepts optional parameters that can be used to control the format of the rendering; they are usually specific of the object attached to this role.- Parameters:
consumer
- theConsumer
to append toargs
- optional rendering parameters
-