org.apache.commons.betwixt.strategy
Class ValueSuppressionStrategy

java.lang.Object
  extended by org.apache.commons.betwixt.strategy.ValueSuppressionStrategy

public abstract class ValueSuppressionStrategy
extends java.lang.Object

Determines whether the expression of an attribute with a values should be suppressed.

Since:
0.7
Author:
Apache Commons Team, Apache Software Foundation

Field Summary
static ValueSuppressionStrategy ALLOW_ALL_VALUES
          Strategy allows all values to be expressed for all attributes
static ValueSuppressionStrategy DEFAULT
          Default strategy is SUPPRESS_EMPTY.
static ValueSuppressionStrategy SUPPRESS_EMPTY
          Suppresses all null values.
 
Constructor Summary
ValueSuppressionStrategy()
           
 
Method Summary
abstract  boolean suppressAttribute(AttributeDescriptor attributeDescriptor, java.lang.String value)
          Should the given attribute value be suppressed?
 boolean suppressElement(ElementDescriptor element, java.lang.String namespaceUri, java.lang.String localName, java.lang.String qualifiedName, java.lang.Object value)
           Should be given element value be suppressed?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_ALL_VALUES

public static final ValueSuppressionStrategy ALLOW_ALL_VALUES
Strategy allows all values to be expressed for all attributes


SUPPRESS_EMPTY

public static final ValueSuppressionStrategy SUPPRESS_EMPTY
Suppresses all null values.


DEFAULT

public static final ValueSuppressionStrategy DEFAULT
Default strategy is SUPPRESS_EMPTY.

Constructor Detail

ValueSuppressionStrategy

public ValueSuppressionStrategy()
Method Detail

suppressAttribute

public abstract boolean suppressAttribute(AttributeDescriptor attributeDescriptor,
                                          java.lang.String value)
Should the given attribute value be suppressed?

Parameters:
attributeDescriptor - AttributeDescriptor describing the attribute, not null
value - Object value, possibly null
Returns:
true if the attribute should not be written for the given value

suppressElement

public boolean suppressElement(ElementDescriptor element,
                               java.lang.String namespaceUri,
                               java.lang.String localName,
                               java.lang.String qualifiedName,
                               java.lang.Object value)

Should be given element value be suppressed?

Note: to preserve binary compatibility, this method contains an implementation that returns false. Subclasses should not rely upon this behaviour as (in future) this may be made abstract.

Parameters:
element - ElementDescriptor describing the element, not null
namespaceUri - the namespace of the element to be written
localName - the local name of the element to be written
qualifiedName - the qualified name of the element to be written
value - Object value, possibly null
Returns:
true if the element should be suppressed (in other words, not written) for the given value
Since:
0.8


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.