public static void dumpDeprecatedKeys() { DeprecationContext deprecations = deprecationContext.get(); for (Map.Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { StringBuilder newKeys = new StringBuilder(); for (String newKey : entry.getValue().newKeys) { newKeys.append(newKey).append("\t"); } System.out.println(entry.getKey() + "\t" + newKeys.toString()); } }
public static void dumpDeprecatedKeys() { DeprecationContext deprecations = deprecationContext.get(); for (Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { StringBuilder newKeys = new StringBuilder(); for (String newKey : entry.getValue().newKeys) { newKeys.append(newKey).append("\t"); } System.out.println(entry.getKey() + "\t" + newKeys.toString()); } }
public static void dumpDeprecatedKeys() { DeprecationContext deprecations = deprecationContext.get(); for (Map.Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { StringBuilder newKeys = new StringBuilder(); for (String newKey : entry.getValue().newKeys) { newKeys.append(newKey).append("\t"); } System.out.println(entry.getKey() + "\t" + newKeys.toString()); } }
name = name.trim(); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps();
name = name.trim(); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps();
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); if (keyInfo != null) { if (!keyInfo.getAndSetAccessed()) {
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); warnOnceIfDeprecated(deprecations, name); for (String newKey : keyInfo.newKeys) {
/** * Returns alternative names (non-deprecated keys or previously-set deprecated keys) * for a given non-deprecated key. * If the given key is deprecated, return null. * * @param name property name. * @return alternative names. */ private String[] getAlternativeNames(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { //if deprecated key is previously set explicitly List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; }
/** * Returns alternative names (non-deprecated keys or previously-set deprecated keys) * for a given non-deprecated key. * If the given key is deprecated, return null. * * @param name property name. * @return alternative names. */ private String[] getAlternativeNames(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { //if deprecated key is previously set explicitly List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; }
private static DeprecatedKeyInfo getDeprecatedKeyInfo(String key) { return deprecationContext.get().getDeprecatedKeyMap().get(key); }
/** * Sets all deprecated properties that are not currently set but have a * corresponding new property that is set. Useful for iterating the * properties when all deprecated properties for currently set properties * need to be present. */ public void setDeprecatedProperties() { DeprecationContext deprecations = deprecationContext.get(); Properties props = getProps(); Properties overlay = getOverlay(); for (Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { String depKey = entry.getKey(); if (!overlay.contains(depKey)) { for (String newKey : entry.getValue().newKeys) { String val = overlay.getProperty(newKey); if (val != null) { props.setProperty(depKey, val); overlay.setProperty(depKey, val); break; } } } } }
/** * Sets all deprecated properties that are not currently set but have a * corresponding new property that is set. Useful for iterating the * properties when all deprecated properties for currently set properties * need to be present. */ public void setDeprecatedProperties() { DeprecationContext deprecations = deprecationContext.get(); Properties props = getProps(); Properties overlay = getOverlay(); for (Map.Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { String depKey = entry.getKey(); if (!overlay.contains(depKey)) { for (String newKey : entry.getValue().newKeys) { String val = overlay.getProperty(newKey); if (val != null) { props.setProperty(depKey, val); overlay.setProperty(depKey, val); break; } } } } }
/** * Returns whether or not a deprecated name has been warned. If the name is not * deprecated then always return false */ public static boolean hasWarnedDeprecation(String name) { DeprecationContext deprecations = deprecationContext.get(); if(deprecations.getDeprecatedKeyMap().containsKey(name)) { if(deprecations.getDeprecatedKeyMap().get(name).accessed.get()) { return true; } } return false; }
/** * checks whether the given <code>key</code> is deprecated. * * @param key the parameter which is to be checked for deprecation * @return <code>true</code> if the key is deprecated and * <code>false</code> otherwise. */ public static boolean isDeprecated(String key) { return deprecationContext.get().getDeprecatedKeyMap().containsKey(key); }
private static DeprecatedKeyInfo getDeprecatedKeyInfo(String key) { return deprecationContext.get().getDeprecatedKeyMap().get(key); }
/** * Returns whether or not a deprecated name has been warned. If the name is not * deprecated then always return false */ public static boolean hasWarnedDeprecation(String name) { DeprecationContext deprecations = deprecationContext.get(); if(deprecations.getDeprecatedKeyMap().containsKey(name)) { if(deprecations.getDeprecatedKeyMap().get(name).accessed.get()) { return true; } } return false; } }
/** * Returns whether or not a deprecated name has been warned. If the name is not * deprecated then always return false */ public static boolean hasWarnedDeprecation(String name) { DeprecationContext deprecations = deprecationContext.get(); if(deprecations.getDeprecatedKeyMap().containsKey(name)) { if(deprecations.getDeprecatedKeyMap().get(name).accessed.get()) { return true; } } return false; }
private void warnOnceIfDeprecated(DeprecationContext deprecations, String name) { DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); if (keyInfo != null && !keyInfo.getAndSetAccessed()) { LOG_DEPRECATION.info(keyInfo.getWarningMessage(name)); } }
/** * checks whether the given <code>key</code> is deprecated. * * @param key the parameter which is to be checked for deprecation * @return <code>true</code> if the key is deprecated and * <code>false</code> otherwise. */ public static boolean isDeprecated(String key) { return deprecationContext.get().getDeprecatedKeyMap().containsKey(key); }
/** * checks whether the given <code>key</code> is deprecated. * * @param key the parameter which is to be checked for deprecation * @return <code>true</code> if the key is deprecated and * <code>false</code> otherwise. */ public static boolean isDeprecated(String key) { return deprecationContext.get().getDeprecatedKeyMap().containsKey(key); }