FileDocCategorySizeDatePackage
PackagePrefixChecker.javaAPI DocJava SE 5 API1613Fri Aug 26 14:54:34 BST 2005com.sun.corba.se.impl.util

PackagePrefixChecker

public final class PackagePrefixChecker extends Object
PackagePrefixChecker provides static utility methods for getting package prefixes.
author
M. Mortazavi

Fields Summary
private static final String
PACKAGE_PREFIX
Constructors Summary
Methods Summary
public static java.lang.StringcorrectPackageName(java.lang.String p)

        if (p==null) return p;
        if ( hasOffendingPrefix(p))
            {
               return PACKAGE_PREFIX+p;
            }
        return p;
    
public static booleanhasBeenPrefixed(java.lang.String p)

        return p.startsWith(packagePrefix());
    
public static booleanhasOffendingPrefix(java.lang.String p)

        return 
            (      p.startsWith("java.") || p.equals("java")
                // || p.startsWith("com.sun.") || p.equals("com.sun")
                || p.startsWith("net.jini.") || p.equals("net.jini")
                || p.startsWith("jini.") || p.equals("jini")
                || p.startsWith("javax.") || p.equals("javax")
            );
    
public static booleanisOffendingPackage(java.lang.String p)

        return
            !(p==null)
            &&
            ( false || hasOffendingPrefix(p) );
    
public static java.lang.StringpackagePrefix()


        return PACKAGE_PREFIX;
public static java.lang.StringwithoutPackagePrefix(java.lang.String p)

        if(hasBeenPrefixed(p)) return p.substring(packagePrefix().length());
        else return p;