Internal method to parse a style prefix.

@param  key the key to parse.

@return the prefix portion of the key.
165599
static String parsePrefix(String key) {
        if (key == null)
            return null;

        boolean inquotes = false;

        for (int i = 0; i < key.length(); i++) {
            char c = key.charAt(i);

            if (c == '"') {
                inquotes = !inquotes;
            } else if ((c == '[' || c == '.') && !inquotes) {
                return key.substring(0, i);
            }
        }

        return null;
    }
1260097
public function parseKey($key)
	{
		$segments = parent::parseKey($key);

		if (is_null($segments[0])) $segments[0] = '*';

		return $segments;
	}
400739
public final String getPath(final String key) {
        StringBuilder result = new StringBuilder();
        addPathTo(result);
        result.append(".");
        result.append(getPathElement(key));
        return result.toString();
    }
236057
@Override
  public String header(String key)
  {
    CharSegment buf = getHeaderBuffer(key);
    
    if (buf != null)
      return buf.toString();
    else
      return null;
  }
713153
@Override
	public String getProperty(final String key) {
		lock.readLock().lock();
		try {
			final boolean useLocalPrefixes = !mixDefaultAndLocalPrefixes && hasLocalPrefixConfigurations();
			final Object object = get(key, useLocalPrefixes);
			if (object instanceof String) {
				return (String) object;
			} else {
				if (object == null) {
					return null;
				}
				throw new IllegalStateException("The value of " + key + " is of type: " + object.getClass().getName());
			}
		} finally {
			lock.readLock().unlock();
		}
	}
505438
public String getString(String key) {
		if (key == null || key.isEmpty()) {
			return null;
		}
		String property = null;
		for (ConfigurationSource configurationSource : configurationSources) {
			property = configurationSource.getValue(key);
			if (property != null) {
				break;
			}
		}
		return property;
	}
1273382
public static RuleKey parse(String s) {
    int semiColonPos = s.indexOf(':');
    Preconditions.checkArgument(semiColonPos > 0, "Invalid rule key: " + s);
    String key = s.substring(0, semiColonPos);
    String repo = s.substring(semiColonPos + 1);
    return RuleKey.of(key, repo);
  }
347497
public String getKeyValue(String key){
        String keyName = keysMap.get(key);
        if (keyName != null){
            return keyName;
        }
        return ""; //key wasn't defined in keys properties file
    }
411250
private static boolean propMatchesPrefix(String prefix, String key) {
        return key.startsWith(prefix) && key.length() >= prefix.length();
    }
1114758
@Override
	public String getPrefixedKey(final String prefixString, final String key) {
		lock.readLock().lock();
		try {
			if (prefixString != null && prefixes.contains(prefixString) && key != null) {
				return new StringBuilder(prefixString).append(getPrefixDelimiter()).append(key).toString();
			}
		} finally {
			lock.readLock().unlock();
		}
		throw new IllegalArgumentException("The given prefix is not part of this PrefixConfig or the key is null.");
	}
853776
@Override
	public boolean containsValidPrefix(final String key) {
		if (key != null) {
			lock.readLock().lock();
			try {
				for (final String aPrefix : prefixes) {
					if (key.equals(aPrefix) || key.startsWith(aPrefix + getPrefixDelimiter())) {
						return true;
					}
				}
			} finally {
				lock.readLock().unlock();
			}
		}
		return false;
	}
669055
@SuppressWarnings("unchecked")
    public <T> T getCustom(String key) {
        return (T) custom.get(key);
    }
1076942
public char getChar(String key) {
        String s = getString(key);
        if (s == null || s.trim().length() == 0) {
            return (char) 0;
        } else {
            return s.charAt(0);
        }
    }
885013
public long getLong(String key) {
        final String value = this.props.getValue(key);
        if (StringUtils.isBlank(value)) {
            return 0;
        }

        return Long.parseLong(value);
    }
1099642
public long getLong(String key) {
    if (containsKey(key)) {
      return Long.parseLong(get(key));
    } else {
      throw new IllegalArgumentException("Missing key " + key + ".");
    }
  }
610722
@Override
	public boolean startsWithCurrentPrefix(final String key) {
		lock.readLock().lock();
		try {
			if (getPrefix() != null && key != null) {
				return key.startsWith(getPrefix() + getPrefixDelimiter());
			}
		} finally {
			lock.readLock().unlock();
		}
		return false;
	}
1015112
private static void checkKey(String key) throws IllegalArgumentException {
		if(key.endsWith(VALIDATED_SUFFIX)) throw new IllegalArgumentException("Key may not end with "+VALIDATED_SUFFIX+": "+key);
		if(key.endsWith(MODIFIED_SUFFIX)) throw new IllegalArgumentException("Key may not end with "+MODIFIED_SUFFIX+": "+key);
	}