org.deegree.commons.utils
Class QNameUtils

java.lang.Object
  extended by org.deegree.commons.utils.QNameUtils

public class QNameUtils
extends Object

Provides some utility methods for working with qualified names.

Version:
$Revision: 24534 $, $Date: 2010-05-21 18:47:23 +0200 (Fri, 21 May 2010) $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Constructor Summary
QNameUtils()
           
 
Method Summary
static QName findBestMatch(QName present, Collection<QName> candidates)
          Finds the best possible match for a QName in a collection of QNames.
static String toString(QName qName)
          Returns a string representation that includes the prefix (if present).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QNameUtils

public QNameUtils()
Method Detail

toString

public static String toString(QName qName)
Returns a string representation that includes the prefix (if present).

Parameters:
qName - qualified name, must not be null
Returns:
string representation, never null

findBestMatch

public static QName findBestMatch(QName present,
                                  Collection<QName> candidates)
Finds the best possible match for a QName in a collection of QNames.

Performs the following checks in order:

  1. exact match, same namespace, same local part
  2. different namespace, same prefix, same local part
  3. different namespace, different prefix, same local part

Parameters:
present - name for which to find the best match, must not be null
candidates - available candidates, must not be null
Returns:
best match, or null if no match can be found at all


Copyright © 2011. All Rights Reserved.