/* 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.AssertException; import xbn.named.Named; import xbn.string.UtilString; import xbn.string.padchop.PadChopString; import xbn.string.padchop.ConfigPad; /**
A JDFile that is explicitely defined it the jdlcode doclet class map configuration file. See getJDCAFromFLR.
Manage a set of JDClasses with JDCArray
Source code: JDClass.java.
Create a JDClass.
@param s_abbreviation The abbreviation assigned to this class. For example, you might assign "s" tojava.lang.String
. Must contain only letters, digits and underscores. See getAbbreviation.
@param s_fullyQualifiedClassName Must conform to the following restrictions:Get the abbreviation assigned to this JDClass.
@return s_abbreviation, exactly as provided to the constructor. **/ public String getAbbreviation() { return sAbbreviation; } /**Determine what the name of this JDClass should be.
Get with isNameAbbrevOrFQCN
What is the name of this JDClass?. The abbreviation or the fully qualified class name?
Set with setNameAbbrevOrFQCN
Get theh name of this JDClass.
@returngetAbbreviation()
if isNameAbbrevOrFQCN is true.
getList(".")
if isNameAbbrevOrFQCN is false.
**/
public String getName() {
if(isNameAbbrevOrFQCN()) {
return getAbbreviation();
}
return getList(".");
}
/**
Get the PackageType of this JDClass.
@return null If this JDClass is primitive.Get the PackageType prefix of this JDClass.
@return "primitive" If this JDClass is primitive.getPackageType().getPrefix()
If this JDClass is local or external.
**/
public String getPackageTypePrefix() {
if(isPrimitive()) {
return "primitive";
}
return getPackageType().getPrefix();
}
/**
Is this JDClass primitive?
@return(getPackageType() == null)
**/
public boolean isPrimitive() {
return (getPackageType() == null);
}
/**
Is this JDClass local?
@return true If both isPrimitive andgetPackageType().isExternal()
equal false.
**/
public boolean isLocal() {
if(isPrimitive()) {
return false;
}
return !getPackageType().isExternal();
}
/**
Is this JDClass external?
@return true If isPrimitive equals false andgetPackageType().isExternal()
equals true.
**/
public boolean isExternal() {
if(isPrimitive()) {
return false;
}
return getPackageType().isExternal();
}
/**
Get the external url for this JDClass.
@returngetPackageType().getExternalUrl()
@exception AssertException if isExternal equals false.
**/
public String getExternalUrl() {
if(!isExternal()) {
throwAX("getExternalUrl: isExternal() equals false. The package type of this JDClass is either primitive or local.");
}
return getPackageType().getExternalUrl();
}
/**
Get some information about this JDClass.
**/ public String toString() { return pcsPad.get(getAbbreviation()) + super.toString(); } }