Create a key from a string representation (see {@link #toString()}. An {@link IllegalArgumentException} is raised
if the format is not valid.
169212
public static ActiveRuleKey parse(String s) {
    Preconditions.checkArgument(s.split(":").length >= 3, "Bad format of activeRule key: " + s);
    int semiColonPos = s.indexOf(':');
    String ruleProfileUuid = s.substring(0, semiColonPos);
    String ruleKey = s.substring(semiColonPos + 1);
    return new ActiveRuleKey(ruleProfileUuid, RuleKey.parse(ruleKey));
  }
515326
public String format(String key) {
        if (traceNLS != null) {
            return traceNLS.getString(key);
        } else {
            return key;
        }
    }
794066
private String generateKey(String key,
      HashMap<String, String[]>[] queryVariables) {
    StringBuilder newKey = new StringBuilder(key);
    newKey.append(" -");
    for (int q = 0; q < queryVariables.length; q++) {
      if (queryVariables[q] != null && queryVariables[q].size() > 0) {
        for (String name : queryVariables[q].keySet()) {
          newKey.append(" q" + q + ":$" + name + "=");
          if (queryVariables[q].get(name) != null
              && queryVariables[q].get(name).length == 1) {
            newKey.append("'" + queryVariables[q].get(name)[0]
                .replace("\\", "\\\\").replace(",", "\\,") + "'");
          } else {
            newKey.append("-");
          }
        }
      }
    }
    return newKey.toString();
  }
741846
@NotNull
    public static Key<String> stringKey(@NotNull String name) {
        return create(name, String.class);
    }
564870
@Nonnull
    public String createValidityInfoKeyName( @Nonnull final String origKey ) {
        if ( origKey == null ) {
            throw new IllegalArgumentException( "The sessionId must not be null." );
        }
        return "validity:" + _storageKeyFormat.format(origKey);
    }
783650
String serializeToString() {
    final StringBuilder sb = new StringBuilder();
    sb.append(String.format("%d,%d,", numActive, keys.length));

    for (int i = 0; i < keys.length; i++) {
      if (states[i] != 0) {
        sb.append(String.format("%d,%d,", keys[i], values[i]));
      }
    }
    return sb.toString();
  }
667973
public String convertString(String string)
    {        
        int start;
        int end = 0;
        while ((start = string.indexOf("k", end)) > 0)
        {
            end = start + 1;
            char ch = string.charAt(start - 1);
            if ((ch != '.') && (ch != ' '))
                continue;
            ch = string.charAt(start + 1);
            if (!Character.isUpperCase(ch))
                continue;
            boolean isUpper = false;
            for (; end < string.length(); end++)
            {
                 ch = string.charAt(end);
                if (!Character.isJavaIdentifierPart(ch))
                    break;
                if (!Character.isUpperCase(ch))
                    isUpper = true;
            }
            if (!isUpper) if ((end - start) >= 3)
                continue;
            if (end >= string.length())
                break;

            String newName = convertNameToConstant(string.substring(start+1, end));
            
            string = string.substring(0, start) + newName + string.substring(end);

        }
        return string;
    }
1068477
public Object put(Object key, Object value)
    {
        if (null == key) throw new IllegalArgumentException("key must not be null");
        if (!(key instanceof String)) throw new IllegalArgumentException("key must be a String");

        if (!isValidObject(value))
        {
            if (value != null)
            {
                throw new IllegalArgumentException("Invalid type of value.  Type: [" + value.getClass().getName() + "] with value: [" + value.toString() + "]");
            }
            else
            {
                throw new IllegalArgumentException("Invalid type of value.");
            }
        }
        return super.put(key, value);
    }
597931
private Level createLevelByString(String levelString) throws IllegalArgumentException {
        try {
            return Level.parse(levelString.toUpperCase());
            //return WsLevel.parse(levelString.toUpperCase());
        } catch (Exception npe) {
            throw new IllegalArgumentException(getLocalizedParmString("CWTRA0013E", new Object[] { levelString }));
        }

    }
876602
public String getString(final String key, final Object... args) {
        String value = getString(key);
        if (value == null) {
            value = key;
        }

        MessageFormat mf = new MessageFormat(value);
        mf.setLocale(locale);
        return mf.format(args, new StringBuffer(), null).toString();
    }
233104
private String createString(String f)
    {
        StringBuilder sb = new StringBuilder();
        sb.append("p2pToken="+p2pToken+f);
        sb.append("vaSpaceToken="+vaSpaceToken+f);
        return sb.toString();
    }
1344736
public final IJSONSerializable<?> fromString(final String string) throws Exception, ValidationException
    {
        final ValidationContext ctx = new ValidationContext();

        ctx.setValidate(true);

        ctx.setStopOnError(true);

        final IJSONSerializable<?> result = fromString(string, ctx);

        if (ctx.getErrorCount() > 0)
        {
            throw new ValidationException(ctx);
        }
        if (null == result)
        {
            throw new Exception("Unknown reason for NULL result in JSONParser");
        }
        return result;
    }
372845
public static String decode( String s )
        throws IllegalArgumentException
    {
        s = s.replaceAll( "\n", "" );
        s = s.replaceAll( "\r", "" );
        byte[] sBytes = s.getBytes();
        sBytes = decode( sBytes );
        s = new String( sBytes );
        return s;
    }
240808
private String convertMethodKeyObject(final KeyGenerator methodGenerator, final Object keyValue) {
        String res = "";
        if (keyValue instanceof String) {
            res = (String) keyValue;
        } else {
            try {

                // The default annotation value is toString
                final List<Method> converterList = ClassUtility.retrieveMethodList(keyValue.getClass(), methodGenerator.value());

                Method converter = null;
                for (final Method m : converterList) {
                    if (m.getParameterTypes().length == 0) {
                        converter = m;
                    }
                }

                if (converter == null) {
                    LOGGER.log(METHOD_NOT_FOUND, methodGenerator.value(), keyValue.getClass().getSimpleName());
                } else {
                    // The toString will be called for a string
                    final Object localKey = converter.invoke(keyValue);

                    if (localKey == null) {
                        LOGGER.log(NULL_METHOD_KEY_STRING, converter.getName(), keyValue.getClass().getSimpleName());
                    } else {
                        res = localKey.toString();
                    }
                }
            } catch (final SecurityException e) {
                LOGGER.log(NO_TOSTRING_KEY_METHOD, methodGenerator.value(), keyValue.getClass().getSimpleName(), e);
            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
                LOGGER.log(METHOD_KEY_TOSTRING_FAILURE, methodGenerator.value(), keyValue.getClass().getSimpleName(), e);
            }
        }
        return res + "|";
    }
1287710
private static StringBuilder toStringBuilder(Readable input) throws IOException {
        StringBuilder text = new StringBuilder();
        CharBuffer buffer = CharBuffer.allocate(BUFFER_SIZE);
        while (true) {
            int n = input.read(buffer);
            if (n == -1) {
                break;
            }
            buffer.flip();
            text.append(buffer, 0, n);
        }
        return text;
    }
1300339
static Key str2Key(String s) {
    Key k = str2Key_impl(s);
    assert key2Str_impl(k, decodeType(s)).equals(s) : "bijection fail " + s + " <-> " + k;
    return k;
  }
1030607
public static final void validateKey(String key) throws IllegalArgumentException {
        if (StringUtils.isEmpty(key) || "..".equals(key) || ".".equals(key) || !KEY_PATTERN.matcher(key).matches()) {
            LOG.error("'{}' does not appear to be valid {}", key, KEY_PATTERN);
            throw new IllegalArgumentException(key+" does not appear to be a valid blob key");
        }
    }