protected final void logInitParameters (@Nonnull final ServletContext aSC) { // Put them in a sorted map final ICommonsNavigableMap <String, String> aParams = new CommonsTreeMap <> (); final Enumeration <?> aEnum = aSC.getInitParameterNames (); while (aEnum.hasMoreElements ()) { final String sName = (String) aEnum.nextElement (); final String sValue = aSC.getInitParameter (sName); aParams.put (sName, sValue); } if (aParams.isEmpty ()) LOGGER.info ("No servlet context init-parameters present"); else { // Emit them LOGGER.info ("Servlet context init-parameters:"); for (final Map.Entry <String, String> aEntry : aParams.entrySet ()) LOGGER.info (" " + aEntry.getKey () + "=" + aEntry.getValue ()); } }
public boolean contains (@Nullable final String sName) { if (StringHelper.hasNoText (sName)) return false; return m_aMap.containsKey (sName); }
@Nullable public String get (@Nullable final String sName) { if (StringHelper.hasNoText (sName)) return null; return m_aMap.get (sName); }
/** * Add a new variable. * * @param sName * The name of the variable. May neither be <code>null</code> nor * empty. * @param sValue * The value of the variable. May neither be <code>null</code> nor * empty. * @return {@link EChange#UNCHANGED} if a variable with the same name is * already present. Never <code>null</code>. */ @Nonnull public EChange add (@Nonnull @Nonempty final String sName, @Nonnull @Nonempty final String sValue) { ValueEnforcer.notEmpty (sName, "Name"); ValueEnforcer.notEmpty (sValue, "Value"); // Prepend the "$" prefix to the variable name final String sRealName = PSXPathQueryBinding.PARAM_VARIABLE_PREFIX + sName; if (m_aMap.containsKey (sRealName)) return EChange.UNCHANGED; // Apply all existing variables to this variable value! // This ensures that all variables used in variables are resolved correctly // as long as the order of declaration is correct. // Additionally this means that the order of the variables in this class is // irrelevant final String sRealValue = getAppliedReplacement (sValue); m_aMap.put (sRealName, sRealValue); return EChange.CHANGED; }
@Nonnull @ReturnsMutableCopy public ICommonsNavigableMap <String, String> getStringReplacementMap (@Nonnull final List <PSParam> aParams) { final ICommonsNavigableMap <String, String> ret = new CommonsTreeMap <> (IComparator.getComparatorStringLongestFirst ()); for (final PSParam aParam : aParams) ret.put (PARAM_VARIABLE_PREFIX + aParam.getName (), aParam.getValue ()); return ret; }
@Nonnull @ReturnsMutableCopy public ICommonsNavigableMap <String, String> getAll () { return m_aMap.getClone (); }
/** * Remove the variable with the specified name * * @param sVarName * The name of the variable to be removed. May be <code>null</code>. * @return {@link EChange#CHANGED} if the variable was removed successfully. * Never <code>null</code>. */ @Nonnull public EChange remove (@Nullable final String sVarName) { if (StringHelper.hasText (sVarName)) if (m_aMap.remove (PSXPathQueryBinding.PARAM_VARIABLE_PREFIX + sVarName) == null) return EChange.CHANGED; return EChange.UNCHANGED; }
/** * Add a new variable. * * @param sName * The name of the variable. May neither be <code>null</code> nor * empty. * @param sValue * The value of the variable. May neither be <code>null</code> nor * empty. * @return {@link EChange#UNCHANGED} if a variable with the same name is * already present. Never <code>null</code>. */ @Nonnull public EChange add (@Nonnull @Nonempty final String sName, @Nonnull @Nonempty final String sValue) { ValueEnforcer.notEmpty (sName, "Name"); ValueEnforcer.notEmpty (sValue, "Value"); // Prepend the "$" prefix to the variable name final String sRealName = PSXPathQueryBinding.PARAM_VARIABLE_PREFIX + sName; if (m_aMap.containsKey (sRealName)) return EChange.UNCHANGED; // Apply all existing variables to this variable value! // This ensures that all variables used in variables are resolved correctly // as long as the order of declaration is correct. // Additionally this means that the order of the variables in this class is // irrelevant final String sRealValue = getAppliedReplacement (sValue); m_aMap.put (sRealName, sRealValue); return EChange.CHANGED; }
@Nonnull @ReturnsMutableCopy public ICommonsNavigableMap <String, String> getStringReplacementMap (@Nonnull final List <PSParam> aParams) { final ICommonsNavigableMap <String, String> ret = new CommonsTreeMap <> (IComparator.getComparatorStringLongestFirst ()); for (final PSParam aParam : aParams) ret.put (PARAM_VARIABLE_PREFIX + aParam.getName (), aParam.getValue ()); return ret; }
@Nonnull @ReturnsMutableCopy public ICommonsNavigableMap <String, String> getAll () { return m_aMap.getClone (); }
/** * Remove the variable with the specified name * * @param sVarName * The name of the variable to be removed. May be <code>null</code>. * @return {@link EChange#CHANGED} if the variable was removed successfully. * Never <code>null</code>. */ @Nonnull public EChange remove (@Nullable final String sVarName) { if (StringHelper.hasText (sVarName)) if (m_aMap.remove (PSXPathQueryBinding.PARAM_VARIABLE_PREFIX + sVarName) == null) return EChange.CHANGED; return EChange.UNCHANGED; }
public boolean contains (@Nullable final String sName) { if (StringHelper.hasNoText (sName)) return false; return m_aMap.containsKey (sName); }
@Nullable public String get (@Nullable final String sName) { if (StringHelper.hasNoText (sName)) return null; return m_aMap.get (sName); }