@param key   key
@param value value to check for equality and regular expression if it is a valid regular expression

@return context with possible regular expression value match
972885
public static BasicEnvironmentalContext patternContextFor(String key, String value) {
        if (null == key) {
            throw new IllegalArgumentException("key cannot be null");
        }
        if (null == value) {
            throw new IllegalArgumentException("value cannot be null");
        }
        try {
            return new BasicEnvironmentalContext(key, value, Pattern.compile(value));
        } catch (PatternSyntaxException ignored) {
        }
        return new BasicEnvironmentalContext(key, value, null);
    }
1193424
@SuppressWarnings("unchecked")
	public <T> T defineContextualValue(String key, Object value) {
		return (T) this.values.put(key,  value);
	}
1302102
public final static void putContext(String key, Object value) {
        Map<String, Object> ctx = CTX_HOLDER.get();
        if (ctx == null) {
            // FIXME 需要注意释放，或者用软引用之类的替代，timewait或回收队列均可考虑
            ctx = new HashMap<String, Object>();
            CTX_HOLDER.set(ctx);
        }
        ctx.put(key, value);
    }
948371
static String getExpressValue(final String key) {
    if (isExpression(key)) {
      String keyValue = getSystemProperty(key.substring(2, key.length() - 1));
      return keyValue == null ? key : keyValue;
    } else {
      return key;
    }
  }
1186075
private boolean patternMatchesAttributeValue(final Object value) {
        val matcher = value.toString();
        LOGGER.trace("Compiling a pattern matcher for [{}]", matcher);
        return this.compiledPattern.matcher(matcher).matches();
    }
99611
public static final String replaceValueIfKeyIsPassword(String key, String value)
  {
    return replacePossiblePassword(containsPassword(key),value);
  }
279861
def _get_value(self, key, context):
        
        string_quotes = ('"', "'")

        if key[0] in string_quotes and key[-1] in string_quotes:
            return key[1:-1]
        if key in string.digits:
            return int(key)
        return context.get(key, None)
628654
@SuppressWarnings("unchecked")
    public M with(final String key, final short value) {
        validate(key, value);
        data.putValue(key, value);
        return (M) this;
    }
492794
public FluentValidator putAttribute2Context(String key, Object value) {
        if (context == null) {
            context = new ValidatorContext();
        }
        context.setAttribute(key, value);
        return this;
    }
185672
public AVIMConversationsQuery whereGreaterThanOrEqualsTo(String key, Object value) {
    conditions.whereGreaterThanOrEqualTo(key, value);
    return this;
  }
423132
public static boolean isValidStringMatchingRegex(final GraphObject node, final PropertyKey<String> key, final String expression, final ErrorBuffer errorBuffer) {

		final String value = node.getProperty(key);

		if (isValidStringMatchingRegex(value, expression)) {
			return true;
		}

		// no match
		errorBuffer.add(new MatchToken(node.getType(), key, expression));
		return false;
	}
292767
protected void setHeaderOutImpl(String key, String value)
  {
    int i = 0;
    boolean hasHeader = false;
    
    ArrayList<String> keys = _headerKeysOut;
    ArrayList<String> values = _headerValuesOut;

    for (i = keys.size() - 1; i >= 0; i--) {
      String oldKey = keys.get(i);

      if (oldKey.equalsIgnoreCase(key)) {
        if (hasHeader) {
          keys.remove(i);
          values.remove(i);
        }
        else {
          hasHeader = true;

          values.set(i, value);
        }
      }
    }

    if (! hasHeader) {
      keys.add(key);
      values.add(value);
    }
  }
401803
public AVIMConversationsQuery whereNotEqualsTo(String key, Object value) {
    conditions.whereNotEqualTo(key, value);
    return this;
  }
1153403
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		String result = regexPattern.matcher(value.toString()).replaceAll(replacement);
		return next.execute(result, context);
	}
922353
@SuppressWarnings("unchecked")
    public Object execute(final Object value, final CsvContext context) {
        
        if(value == null) {
            return next.execute(value, context);
        }
        
        final String stringValue = value.toString();
        final int length = stringValue.length();
        if( length < min || length > max ) {
            throw createValidationException(context)
                .messageFormat("the length (%d) of value '%s' does not lie between the min (%d) and max (%d) values (inclusive)",
                        length, stringValue, min, max)
                .rejectedValue(stringValue)
                .messageVariables("min", getMin())
                .messageVariables("max", getMax())
                .messageVariables("length", length)
                .build();
                
        }
        
        return next.execute(stringValue, context);
    }
767865
public static boolean matches(String pattern, String value) {
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(value);
        return m.matches();
    }
1031721
public boolean match(String value) {
    value = StringUtils.removeStart(value, "/");
    value = StringUtils.removeEnd(value, "/");
    return pattern.matcher(value).matches();
  }