List of usage examples for org.apache.commons.configuration ConfigurationKey getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:edu.psu.citeseerx.utility.ConfigurationManager.java
/** * Returns the keycode associated with the specified key. The key code * is the full package path of the ConfigurationKey object up to * the last "."; e.g., the code for/*from w w w . j a v a 2 s .c o m*/ * edu.psu.citeseerx.corecom.ServerConfiguration$AccessKey is * "edu.psu.citeseer.corecom". * @param key * @return Key code associated with the specified key. */ private String getKeyCode(ConfigurationKey key) { Class keyClass = key.getClass(); String keyClassName = keyClass.getName(); Pattern pattern = Pattern.compile("^(.*)\\."); Matcher matcher = pattern.matcher(keyClassName); matcher.find(); // Match the inner group. String keyCode = matcher.group(1); return keyCode; }
From source file:edu.psu.citeseerx.utility.ConfigurationManager.java
/** * Determines whether to accept the specified key. Currently, this * method makes sure that the key is not a public object. * @param key//w w w . java 2s. co m * @return true if the method returns. * @throws InvalidAccessKeyException if the key should not be accepted. */ private boolean isValidKey(ConfigurationKey key) throws InvalidAccessKeyException { Class keyClass = key.getClass(); int m = keyClass.getModifiers(); if (Modifier.isPublic(m)) { throw new InvalidAccessKeyException("Key has innapropriate scope"); } return true; }