public static PropertyKey getOrBuildCustom(String name) {
    return DEFAULT_KEYS_MAP.computeIfAbsent(name,
        (key) -> {
          final Builder propertyKeyBuilder = stringBuilder(key).setIsBuiltIn(false);
          for (String customCredentialName : CUSTOM_CREDENTIAL_NAME_SUBSTR) {
            if (name.contains(customCredentialName)) {
              propertyKeyBuilder.setDisplayType(DisplayType.CREDENTIALS);
            }
          }
          return propertyKeyBuilder.buildUnregistered();
        });
  }
@Test
  public void testGetOrBuildCustom() throws Exception {
    final PropertyKey workerHostName =
        PropertyKey.getOrBuildCustom(PropertyKey.Name.WORKER_HOSTNAME);

    // check reference equality
    assertTrue(PropertyKey.WORKER_HOSTNAME == workerHostName);

    final PropertyKey test = PropertyKey.getOrBuildCustom("test");
    assertEquals(PropertyKey.DisplayType.DEFAULT, test.getDisplayType());
    assertEquals("test", test.getName());
    assertTrue(test == PropertyKey.getOrBuildCustom("test"));

    final PropertyKey accessKey = PropertyKey.getOrBuildCustom("test.accessKeyId");
    assertEquals(PropertyKey.DisplayType.CREDENTIALS, accessKey.getDisplayType());
  }