org.vfny.geoserver.global.dto.NameSpaceInfoDTO Maven / Gradle / Ivy
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.vfny.geoserver.global.dto;
/**
* Data Transfer Object for GeoServer NameSpaceInfo information.
*
*
* Represents the portion of a namespace required for the configuration of
* geoserver. Defines namespaces to be used by the datastores.
*
*
*
* Data Transfer object are used to communicate between the GeoServer
* application and its configuration and persistent layers. As such the class
* is final - to allow for its future use as an on-the-wire message.
*
*
*
* Jody here - does this actual defin the namespace used by the GML?
*
*
*
* NameSpaceInfoDTO nsDto = new NameSpaceInfoDTO(); nsDto.setDefault(false);
* nsDto.setPrefix("me"); nsDto.setUri("dzwiers.refraction.net");
*
*
* @author dzwiers, Refractions Research, Inc.
* @version $Id: NameSpaceInfoDTO.java 6326 2007-03-15 18:36:40Z jdeolive $
*/
public final class NameSpaceInfoDTO implements DataTransferObject {
//public static final String PREFIX_DELIMITER = ":";
/** The namespace prefix. */
private String prefix;
/** The URI for this namespace. */
private String uri;
/** Whether this is the default namespace. */
private boolean _default = false;
/**
* NameSpaceConfig constructor.
*
*
* does nothing
*
*/
public NameSpaceInfoDTO() {
}
/**
* NameSpaceConfig constructor.
*
*
* Creates a copy of the NameSpaceConfig provided. If the NameSpaceConfig
* provided is null then default values are used. All the data structures
* are cloned.
*
*
* @param ns The namespace to copy.
*
* @throws NullPointerException DOCUMENT ME!
*/
public NameSpaceInfoDTO(NameSpaceInfoDTO ns) {
if (ns == null) {
throw new NullPointerException();
}
prefix = ns.getPrefix();
uri = ns.getUri();
_default = ns.isDefault();
}
/**
* Implement clone.
*
*
* creates a clone of this object
*
*
* @return A copy of this NameSpaceConfig
*
* @see java.lang.Object#clone()
*/
public Object clone() {
return new NameSpaceInfoDTO(this);
}
/**
* Implement equals.
*
*
* recursively tests to determine if the object passed in is a copy of this
* object.
*
*
* @param obj The NameSpaceConfig object to test.
*
* @return true when the object passed is the same as this object.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if ((obj == null) || !(obj instanceof NameSpaceInfoDTO)) {
return false;
}
NameSpaceInfoDTO ns = (NameSpaceInfoDTO) obj;
return ((prefix == ns.getPrefix())
&& ((uri == ns.getUri()) && (_default == ns.isDefault())));
}
/**
* Implement hashCode.
*
* @return Service hashcode or 0
*
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
int r = 1;
if (prefix != null) {
r *= prefix.hashCode();
}
if (uri != null) {
r *= uri.hashCode();
}
return r;
}
/**
* isDefault purpose.
*
*
* Description ...
*
*
* @return
*/
public boolean isDefault() {
return _default;
}
/**
* getPrefix purpose.
*
*
* Description ...
*
*
* @return
*/
public String getPrefix() {
return prefix;
}
/**
* getUri purpose.
*
*
* Description ...
*
*
* @return
*/
public String getUri() {
return uri;
}
/**
* setDdefault purpose.
*
*
* Description ...
*
*
* @param b
*/
public void setDefault(boolean b) {
_default = b;
}
/**
* setPrefix purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setPrefix(String string) {
prefix = string;
}
/**
* setUri purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setUri(String string) {
uri = string;
}
public String toString() {
return "xmlns:" + getPrefix() + "=\"" + getUri() + "\", isDefault=" + _default;
}
}