public class BasicAttributeContext extends java.lang.Object implements AttributeContext, java.io.Serializable
AttributeContext.| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,Attribute> |
attributes
Template attributes.
|
protected java.util.Map<java.lang.String,Attribute> |
cascadedAttributes
Cascaded template attributes.
|
protected java.lang.String |
preparer
Associated ViewPreparer URL or classname, if defined.
|
protected Attribute |
templateAttribute
The template attribute, to render a template.
|
| Constructor and Description |
|---|
BasicAttributeContext()
Constructor.
|
BasicAttributeContext(AttributeContext context)
Copy constructor.
|
BasicAttributeContext(BasicAttributeContext context)
Copy constructor.
|
BasicAttributeContext(java.util.Map<java.lang.String,Attribute> attributes)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(java.util.Map<java.lang.String,Attribute> newAttributes)
Add all attributes to this context.
|
void |
addMissing(java.util.Map<java.lang.String,Attribute> defaultAttributes)
Add all missing attributes to this context.
|
void |
clear()
Clear the attributes.
|
boolean |
equals(java.lang.Object obj) |
Attribute |
getAttribute(java.lang.String name)
Retrieve the named attribute, either cascaded or not.
|
java.util.Iterator<java.lang.String> |
getAttributeNames()
Iterator of all attribute names.
|
Attribute |
getCascadedAttribute(java.lang.String name)
Retrieve the attribute that has been cascaded at upper levels.
|
java.util.Set<java.lang.String> |
getCascadedAttributeNames()
Returns the names of the cascaded attributes.
|
Attribute |
getLocalAttribute(java.lang.String name)
Retrieve the attribute that has been defined in this context (i.e.
|
java.util.Set<java.lang.String> |
getLocalAttributeNames()
Returns the names of the local attributes, i.e.
|
java.lang.String |
getPreparer()
Get associated preparer instance.
|
Attribute |
getTemplateAttribute()
Returns the attribute that will be used to render a template.
|
int |
hashCode() |
void |
inherit(AttributeContext parent)
Copies all missing attributes from the
parent attribute
context to this one. |
void |
inherit(BasicAttributeContext parent)
Inherits the attribute context, inheriting, i.e.
|
void |
inheritCascadedAttributes(AttributeContext context)
Copies the cascaded attributes to this attribute context.
|
void |
putAttribute(java.lang.String name,
Attribute value)
Add the specified attribute.
|
void |
putAttribute(java.lang.String name,
Attribute value,
boolean cascade)
Add the specified attribute.
|
void |
setPreparer(java.lang.String url)
Set associated preparer instance.
|
void |
setTemplateAttribute(Attribute templateAttribute)
Sets the template attribute, that will be used to render the template
page.
|
protected Attribute templateAttribute
protected java.lang.String preparer
protected java.util.Map<java.lang.String,Attribute> attributes
protected java.util.Map<java.lang.String,Attribute> cascadedAttributes
public BasicAttributeContext()
public BasicAttributeContext(java.util.Map<java.lang.String,Attribute> attributes)
attributes - Attributes to initialize context.public BasicAttributeContext(AttributeContext context)
context - The constructor to copy.public BasicAttributeContext(BasicAttributeContext context)
context - The constructor to copy.public Attribute getTemplateAttribute()
getTemplateAttribute in interface AttributeContextpublic void setTemplateAttribute(Attribute templateAttribute)
setTemplateAttribute in interface AttributeContexttemplateAttribute - The template attribute.public java.lang.String getPreparer()
getPreparer in interface AttributeContextpublic void setPreparer(java.lang.String url)
setPreparer in interface AttributeContexturl - The preparer name.public void inheritCascadedAttributes(AttributeContext context)
inheritCascadedAttributes in interface AttributeContextcontext - The parent context to be used.public void inherit(AttributeContext parent)
parent attribute
context to this one.inherit in interface AttributeContextparent - The attribute context to copy attributes from.public void inherit(BasicAttributeContext parent)
parent - The attribute context to inherit.public void addAll(java.util.Map<java.lang.String,Attribute> newAttributes)
addAll in interface AttributeContextnewAttributes - Attributes to add.public void addMissing(java.util.Map<java.lang.String,Attribute> defaultAttributes)
addMissing in interface AttributeContextdefaultAttributes - Attributes to add.public Attribute getAttribute(java.lang.String name)
getAttribute in interface AttributeContextname - key name for the attribute.public Attribute getLocalAttribute(java.lang.String name)
getLocalAttribute in interface AttributeContextname - key name for the attribute.null otherwise.public Attribute getCascadedAttribute(java.lang.String name)
getCascadedAttribute in interface AttributeContextname - key name for the attribute.null otherwise.public java.util.Iterator<java.lang.String> getAttributeNames()
getAttributeNames in interface AttributeContextpublic java.util.Set<java.lang.String> getLocalAttributeNames()
getLocalAttributeNames in interface AttributeContextpublic java.util.Set<java.lang.String> getCascadedAttributeNames()
getCascadedAttributeNames in interface AttributeContextpublic void putAttribute(java.lang.String name,
Attribute value)
AttributeContext.putAttribute(String, Attribute, boolean) with
cascade = false.putAttribute in interface AttributeContextname - name of the attributevalue - value of the attributepublic void putAttribute(java.lang.String name,
Attribute value,
boolean cascade)
putAttribute in interface AttributeContextname - name of the attributevalue - value of the attributecascade - If true, the attribute value will be
available in all nested contexts. If false, it will be
available only in the current context.public void clear()
clear in interface AttributeContextpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object