/* XBN Java: Generically useful, non-GUI Java code. http://sourceforge.net/projects/xbnjava Copyright (C) 1997-2003, Jeff Epstein All rights reserved. Modifications: No Redistribution in binary form, with or without modifications, are permitted provided that the following conditions are met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * If modifications are made to source code then this license should indicate that fact in the "Modifications" section above. * Neither the author, nor the contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [NOTE: This license contains NO advertising clause.] */ package xbn.jdlcode; import xbn.XBNObject; import xbn.named.Named; import xbn.string.UtilString; import xbn.string.padchop.PadChopString; import xbn.string.padchop.ConfigPad; /**
Defines a package type whose classes are liked to, from your JavaDoc html files. Manage a set of PackageTypes with a PTArray.
Source code: PackageType.java.
All package types are defined above the "\~" line, in the doclet class map. See UtilJDLCode.getJDCAFromFLR and getPackageTypeFromLine.
@version 0.9b @author Jeff Epstein, http://sourceforge.net/projects/xbnjava. **/ public class PackageType extends XBNObject implements Named { private static UtilString uStr = new UtilString(); private static PadChopString pcspPrefix = new PadChopString(new ConfigPad(16)); private boolean bFound = false; private String sPrefix = null; private String sExternalUrl = null; /**Create a PackageType.
@param s_prefix The prefix of a package type. For example, the package type prefix forjava.lang.Object
java.io.File
java.sql.Connection
The package type prefix for
xbn.XBNObject
xbn.array.VWObject
xbn.util.UtilString
To do: Package prefixes should be allowed to have a dot in them. This will prevent conflicts when using multiple packages starting with "com.".
is xbn @param s_externalUrl The url to the external package's root JavaDoc directory, including the final slash. Inside of this url directory must exist a folder named (the value of) s_prefix. When null, this package type is local, meaning the JavaDoc files for these packages are generated by you. **/ public PackageType(String s_prefix, String s_externalUrl) { throwAXIfBadStr(s_prefix, "s_prefix", sCNSTR); sPrefix = s_prefix; sExternalUrl = s_externalUrl; bFound = false; } /**Get the prefix for this PackageType.
@return s_prefix, exactly as provided to the constructor. **/ public String getPrefix() { return sPrefix; } /**Is this PackageType external?
@return(getExternalUrl() != null)
**/
public boolean isExternal() {
return (getExternalUrl() != null);
}
/**
Is this PackageType local?
@return!isExternal()
**/
public boolean isLocal() {
return !isExternal();
}
/**
Get the prefix for this PackageType.
@return s_externalUrl, exactly as provided to the constructor. **/ public String getExternalUrl() { return sExternalUrl; } /**A synonym for getPrefix(). See getPrefix.
**/ public String getName() { return getPrefix(); } void setFound() { bFound = true; } boolean isFound() { return bFound; } /**Get some information about this PackageType.
**/ public String toString() { return pcspPrefix.get(sPrefix) + " " + uStr.getConditional(getExternalUrl(), "[LOCAL]"); } }