1 7 package com.sun.corba.se.impl.util; 8 9 import java.io.File ; 10 11 15 16 public final class PackagePrefixChecker { 17 18 19 private static final String PACKAGE_PREFIX = "org.omg.stub."; 20 21 public static String packagePrefix(){ return PACKAGE_PREFIX;} 22 23 public static String correctPackageName (String p){ 24 if (p==null) return p; 25 if ( hasOffendingPrefix(p)) 26 { 27 return PACKAGE_PREFIX+p; 28 } 29 return p; 30 } 31 32 public static boolean isOffendingPackage(String p){ 33 return 34 !(p==null) 35 && 36 ( false || hasOffendingPrefix(p) ); 37 } 38 39 public static boolean hasOffendingPrefix(String p){ 40 return 41 ( p.startsWith("java.") || p.equals("java") 42 || p.startsWith("net.jini.") || p.equals("net.jini") 44 || p.startsWith("jini.") || p.equals("jini") 45 || p.startsWith("javax.") || p.equals("javax") 46 ); 47 } 48 49 public static boolean hasBeenPrefixed(String p){ 50 return p.startsWith(packagePrefix()); 51 } 52 53 public static String withoutPackagePrefix(String p){ 54 if(hasBeenPrefixed(p)) return p.substring(packagePrefix().length()); 55 else return p; 56 } 57 58 } 59 60 61 | Popular Tags |