Tabnine Logo
StrLookup
Code IndexAdd Tabnine to your IDE (free)

How to use
StrLookup
in
org.apache.commons.lang.text

Best Java code snippets using org.apache.commons.lang.text.StrLookup (Showing top 20 results out of 315)

origin: commons-lang/commons-lang

/**
 * Internal method that resolves the value of a variable.
 * <p>
 * Most users of this class do not need to call this method. This method is
 * called automatically by the substitution process.
 * <p>
 * Writers of subclasses can override this method if they need to alter
 * how each substitution occurs. The method is passed the variable's name
 * and must return the corresponding value. This implementation uses the
 * {@link #getVariableResolver()} with the variable's name as the key.
 *
 * @param variableName  the name of the variable, not null
 * @param buf  the buffer where the substitution is occurring, not null
 * @param startPos  the start position of the variable including the prefix, valid
 * @param endPos  the end position of the variable including the suffix, valid
 * @return the variable's value or <b>null</b> if the variable is unknown
 */
protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) {
  StrLookup resolver = getVariableResolver();
  if (resolver == null) {
    return null;
  }
  return resolver.lookup(variableName);
}
origin: commons-lang/commons-lang

/**
 * Creates a new instance and initializes it. Uses defaults for variable
 * prefix and suffix and the escaping character.
 *
 * @param valueMap  the map with the variables' values, may be null
 */
public StrSubstitutor(Map valueMap) {
  this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
}
origin: commons-lang/commons-lang

/**
 * Replaces all the occurrences of variables in the given source object with
 * their matching values from the system properties.
 *
 * @param source  the source text containing the variables to substitute, null returns null
 * @return the result of the replace operation
 */
public static String replaceSystemProperties(Object source) {
  return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
origin: org.apache.commons/org.motechproject.org.apache.commons.configuration

/**
 * Obtains the lookup object for the specified prefix. This method is called
 * by the {@code lookup()} method. This implementation will check
 * whether a lookup object is registered for the given prefix. If not, a
 * <b>null</b> lookup object will be returned (never <b>null</b>).
 *
 * @param prefix the prefix
 * @return the lookup object to be used for this prefix
 */
protected StrLookup fetchLookupForPrefix(String prefix)
{
  StrLookup lookup = localLookups.get(prefix);
  if (lookup == null)
  {
    lookup = StrLookup.noneLookup();
  }
  return lookup;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration

/**
 * Obtains the lookup object for the specified prefix. This method is called
 * by the {@code lookup()} method. This implementation will check
 * whether a lookup object is registered for the given prefix. If not, a
 * <b>null</b> lookup object will be returned (never <b>null</b>).
 *
 * @param prefix the prefix
 * @return the lookup object to be used for this prefix
 */
protected StrLookup fetchLookupForPrefix(String prefix)
{
  StrLookup lookup = localLookups.get(prefix);
  if (lookup == null)
  {
    lookup = StrLookup.noneLookup();
  }
  return lookup;
}
origin: commons-lang/commons-lang

/**
 * Creates a new instance and initializes it.
 *
 * @param valueMap  the map with the variables' values, may be null
 * @param prefix  the prefix for variables, not null
 * @param suffix  the suffix for variables, not null
 * @param escape  the escape character
 * @throws IllegalArgumentException if the prefix or suffix is null
 */
public StrSubstitutor(Map valueMap, String prefix, String suffix, char escape) {
  this(StrLookup.mapLookup(valueMap), prefix, suffix, escape);
}
origin: org.apache.marmotta/marmotta-core

  @Override
  public String lookup(String key) {
    return Pattern.quote(_int.getDefaultLookup().lookup(key));
  }
});
origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * Replaces all the occurrences of variables in the given source object with
 * their matching values from the system properties.
 *
 * @param source  the source text containing the variables to substitute, null returns null
 * @return the result of the replace operation
 */
public static String replaceSystemProperties(Object source) {
  return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
origin: org.apache.commons/org.motechproject.org.apache.commons.configuration

/**
 * Returns the lookup object to be used for variables without a prefix. This
 * implementation will check whether a default lookup object was set. If
 * this is the case, it will be returned. Otherwise a <b>null</b> lookup
 * object will be returned (never <b>null</b>).
 *
 * @return the lookup object to be used for variables without a prefix
 */
protected StrLookup fetchNoPrefixLookup()
{
  return (getDefaultLookup() != null) ? getDefaultLookup() : StrLookup.noneLookup();
}
origin: commons-lang/commons-lang

/**
 * Creates a new instance and initializes it. Uses a default escaping character.
 *
 * @param valueMap  the map with the variables' values, may be null
 * @param prefix  the prefix for variables, not null
 * @param suffix  the suffix for variables, not null
 * @throws IllegalArgumentException if the prefix or suffix is null
 */
public StrSubstitutor(Map valueMap, String prefix, String suffix) {
  this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);
}
origin: org.apache.marmotta/marmotta-core

  @Override
  public String lookup(String key) {
    try {
      return URLEncoder.encode(_int.getDefaultLookup().lookup(key), "utf8");
    } catch (UnsupportedEncodingException e) {
      return _int.getDefaultLookup().lookup(key);
    }
  }
});
origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.lang

/**
 * Replaces all the occurrences of variables in the given source object with
 * their matching values from the system properties.
 *
 * @param source  the source text containing the variables to substitute, null returns null
 * @return the result of the replace operation
 */
public static String replaceSystemProperties(Object source) {
  return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration

/**
 * Returns the lookup object to be used for variables without a prefix. This
 * implementation will check whether a default lookup object was set. If
 * this is the case, it will be returned. Otherwise a <b>null</b> lookup
 * object will be returned (never <b>null</b>).
 *
 * @return the lookup object to be used for variables without a prefix
 */
protected StrLookup fetchNoPrefixLookup()
{
  return (getDefaultLookup() != null) ? getDefaultLookup() : StrLookup.noneLookup();
}
origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * Creates a new instance and initializes it. Uses a default escaping character.
 *
 * @param valueMap  the map with the variables' values, may be null
 * @param prefix  the prefix for variables, not null
 * @param suffix  the suffix for variables, not null
 * @throws IllegalArgumentException if the prefix or suffix is null
 */
public StrSubstitutor(Map valueMap, String prefix, String suffix) {
  this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);
}
origin: apache/marmotta

  @Override
  public String lookup(String key) {
    return Pattern.quote(_int.getDefaultLookup().lookup(key));
  }
});
origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Replaces all the occurrences of variables in the given source object with
 * their matching values from the system properties.
 *
 * @param source  the source text containing the variables to substitute, null returns null
 * @return the result of the replace operation
 */
public static String replaceSystemProperties(Object source) {
  return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.lang

/**
 * Creates a new instance and initializes it. Uses a default escaping character.
 *
 * @param valueMap  the map with the variables' values, may be null
 * @param prefix  the prefix for variables, not null
 * @param suffix  the suffix for variables, not null
 * @throws IllegalArgumentException if the prefix or suffix is null
 */
public StrSubstitutor(Map valueMap, String prefix, String suffix) {
  this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);
}
origin: apache/marmotta

  @Override
  public String lookup(String key) {
    try {
      return URLEncoder.encode(_int.getDefaultLookup().lookup(key), "utf8");
    } catch (UnsupportedEncodingException e) {
      return _int.getDefaultLookup().lookup(key);
    }
  }
});
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Replaces all the occurrences of variables in the given source object with
 * their matching values from the system properties.
 *
 * @param source  the source text containing the variables to substitute, null returns null
 * @return the result of the replace operation
 */
public static String replaceSystemProperties(Object source) {
  return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Creates a new instance and initializes it.
 *
 * @param valueMap  the map with the variables' values, may be null
 * @param prefix  the prefix for variables, not null
 * @param suffix  the suffix for variables, not null
 * @param escape  the escape character
 * @throws IllegalArgumentException if the prefix or suffix is null
 */
public StrSubstitutor(Map valueMap, String prefix, String suffix, char escape) {
  this(StrLookup.mapLookup(valueMap), prefix, suffix, escape);
}
org.apache.commons.lang.textStrLookup

Javadoc

Lookup a String key to a String value.

This class represents the simplest form of a string to string map. It has a benefit over a map in that it can create the result on demand based on the key.

This class comes complete with various factory methods. If these do not suffice, you can subclass and implement your own matcher.

For example, it would be possible to implement a lookup that used the key as a primary key, and looked up the value on demand from the database

Most used methods

  • lookup
    Looks up a String key to a String value. The internal implementation may use any mechanism to return
  • mapLookup
    Returns a lookup which looks up values using a map. If the map is null, then null will be returned f
  • systemPropertiesLookup
    Returns a lookup which uses System#getProperties()to lookup the key to value. If a security manager
  • noneLookup
    Returns a lookup which always returns null.

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • putExtra (Intent)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Permission (java.security)
    Legacy security code; do not use.
  • JList (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now