private void addValueHints(ConfigurationMetadataProperty property, ConfigurationMetadataHint hint) { property.getHints().getValueHints().addAll(hint.getValueHints()); property.getHints().getValueProviders().addAll(hint.getValueProviders()); }
public String resolveId() { if (isMapKeyHints()) { return this.id.substring(0, this.id.length() - KEY_SUFFIX.length()); } if (isMapValueHints()) { return this.id.substring(0, this.id.length() - VALUE_SUFFIX.length()); } return this.id; }
private static SimpleConfigurationMetadataRepository create(final RawConfigurationMetadata metadata) { val repository = new SimpleConfigurationMetadataRepository(); repository.add(metadata.getSources()); for (val item : metadata.getItems()) { val source = getSource(metadata, item); repository.add(item, source); } val allProperties = repository.getAllProperties(); for (val hint : metadata.getHints()) { var property = allProperties.get(hint.getId()); if (property != null) { addValueHints(property, hint); } else { val id = hint.resolveId(); property = allProperties.get(id); if (property != null) { if (hint.isMapKeyHints()) { addMapHints(property, hint); } else { addValueHints(property, hint); } } } } return repository; }
private ConfigurationMetadataHint parseHint(JSONObject json) throws Exception { ConfigurationMetadataHint hint = new ConfigurationMetadataHint(); hint.setId(json.getString("name")); if (json.has("values")) { JSONArray values = json.getJSONArray("values"); valueHint.setShortDescription( this.sentenceExtractor.getFirstSentence(description)); hint.getValueHints().add(valueHint); hint.getValueProviders().add(valueProvider);
private SimpleConfigurationMetadataRepository create( RawConfigurationMetadata metadata) { SimpleConfigurationMetadataRepository repository = new SimpleConfigurationMetadataRepository(); repository.add(metadata.getSources()); for (ConfigurationMetadataItem item : metadata.getItems()) { ConfigurationMetadataSource source = getSource(metadata, item); repository.add(item, source); } Map<String, ConfigurationMetadataProperty> allProperties = repository .getAllProperties(); for (ConfigurationMetadataHint hint : metadata.getHints()) { ConfigurationMetadataProperty property = allProperties.get(hint.getId()); if (property != null) { addValueHints(property, hint); } else { String id = hint.resolveId(); property = allProperties.get(id); if (property != null) { if (hint.isMapKeyHints()) { addMapHints(property, hint); } else { addValueHints(property, hint); } } } } return repository; }
private void addMapHints(ConfigurationMetadataProperty property, ConfigurationMetadataHint hint) { property.getHints().getKeyHints().addAll(hint.getValueHints()); property.getHints().getKeyProviders().addAll(hint.getValueProviders()); }
private static void addValueHints(final ConfigurationMetadataProperty property, final ConfigurationMetadataHint hint) { property.getHints().getValueHints().addAll(hint.getValueHints()); property.getHints().getValueProviders().addAll(hint.getValueProviders()); }
private static void addMapHints(final ConfigurationMetadataProperty property, final ConfigurationMetadataHint hint) { property.getHints().getKeyHints().addAll(hint.getValueHints()); property.getHints().getKeyProviders().addAll(hint.getValueProviders()); }