Attribute implements Serializable, Cloneable { public void inherit(Attribute attribute) { if (value == null) { value = attribute.getValue(); } Expression targetExpressionObject = attribute.getExpressionObject(); if (targetExpressionObject != null && (expressionObject == null || expressionObject .getExpression() == null)) { expressionObject = new Expression(targetExpressionObject); } if (roles == null || roles.isEmpty()) { roles = attribute.getRoles(); } if (renderer == null) { renderer = attribute.getRenderer(); } } Attribute();  Attribute(Object value);  Attribute(Attribute attribute);  Attribute(Object value, String role);  Attribute(Object value, Expression expression, String role, String rendererName); static Attribute createTemplateAttribute(String template); static Attribute createTemplateAttribute(String template,
            String templateExpression, String templateType, String role); static Attribute createTemplateAttributeWithExpression(
            String templateExpression); String getRole(); Set<String> getRoles(); void setRole(String role); void setRoles(Set<String> roles); Object getValue(); void setValue(Object value); Expression getExpressionObject(); void setExpressionObject(Expression expressionObject); @Override String toString(); String getRenderer(); void setRenderer(String rendererName); void inherit(Attribute attribute); @Override boolean equals(Object obj); boolean isPermitted(Request request); @Override int hashCode(); @Override Attribute clone();  }
@Test public void testInherit() { Attribute attribute = new Attribute(null, (Expression) null, null, (String) null); Attribute parentAttribute = new Attribute("value", Expression .createExpression("expression", "language"), "role", "renderer"); attribute.inherit(parentAttribute); assertEquals("value", attribute.getValue()); assertEquals("expression", attribute.getExpressionObject().getExpression()); assertEquals("language", attribute.getExpressionObject().getLanguage()); assertEquals("role", attribute.getRole()); assertEquals("renderer", attribute.getRenderer()); Expression expression = new Expression(null, "MYLANG"); attribute = new Attribute(null, expression, null, (String) null); attribute.setRoles(new HashSet<String>()); attribute.inherit(parentAttribute); assertEquals("value", attribute.getValue()); assertEquals("expression", attribute.getExpressionObject().getExpression()); assertEquals("language", attribute.getExpressionObject().getLanguage()); assertEquals("role", attribute.getRole()); assertEquals("renderer", attribute.getRenderer()); }