|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.api.convertor; import org.netbeans.spi.convertor.Convertor; /** * Convertor descriptor describes basic capability of the convertor, * that is the XML namespace and element name which the convertor * is capable to read, and (optional) class name which instances the convertor is * capable to persist. Only the instances of the particular Java class * will be persisted by the convertor. All subclasses must have their own * convertors. For more details about semantics of these attributes see * {@link org.netbeans.spi.convertor.Convertor} class Javadoc. * * @author David Konecny */ public final class ConvertorDescriptor extends Object { private String namespace; private String rootElement; private String writes; private Convertor convertor; ConvertorDescriptor(Convertor convertor, String namespace, String rootElement, String writes) { assert namespace != null && rootElement != null; this.namespace = namespace; this.rootElement = rootElement; this.writes = writes; this.convertor = convertor; } /** * Gets the XML namespace which the convertor can read. * * @return XML namespace; cannot be null */ public String getNamespace() { return namespace; } /** * Gets the root element name which the convertor can read. * * @return root element name; cannot be null */ public String getElementName() { return rootElement; } /** * Gets the fully qualified name of the class which instances * the convertor can persist. It can be null what means * that convertor cannot persist any class. * * @return fully qualified name of the class or null if * this convertor does not persist any class */ public String getClassName() { return writes; } public boolean equals(Object o) { if (!(o instanceof ConvertorDescriptor)) { return false; } ConvertorDescriptor cd = (ConvertorDescriptor)o; return namespace.equals(cd.namespace) && (writes != null ? writes.equals(cd.writes) : cd.writes == null); } public int hashCode() { int result = 7; result = 31*result + namespace.hashCode(); result = 31*result + rootElement.hashCode(); if (writes != null) { result = 31*result + writes.hashCode(); } return result; } public String toString() { return "ConvertorDescriptor[namespace="+namespace+", element="+rootElement+", writes="+writes+", convertor="+convertor+"]"+super.toString(); } Convertor getConvertor() { return convertor; } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.