ClassPresenterSelector


public final class ClassPresenterSelector extends PresenterSelector


A ClassPresenterSelector selects a Presenter based on the item's Java class.

Summary

Public constructors

Public methods

ClassPresenterSelector

Sets a presenter to be used for the given class.

ClassPresenterSelector
addClassPresenterSelector(
    Class<Object> cls,
    PresenterSelector presenterSelector
)

Sets a presenter selector to be used for the given class.

@Nullable Presenter

Returns a presenter for the given item.

Presenter[]

Returns an array of all possible presenters.

Public constructors

ClassPresenterSelector

Added in 1.1.0
public ClassPresenterSelector()

Public methods

addClassPresenter

Added in 1.1.0
public ClassPresenterSelector addClassPresenter(Class<Object> cls, Presenter presenter)

Sets a presenter to be used for the given class.

Parameters
Class<Object> cls

The data model class to be rendered.

Presenter presenter

The presenter that renders the objects of the given class.

Returns
ClassPresenterSelector

This ClassPresenterSelector object.

addClassPresenterSelector

Added in 1.1.0
public ClassPresenterSelector addClassPresenterSelector(
    Class<Object> cls,
    PresenterSelector presenterSelector
)

Sets a presenter selector to be used for the given class.

Parameters
Class<Object> cls

The data model class to be rendered.

PresenterSelector presenterSelector

The presenter selector that finds the right presenter for a given class.

Returns
ClassPresenterSelector

This ClassPresenterSelector object.

getPresenter

Added in 1.2.0-alpha04
public @Nullable Presenter getPresenter(@Nullable Object item)

Returns a presenter for the given item.

getPresenters

public Presenter[] getPresenters()

Returns an array of all possible presenters. The returned array should not be modified.