Test whether the give package name is a valid Java package.

@param packageName The name of the package
@return True if it is valid
497056
public static boolean isValidJavaPackage(String packageName) {
        if (isBlank(packageName)) {
            return false;
        }
        final String[] parts = packageName.split("\\.");
        for (String part : parts) {
            if (!isValidJavaIdentifier(part)) {
                return false;
            }
        }
        return true;
    }
120637
public static boolean isPackageValid(final Class type) {
        boolean res = false;
        if (type != null) {
            final Package packaj = type.getPackage();
            res = !(packaj == null || packaj.getName().startsWith("java"));
        }
        return res;
    }
916551
public static boolean isJavaIdentifier(String name) {
        if (name.length() == 0 || INVALID_JAVA_IDENTIFIERS.contains(name)) return false;
        char[] chars = name.toCharArray();
        if (!Character.isJavaIdentifierStart(chars[0])) return false;
        for (int i = 1; i < chars.length; i++ ) {
            if (!Character.isJavaIdentifierPart(chars[i])) return false;
        }
        return true;
    }
1334523
private function isPackageRequired(string $packageName): bool
    {
        foreach ($this->composer->getPackage()->getRequires() as $require) {
            if ($require->getTarget() === $packageName) {
                return true;
            }
        }

        return false;
    }
787961
public function hasDataPackageKey($dataKey, $packageName)
    {
        if (isset($this->data[$dataKey]) && is_array($this->data[$dataKey])) {
            $packageName = strtolower($packageName);
            foreach (array_keys($this->data[$dataKey]) as $k) {
                if (strtolower($k) === $packageName) {
                    return true;
                }
            }
        }
        return false;
    }
711192
def packageExists(self, package):
		
		url = "%s/packages" % self.base_url
		params = {"pattern": package}
		response = requests.get(url, params=params)
		if response.status_code != requests.codes.ok:
			return False

		return True
560968
public static boolean containsInvalid(String fileName) {
		return StrUtil.isBlank(fileName) ? false : ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
	}
626665
public void addAllowedPackage(String packageName) {
        if (packageName.endsWith(".")) {
            packageName = packageName.substring(0, packageName.length() - 1);
        }

        String packageRegex = START + dotsToRegex(packageName) + SEP + JAVA_IDENTIFIER_PART + "+.class$";
        LOG.debug("Package regex: {}", packageRegex);
        patternList.add(Pattern.compile(packageRegex).matcher(""));
    }
1219629
public boolean hasSamePackageOfSchema() {
		String packageName = getPackageName();
		String schemaPackageName = getParent().getPackageName();

		return packageName.equals(schemaPackageName);
	}
650472
protected static boolean isValidFilename(String filename) {
		if (filename == null || filename.length() == 0) {
			throw new NullPointerException("文件名不能为空.");
		}
		if (filename.indexOf("..") != -1) {
			throw new IllegalArgumentException("文件名称不能包含'..'");
		}
		Matcher m = FILENAME_PATTERN.matcher(filename);
		return m.matches();
	}
1289188
public static ValidationResult validatePackageName(String packageName)
   {
      if (Strings.isNullOrEmpty(packageName))
         return new ValidationResult(ERROR, Messages.notNullOrEmpty(PACKAGE_NAME));
      int indexOfDot = packageName.indexOf(".");
      if (indexOfDot == -1)
      {
         return validateIdentifier(packageName, PACKAGE_NAME);
      }
      else if (indexOfDot == 0)
      {
         return new ValidationResult(ERROR, "The package name must not start with a '.'");
      }
      else if (packageName.charAt(packageName.length() - 1) == '.')
      {
         return new ValidationResult(ERROR, "The package name must not end with a '.'");
      }
      else
      {
         String[] names = packageName.split("[.]");
         for (String name : names)
         {
            if (Strings.isNullOrEmpty(name))
            {
               return new ValidationResult(ERROR, Messages.isInvalidPackageName(packageName));
            }
            ValidationResult result = validateIdentifier(name, PACKAGE_NAME);
            if (!result.getType().equals(ResultType.INFO))
            {
               return result;
            }
         }
      }
      return new ValidationResult(INFO);
   }
1011154
protected boolean isExist(String rootPackageName, String lastClassName) {
        final Resources[] checkerArray = getExistCheckerArray(rootPackageName);
        for (int i = 0; i < checkerArray.length; ++i) {
            if (checkerArray[i].isExistClass(lastClassName)) {
                return true;
            }
        }
        return false;
    }
53837
public function hasPackage($package_name)
    {
        if (!isset($this->packages_instances[$package_name])) {
            try {
                $this->packages_instances[$package_name] = $this->_buildNewPackage($package_name);
            } catch (\Exception $e) {
            }
        }
        return isset($this->packages_instances[$package_name]);
    }
303515
public static boolean isValid(String name) {
		char[] nameChars = name.toCharArray();
		for (int i = 0; i < nameChars.length; i++) {
			boolean valid = i == 0 ? Character.isJavaIdentifierStart(nameChars[i]) : Character.isJavaIdentifierPart(nameChars[i]);
			if (!valid) {
				return valid;
			}
		}
		return true;
	}
608760
public static boolean isMdwPackage(String packageName) {
        return packageName.startsWith("com.centurylink.mdw.") &&
                !packageName.startsWith("com.centurylink.mdw.demo") &&
                !packageName.startsWith("com.centurylink.mdw.oracle") &&
                !packageName.startsWith("com.centurylink.mdw.ibmmq") &&
                !packageName.startsWith("com.centurylink.mdw.tibco") &&
                !packageName.startsWith("com.centurylink.mdw.tests.ibmmq") &&
                !packageName.startsWith("com.centurylink.mdw.tests.tibco") &&
                !packageName.startsWith("com.centurylink.mdw.internal") &&
                !packageName.startsWith("com.centurylink.mdw.ignore") &&
                !packageName.startsWith("com.centurylink.mdw.node.node_modules") &&
                !packageName.startsWith("com.centurylink.mdw.authCTL") &&
                !packageName.startsWith("com.centurylink.mdw.emp") &&
                !packageName.startsWith("com.centurylink.mdw.statusmgr") &&
                !packageName.startsWith("com.centurylink.mdw.tests.statusmgr");
    }
1223477
static function isValidName( $packageName, &$transformedPackageName = null )
    {
        $trans = eZCharTransform::instance();
        $transformedPackageName = $trans->transformByGroup( $packageName, 'identifier' );

        return $transformedPackageName === $packageName;
    }
208122
public static boolean isValidName( String name ) {
        if (name == null || name.length() == 0) return false;
        CharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if (!isValidNameStart(c)) return false;
        while (c != CharacterIterator.DONE) {
            if (!isValidName(c)) return false;
            c = iter.next();
        }
        return true;
    }