duminică, 15 martie 2015

[OmniFaces utilities (2.0)] Get the metadata attributes


[OmniFaces utilities] The getMetadataAttributes(String viewId) method returns the metadata attribute map of the given view ID, or an empty map if there is no view metadata.
[OmniFaces utilities] The getMetadataAttributes() method returns the metadata attribute map of the current view, or an empty map if there is no view metadata.
[OmniFaces utilities] The getMetadataAttribute(String viewId, String name) method returns the metadata attribute of the given view ID associated with the given name.
[OmniFaces utilities] The getMetadataAttribute(String name) method returns the metadata attribute of the current view associated with the given name.

Method Faces#getMetadataAttributes(String viewId) - returns the metadata attribute map of the given view ID, or an empty map if there is no view metadata:
See also: Faces#getContext()

Method Faces#getMetadataAttributes() - returns the metadata attribute map of the current view, or an empty map if there is no view metadata:
See also: Faces#getContext()

Method Faces#getMetadataAttribute(String viewId, String name) - returns the metadata attribute of the given view ID associated with the given name:
See also: Faces#getContext()

Method Faces#getMetadataAttribute(String name) - returns the metadata attribute of the current view associated with the given name:
See also: Faces#getContext()
Usage:

·         invoke Faces#getMetadataAttributes(String viewId):

// returns the metadata attribute map of the 'index.xhtml' view
import org.omnifaces.util.Faces;
Map<String,Object> metattr = Faces.getMetadataAttributes("index.xhtml");

or,

// returns the metadata attribute map of the 'index.xhtml' view
import static org.omnifaces.util.Faces.getMetadataAttributes;
Map<String,Object> metattr = getMetadataAttributes("index.xhtml");

·         invoke Faces#getMetadataAttributes():

// returns the metadata attribute map of the current view
import org.omnifaces.util.Faces;
Map<String,Object> metattr = Faces.getMetadataAttributes();

or,

// returns the metadata attribute map of the current view
import static org.omnifaces.util.Faces.getMetadataAttributes;
Map<String,Object> metattr = getMetadataAttributes();

·         invoke Faces#getMetadataAttribute(String viewId, String name):

// returns the metadata attribute of the 'index.xhtml' view associated with 'myname' name
import org.omnifaces.util.Faces;
String attr = Faces.getMetadataAttribute("index.xhtml", "myname");

or,

// returns the metadata attribute of the 'index.xhtml' view associated with 'myname' name
import static org.omnifaces.util.Faces.getMetadataAttribute;
String attr = Faces.getMetadataAttribute("index.xhtml", "myname");

·         invoke Faces#getMetadataAttribute(String name):

// returns the metadata attribute of the current view associated with 'myname' name
import org.omnifaces.util.Faces;
String attr = Faces.getMetadataAttribute("myname");

or,

// returns the metadata attribute of the current view associated with 'myname' name
name
import static org.omnifaces.util.Faces.getMetadataAttribute;
String attr = Faces.getMetadataAttribute("myname");

Niciun comentariu:

Trimiteți un comentariu