Top Inners Fields Constructors Methods
com.sun.faces.application.view

public Class ViewMetadataImpl

extends ViewMetadata
Class Inheritance
Static Imports
java.lang.reflect.Modifier.isFinal, .Modifier.isPublic, .Modifier.isStatic, java.util.Collections.unmodifiableMap

See Also
javax.faces.view.ViewMetadata

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ViewMetadataImpl.ConstantsMap

Specific map implementation which wraps the given map in Collections#unmodifiableMap(Map) and throws an IllegalArgumentException in ConstantsMap#get(Object) method when the key doesn't exist at all.

Field Summary

Modifier and TypeField and Description
private DefaultFaceletFactory
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Map<String, Object>

Returns:

Constants of the given type.
collectConstants
(String
The fully qualified name of the type to collect constants for.
type
)

Collect constants of the given type.

public UIViewRoot
createMetadataView(FacesContext
the FacesContext for the current request
context
)

Implements abstract javax.faces.view.ViewMetadata.createMetadataView.

Creates a new UIViewRoot containing only view parameter metadata.

public String
getViewId()

Implements abstract javax.faces.view.ViewMetadata.getViewId.

Get the view id

private static void
private static Class<?>

Returns:

The concrete Class instance.
toClass
(String
The fully qualified name of the class.
type
)

Convert the given type, which should represent a fully qualified name, to a concrete Class instance.

Inherited from javax.faces.view.ViewMetadata:
getImportConstantsgetViewActionsgetViewParametershasMetadata

Field Detail

faceletFactoryback to summary
private DefaultFaceletFactory faceletFactory
viewIdback to summary
private String viewId

Constructor Detail

ViewMetadataImplback to summary
public ViewMetadataImpl(String viewId)

Method Detail

collectConstantsback to summary
private static Map<String, Object> collectConstants(String type)

Collect constants of the given type. That are, all public static final fields of the given type.

Parameters
type:String

The fully qualified name of the type to collect constants for.

Returns:Map<String, Object>

Constants of the given type.

createMetadataViewback to summary
public UIViewRoot createMetadataView(FacesContext context)

Implements abstract javax.faces.view.ViewMetadata.createMetadataView.

Doc from javax.faces.view.ViewMetadata.createMetadataView.

Creates a new UIViewRoot containing only view parameter metadata. The processing of building this UIViewRoot with metadata should not cause any events to be published to the application. The implementation must call FacesContext#setProcessingEvents passing false as the argument, at the beginning of the method, and pass true to the same method at the end. The implementation must ensure that this happens regardless of ant exceptions that may be thrown.

Take note a compliant implementation has to ensure that:

  • the new UIViewRoot must be set as the FacesContext's viewRoot before applying the tag handlers, restoring the old FacesContext in a finally block.
  • The contents of the current UIViewRoot's ViewMap must be copied to the ViewMap of the new UIViewRoot before applying the tag handlers.
  • The UIImportConstants must be processed after applying the tag handlers.
Parameters
context:FacesContext

the FacesContext for the current request

Returns:UIViewRoot

a UIViewRoot containing only view parameter metadata (if any)

Annotations
@Override
See Also
javax.faces.view.ViewMetadata#createMetadataView(javax.faces.context.FacesContext)
getViewIdback to summary
public String getViewId()

Implements abstract javax.faces.view.ViewMetadata.getViewId.

Doc from javax.faces.view.ViewMetadata.getViewId.

Get the view id

Returns:String

the view ID for which this ViewMetadata instance was created

Annotations
@Override
See Also
javax.faces.view.ViewMetadata#getViewId()
importConstantsIfNecessaryback to summary
private static void importConstantsIfNecessary(FacesContext context, UIViewRoot root)
toClassback to summary
private static Class<?> toClass(String type)

Convert the given type, which should represent a fully qualified name, to a concrete Class instance.

Parameters
type:String

The fully qualified name of the class.

Returns:Class<?>

The concrete Class instance.

Exceptions
IllegalArgumentException:
When it is missing in the classpath.
com.sun.faces.application.view back to summary

private Class ViewMetadataImpl.ConstantsMap

extends HashMap<String, Object>
Class Inheritance

Specific map implementation which wraps the given map in Collections#unmodifiableMap(Map) and throws an IllegalArgumentException in ConstantsMap#get(Object) method when the key doesn't exist at all.
Author
Bauke Scholtz
Since
2.3

Field Summary

Modifier and TypeField and Description
private static final long
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
object to be compared for equality with this map
object
)

Overrides java.util.AbstractMap.equals.

Implements java.util.Map.equals.

Compares the specified object with this map for equality.
public Object
get(Object
the key whose associated value is to be returned
key
)

Overrides java.util.HashMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public int
hashCode()

Overrides java.util.AbstractMap.hashCode.

Implements java.util.Map.hashCode.

Returns the hash code value for this map.
Inherited from java.util.HashMap:
clearclonecomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValueentrySetforEachgetOrDefaultisEmptykeySetmergenewHashMapputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.HashMap.serialVersionUID.

typeback to summary
private String type

Constructor Detail

ConstantsMapback to summary
public ConstantsMap(Map<String, Object> map, String type)

Method Detail

equalsback to summary
public boolean equals(Object object)

Overrides java.util.AbstractMap.equals.

Implements java.util.Map.equals.

Doc from java.util.Map.equals.

Compares the specified object with this map for equality. Returns true if the given object is also a map and the two maps represent the same mappings. More formally, two maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()). This ensures that the equals method works properly across different implementations of the Map interface.

Parameters
object:Object

object to be compared for equality with this map

Returns:boolean

true if the specified object is equal to this map

Annotations
@Override
getback to summary
public Object get(Object key)

Overrides java.util.HashMap.get.

Implements java.util.Map.get.

Doc from java.util.HashMap.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters
key:Object

Doc from java.util.Map.get.

the key whose associated value is to be returned

Returns:Object

Doc from java.util.Map.get.

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.util.AbstractMap.hashCode.

Implements java.util.Map.hashCode.

Doc from java.util.Map.hashCode.

Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hash codes of each entry in the map's entrySet() view. This ensures that m1.equals(m2) implies that m1.hashCode()==m2.hashCode() for any two maps m1 and m2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this map

Annotations
@Override