/** * Checks if property is error deprecated. * * @param property the configuration property * @return if property is error deprecated */ private boolean isDeprecatedError(ConfigurationMetadataProperty property) { return property.getDeprecation() != null && property.getDeprecation().getLevel() == Level.ERROR; }
/** * Add a {@link ConfigurationMetadataProperty} with the * {@link ConfigurationMetadataSource source} that defines it, if any. * @param property the property to add * @param source the source */ public void add(ConfigurationMetadataProperty property, ConfigurationMetadataSource source) { if (source != null) { putIfAbsent(source.getProperties(), property.getId(), property); } putIfAbsent(getGroup(source).getProperties(), property.getId(), property); }
private ConfigurationMetadataSource getSource(RawConfigurationMetadata metadata, ConfigurationMetadataItem item) { if (item.getSourceType() != null) { return metadata.getSource(item.getSourceType()); } return null; }
private void addValueHints(ConfigurationMetadataProperty property, ConfigurationMetadataHint hint) { property.getHints().getValueHints().addAll(hint.getValueHints()); property.getHints().getValueProviders().addAll(hint.getValueProviders()); }
private void addMapHints(ConfigurationMetadataProperty property, ConfigurationMetadataHint hint) { property.getHints().getKeyHints().addAll(hint.getValueHints()); property.getHints().getKeyProviders().addAll(hint.getValueProviders()); }
private ConfigurationMetadataItem parseItem(JSONObject json) throws Exception { ConfigurationMetadataItem item = new ConfigurationMetadataItem(); item.setId(json.getString("name")); item.setType(json.optString("type", null)); String description = json.optString("description", null); item.setDescription(description); item.setShortDescription(this.sentenceExtractor.getFirstSentence(description)); item.setDefaultValue(readItemValue(json.opt("defaultValue"))); item.setDeprecation(parseDeprecation(json)); item.setSourceType(json.optString("sourceType", null)); item.setSourceMethod(json.optString("sourceMethod", null)); return item; }
public static boolean isErrorDeprecated(ConfigurationMetadataProperty meta) { Deprecation depr = meta.getDeprecation(); return depr != null && depr.getLevel() != null && depr.getLevel().equals(Deprecation.Level.ERROR); }
@Override public boolean isExclusive(ConfigurationMetadataProperty property) { for (ValueProvider valueProvider : property.getHints().getValueProviders()) { if ("any".equals(valueProvider.getName())) { return false; } } return true; } }
@Override public List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader) { return property.getHints().getValueHints(); }
private ConfigurationMetadataSource parseSource(JSONObject json) throws Exception { ConfigurationMetadataSource source = new ConfigurationMetadataSource(); source.setGroupId(json.getString("name")); source.setType(json.optString("type", null)); String description = json.optString("description", null); source.setDescription(description); source.setShortDescription(this.sentenceExtractor.getFirstSentence(description)); source.setSourceType(json.optString("sourceType", null)); source.setSourceMethod(json.optString("sourceMethod", null)); return source; }
/** * Build a {@link ConfigurationMetadataRepository} with the current state of this * builder. * @return this builder */ public ConfigurationMetadataRepository build() { SimpleConfigurationMetadataRepository result = new SimpleConfigurationMetadataRepository(); for (SimpleConfigurationMetadataRepository repository : this.repositories) { result.include(repository); } return result; }
private SimpleConfigurationMetadataRepository add(InputStream in, Charset charset) throws IOException { try { RawConfigurationMetadata metadata = this.reader.read(in, charset); return create(metadata); } catch (Exception ex) { throw new IllegalStateException("Failed to read configuration metadata", ex); } }
/** * Create a new builder instance using {@link StandardCharsets#UTF_8} as the default * charset. * @return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance. */ public static ConfigurationMetadataRepositoryJsonBuilder create() { return create(StandardCharsets.UTF_8); }
private ConfigurationMetadataGroup getGroup(ConfigurationMetadataSource source) { if (source == null) { ConfigurationMetadataGroup rootGroup = this.allGroups.get(ROOT_GROUP); if (rootGroup == null) { rootGroup = new ConfigurationMetadataGroup(ROOT_GROUP); this.allGroups.put(ROOT_GROUP, rootGroup); } return rootGroup; } return this.allGroups.get(source.getGroupId()); }
/** * Create a new builder instance using the specified default {@link Charset}. * @param defaultCharset the default charset to use * @return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance. */ public static ConfigurationMetadataRepositoryJsonBuilder create( Charset defaultCharset) { return new ConfigurationMetadataRepositoryJsonBuilder(defaultCharset); }
/** * Create a new builder instance using {@link StandardCharsets#UTF_8} as the default * charset. * * @return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance. */ public static CasConfigurationMetadataRepositoryJsonBuilder create() { return create(StandardCharsets.UTF_8); }
/** * Create a new builder instance using the specified default {@link Charset}. * * @param defaultCharset the default charset to use * @return a new {@link ConfigurationMetadataRepositoryJsonBuilder} instance. */ public static CasConfigurationMetadataRepositoryJsonBuilder create(final Charset defaultCharset) { return new CasConfigurationMetadataRepositoryJsonBuilder(defaultCharset); } }
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()); }
/** * Checks if property is error deprecated. * * @param property the configuration property * @return if property is error deprecated */ private boolean isDeprecatedError(ConfigurationMetadataProperty property) { return property.getDeprecation() != null && property.getDeprecation().getLevel() == Level.ERROR; }