/*
(non-Javadoc)

@see
edu.umd.cs.findbugs.ba.interproc.PropertyDatabase#parseKey(java.lang.
String)
514258
@Override
    protected FieldDescriptor parseKey(String s) throws PropertyDatabaseFormatException {
        String[] tuple = s.split(",");
        if (tuple.length != 4) {
            throw new PropertyDatabaseFormatException("Invalid field tuple: " + s);
        }

        String className = tuple[0];
        String fieldName = tuple[1];
        String signature = tuple[2];
        int accessFlags;
        try {
            accessFlags = Integer.parseInt(tuple[3]);
        } catch (NumberFormatException e) {
            throw new PropertyDatabaseFormatException("Invalid field access flags: " + tuple[3]);
        }

        return DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), fieldName, signature,
                (accessFlags & Const.ACC_STATIC) != 0);
    }
1136957
@SuppressWarnings("unchecked")
	K convertToGetValueOfParameter(final String rowKey) {
		final Object parameterValue = ConvertUtils.convert(rowKey,
				getkeyofParameterType);

		if (parameterValue.getClass().equals(getkeyofParameterType)) {
			return (K) parameterValue;
		} else {
			throw new RuntimeException("Unable to convert String "
					+ "based rowKey to " + getkeyofParameterType.getName());
		}
	}
445256
@Override
	protected Object customKey(Object key) {
		if (null != key && key instanceof CharSequence) {
			key = StrUtil.toCamelCase(key.toString());
		}
		return key;
	}
138522
function convertPropertyKeyToDataAttributeKey(propertyKey) {
    if (propertyKey.substr(0, 1) === "_") {
        propertyKey = propertyKey.substr(1);
    }
    if (propertyKey.substr(0, 4) !== "data") {
        throw new Error(propertyKey + "\" has an invalid format please use @data dataSomeProp (data-some-prop) for valid bindings.");
    }
    return propertyKey.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
}
1228030
public byte getByte(final String key) {
		final String value = getProperty(key);
		if (value == null) {
			throw new NumberFormatException("Couldn't parse property to byte.");
		}
		return Byte.parseByte(value);
	}
97543
public T read(final K key) throws DataAccessException {
        return
            jdbcTemplate.execute(new ConnectionCallback<T>() {
                @Override
                public T doInConnection(Connection connection) throws SQLException, DataAccessException {
                    return crud.read(connection, key);
                }
            });
    }
114149
private void parse(String propKey, String propValue) {
        if (ARG_TAG.equals(propValue)) {
            String value = System.getProperty(propKey);

            if (StringUtils.isNotBlank(value) && value.startsWith(CRYPTEX_TAG)) {
                value = decrypt(value);
            }

            if (StringUtils.isNotBlank(value)) {
                this.props.setValue(propKey, value, Application.getMode().toString());
            }
        }

        if (propValue.startsWith(CRYPTEX_TAG)) {
            this.props.setValue(propKey, decrypt(propValue), Application.getMode().toString());
        }
    }
115902
public SQLStatement parse(final boolean useCache, final String sql) {
        Optional<SQLStatement> cachedSQLStatement = getSQLStatementFromCache(useCache, sql);
        if (cachedSQLStatement.isPresent()) {
            return cachedSQLStatement.get();
        }
        SQLStatement result = SQLParserFactory.newInstance(dbType, encryptRule, shardingTableMetaData, sql).parse();
        if (useCache) {
            parsingResultCache.put(sql, result);
        }
        return result;
    }
729071
private static String extendedKey(Properties properties, String key) {
        String extendedKey = extendedKey(key);
        return properties.containsKey(extendedKey) ? extendedKey : key;
    }
864512
public static Date getDate(CSProperties p, String key) throws ParseException {
        String val = p.get(key).toString();
        if (val == null) {
            throw new IllegalArgumentException(key);
        }
        String f = p.getInfo(key).get(KEY_FORMAT);
        DateFormat fmt = new SimpleDateFormat(f == null ? ISO8601 : f);
        return fmt.parse(val);
    }
332046
public String getStringProperty(String key) {
    JsonElement propertyKey = properties().get(key);
    return propertyKey == null ? null : propertyKey.getAsString();
  }
585601
private Map<String, String[]> parseQueryString(String data) {
        Map<String, String[]> map = new Hashtable<String, String[]>();
        if (null == data) {
            return map;
        }
        String valArray[] = null;
        char[] chars = data.toCharArray();
        int key_start = 0;
        for (int i = 0; i < chars.length; i++) {
            // look for the key name delimiter
            if ('=' == chars[i]) {
                if (i == key_start) {
                    // missing the key name
                    throw new IllegalArgumentException("Missing key name: " + i);
                }
                String key = parseName(chars, key_start, i);
                int value_start = ++i;
                for (; i < chars.length && '&' != chars[i]; i++) {
                    // just keep looping looking for the end or &
                }
                if (i > value_start) {
                    // did find at least one char for the value
                    String value = parseName(chars, value_start, i);
                    if (map.containsKey(key)) {
                        String oldVals[] = map.get(key);
                        valArray = new String[oldVals.length + 1];
                        System.arraycopy(oldVals, 0, valArray, 0, oldVals.length);
                        valArray[oldVals.length] = value;
                    } else {
                        valArray = new String[] { value };
                    }
                    map.put(key, valArray);
                }
                key_start = i + 1;
            }
        }
        return map;
    }
122948
func ParseKey(key string) ([]string, error) {
	chain := strings.Split(strings.Trim(key, "/"), "/")

	// The key must at least be equal to the rootChain in order to be considered as valid
	if len(chain) <= len(rootChain) || !reflect.DeepEqual(chain[0:len(rootChain)], rootChain) {
		return nil, types.BadRequestErrorf("invalid Key : %s", key)
	}
	return chain[len(rootChain):], nil
}
460559
private Object readKey(
          FieldDescriptor field,
          JsonParser parser,
          DeserializationContext context
  ) throws IOException {
    if (parser.getCurrentToken() != JsonToken.FIELD_NAME) {
      throw reportWrongToken(JsonToken.FIELD_NAME, context, "Expected FIELD_NAME token");
    }

    String fieldName = parser.getCurrentName();
    switch (field.getJavaType()) {
      case INT:
        // lifted from StdDeserializer since there's no method to call
        try {
          return NumberInput.parseInt(fieldName.trim());
        } catch (IllegalArgumentException iae) {
          Number number = (Number) context.handleWeirdStringValue(
                  _valueClass,
                  fieldName.trim(),
                  "not a valid int value"
          );
          return number == null ? 0 : number.intValue();
        }
      case LONG:
        // lifted from StdDeserializer since there's no method to call
        try {
          return NumberInput.parseLong(fieldName.trim());
        } catch (IllegalArgumentException iae) {
          Number number = (Number) context.handleWeirdStringValue(
                  _valueClass,
                  fieldName.trim(),
                  "not a valid long value"
          );
          return number == null ? 0L : number.longValue();
        }
      case BOOLEAN:
        // lifted from StdDeserializer since there's no method to call
        String text = fieldName.trim();
        if ("true".equals(text) || "True".equals(text)) {
          return true;
        }
        if ("false".equals(text) || "False".equals(text)) {
          return false;
        }
        Boolean b = (Boolean) context.handleWeirdStringValue(
                _valueClass,
                text,
                "only \"true\" or \"false\" recognized"
        );
        return Boolean.TRUE.equals(b);
      case STRING:
        return fieldName;
      case ENUM:
        EnumValueDescriptor enumValueDescriptor = field.getEnumType().findValueByName(parser.getText());

        if (enumValueDescriptor == null && !ignorableEnum(parser.getText().trim(), context)) {
          throw context.weirdStringException(parser.getText(), field.getEnumType().getClass(),
                  "value not one of declared Enum instance names");
        }

        return enumValueDescriptor;
      default:
        throw new IllegalArgumentException("Unexpected map key type: " + field.getJavaType());
    }
  }
1123364
private static int parseIntKey(CharSequence key) {
        int numSpaces = 0;
        StringBuilder digits = new StringBuilder();

        // build a string from the numerical characters
        for (int i=0; i<key.length(); i++) {
            char c = key.charAt(i);
            if (' ' == c) {
                numSpaces++;
            } else if (Character.isDigit(c)) {
                digits.append(c);
            }
        }

        String s = digits.toString();
        // This may be greater than the max value for signed integers
        long n = Long.parseLong(s);

        // result is the numerical value divided by the number of spaces
        return (int) (n / numSpaces);
    }
877716
private void marshalKey() {

    Key parent = null;

    ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
    if (parentKeyMetadata != null) {
      DatastoreKey parentDatastoreKey = (DatastoreKey) getFieldValue(parentKeyMetadata);
      if (parentDatastoreKey != null) {
        parent = parentDatastoreKey.nativeKey();
      }
    }

    IdentifierMetadata identifierMetadata = entityMetadata.getIdentifierMetadata();
    IdClassMetadata idClassMetadata = identifierMetadata.getIdClassMetadata();
    DataType identifierType = identifierMetadata.getDataType();
    Object idValue = getFieldValue(identifierMetadata);

    // If ID value is null, we don't have to worry about if it is a simple
    // type of a complex type. Otherwise, we need to see if the ID is a
    // complex type, and if it is, extract the real ID.
    if (idValue != null && idClassMetadata != null) {
      try {
        idValue = idClassMetadata.getReadMethod().invoke(idValue);
      } catch (Throwable t) {
        throw new EntityManagerException(t);
      }
    }

    boolean validId = isValidId(idValue, identifierType);
    boolean autoGenerateId = identifierMetadata.isAutoGenerated();

    if (validId) {
      if (identifierType == DataType.STRING) {
        createCompleteKey(parent, (String) idValue);
      } else {
        createCompleteKey(parent, (long) idValue);
      }
    } else {
      if (intent.isKeyRequired()) {
        throw new EntityManagerException(String
            .format("Identifier is not set or valid for entity of type %s", entity.getClass()));
      }
      if (!autoGenerateId) {
        String pattern = "Identifier is not set or valid for entity of type %s. Auto generation "
            + "of ID is explicitly turned off. ";
        throw new EntityManagerException(String.format(pattern, entity.getClass()));
      } else {
        if (identifierType == DataType.STRING) {
          createCompleteKey(parent);
        } else {
          createIncompleteKey(parent);
        }
      }
    }
  }
227084
public boolean containsKey(String key) {

        if (key == null) {
            throw new NullPointerException("Missing resource key.");
        }

        PropertyBundle p = this;

        do {
            String value = p.key2values.get(key);
            if (value != null) {
                return true;
            }
        } while ((p = p.parent) != null);

        return false;

    }