Skip to content

Extend UIComponent#getFacet for using enums #2034

@tandraschko

Description

@tandraschko

In case when a component lib like PF would like to use Facets in similar way like PropertyKeys:

    public enum PropertyKeys {
        @Property(description = "Name of the field associated to bean 'var'", type = String.class)
        field,
        footerText,
        @Property(description = "Shortcut for header facet", type = String.class)
        headerText,
        style,
        styleClass,
        converter
    }

    public enum FacetKeys {
        @Facet(description = "")
        header,
        @Facet(description = "")
        footer
    }

and

UIComponent header = column.getFacet(ColumnBase.FacetKeys.header);

we can simply add the following method to UIComponent/Base:

    public abstract UIComponent getFacet(Enum<?> facet);
    @Override
    public UIComponent getFacet(Enum<?> facet) {
            return getFacet(facet.name());
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions