schema2template.model
Class QNameValue

java.lang.Object
  extended by schema2template.model.QNameValue
All Implemented Interfaces:
Comparable<QNameValue>, QNamed

public class QNameValue
extends Object
implements QNamed, Comparable<QNameValue>

Domain specific models (Odf, Java, ...) often return 'ns:localname' Strings. The purpose of this class is to encapsulate these Strings so in templates they can be treated like other QNamed objects.

Contract: These objects are distincted only by the encapsulated String. So they use this String for equals(o), hashCode() and compareTo(o).


Constructor Summary
QNameValue(String name)
          Constructor to create a String wrapper
 
Method Summary
 int compareTo(QNameValue o)
           
 boolean equals(Object o)
           
 String getLocalName()
          Get only localname
 String getNamespace()
          Get only namespace
 String getQName()
          Get the QName (i.e.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QNameValue

public QNameValue(String name)
Constructor to create a String wrapper

Parameters:
name - the String to wrap
Method Detail

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getLocalName

public String getLocalName()
Description copied from interface: QNamed
Get only localname

Specified by:
getLocalName in interface QNamed
Returns:
localname

getQName

public String getQName()
Description copied from interface: QNamed
Get the QName (i.e. namespace:localname )

Specified by:
getQName in interface QNamed
Returns:
full name

getNamespace

public String getNamespace()
Description copied from interface: QNamed
Get only namespace

Specified by:
getNamespace in interface QNamed
Returns:
namespace

compareTo

public int compareTo(QNameValue o)
Specified by:
compareTo in interface Comparable<QNameValue>


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.