/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Enhydra Application Server is Lutris
* Technologies, Inc. The Enhydra Application Server and portions created
* by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
* All Rights Reserved.
*/
package org.enhydra.zeus;
import java.io.IOException;
import java.util.List;
/**
* <p>
* <code>Binder</code> provides an interface for all constraint
* representations to use. It defines the contract for conversion
* between an arbitrary constraint representation (XML Schema, DTD,
* Relax schema, etc) to a set of Zeus
* <code>{@link Binding}</code>s.
* </p><p>
* This interface also provides uniformity in the overall handling
* of constraints; in other words, dealing with an XML Schema is
* generally fundamentally different than dealing with a DTD.
* However, working with a <code>DTDBinder</code> is identical,
* from an external perspective, to working with a
* <code>SchemaBinder</code>.
* </p>
*
* @author Brett McLaughlin
* @author Maciej Zawadzki
*/
public interface Binder {
/**
* <p>
* This sets whether or not to "collapse" simple elements. An element is
* simple if it only has character-based content, and no attributes. If
* these are collapsed, then they are not turned into full-fledged
* Java objects (with only a <code>getValue()</code> method), but instead
* become properties with primitive return values on their parents. So
* an element named "display-name" with only textual content could be
* accessed through it's parent object by invoking
* <code>getDisplayName()</code> on the parent, instead of
* <code>getDisplayName().getValue()</code>. By default, elements are
* <i>not</i> collapsed.
* </p>
*
* @param isCollapsingSimpleElements whether or not to collapse simple
* elements.
*/
public void setIsCollapsingSimpleElements(
boolean isCollapsingSimpleElements);
/**
* <p>
* This will indicate whether simple elements are being collapsed for
* this binder. An element is
* simple if it only has character-based content, and no attributes. If
* these are collapsed, then they are not turned into full-fledged
* Java objects (with only a <code>getValue()</code> method), but instead
* become properties with primitive return values on their parents. So
* an element named "display-name" with only textual content could be
* accessed through it's parent object by invoking
* <code>getDisplayName()</code> on the parent, instead of
* <code>getDisplayName().getValue()</code>. By default, elements are
* <i>not</i> collapsed.
* </p>
*
* @return <code>boolean</code> - whether simple elements are being
* collapsed.
*/
public boolean isCollapsingSimpleElements();
/**
* <p>
* This indicates if the <code>id</code> attribute on elements handled by
* this <code>Binder</code> should be ignored in determine if an
* element is collapsible. If
* <code>{@link #isCollapsingSimpleElements}</code> is false, this has
* no effect.
* </p>
*
* @param ignoringIDAttributes whether or not to ignore ID attributes.
*/
public void setIsIgnoringIDAttributes(boolean isIgnoringIDAttributes);
/**
* <p>
* This will indicate if the <code>id</code> attribute on elements handled
* by this <code>Binder</code> should be ignored in determine if an
* element is collapsible. If
* <code>{@link #isCollapsingSimpleElements}</code> is false, this has
* no effect.
* </p>
*
* @return <code>boolean</code> - whether ID attributes are ignored.
*/
public boolean isIgnoringIDAttributes();
/**
* <p>
* This is integral portion of the <code>Binder</code>. It
* is responsible for returning a Zeus representation of
* the set of constraints that this binding represents,
* resulting from the input representation (which could
* be an XML Schema, DTD, Relax schema, etc.).
* </p>
*
* @return <code>List</code> - the resultant
* <code>Binding</code>s from conversion of
* constraints.
* @exception <code>IOException</code> when errors in reading
* input occur.
*/
public List getBindings() throws IOException;
}
|