Skip to content

FaceletContext: add static utility methods getCurrentInstance() and getCurrentInstance(FacesContext context)  #2015

@pizzi80

Description

@pizzi80

Basically the idea is to have the same utility method
similar to FacesContext.getCurrentInstance()

the implementation could be something like:


/**
 * @return the current {@link FaceletContext} from the attributes of the current {@link FacesContext}
 */
public static FaceletContext getCurrentInstance() {
    return getCurrentInstance(FacesContext.getCurrentInstance());
}

/**
 * @return the current {@link FaceletContext} from the attributes of the passed {@link FacesContext}
 * @param context the current FacesContext
 */
public static FaceletContext getCurrentInstance(FacesContext context) {
    return (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions