Tabnine Logo
Configurator.resolveComponentName
Code IndexAdd Tabnine to your IDE (free)

How to use
resolveComponentName
method
in
org.wikibrain.conf.Configurator

Best Java code snippets using org.wikibrain.conf.Configurator.resolveComponentName (Showing top 5 results out of 315)

origin: shilad/wikibrain

public SRBuilder(Env env, String metricName, Language language) throws ConfigurationException {
  this.env = env;
  this.language = language;
  this.config = env.getConfiguration();
  this.srDir = new File(config.get().getString("sr.metric.path"));
  datasetNames = config.get().getStringList("sr.dataset.defaultsets");
  // Properly resolve the default metric name.
  this.metricName = env.getConfigurator().resolveComponentName(SRMetric.class, metricName);
  if (!srDir.isDirectory()) {
    srDir.mkdirs();
  }
}
origin: shilad/wikibrain

name = resolveComponentName(klass, name);
Config config = getConfig(klass, name);
Map<String, Object> cache = components.get(klass);
origin: org.wikibrainapi/wikibrain-utils

/**
 * Returns the config object associated with the given class and name.
 * @param klass The generic interface or superclass, not the specific implementation.
 * @param name The name of the class as it appears in the config file. If name is null,
 *             the configurator tries to guess by looking for a "default" entry in
 *             the config that provides the name for a default implementation or, if
 *             there is exactly one implementation returning it. Otherwise, if name is
 *             null it throws an error.
 * @return The requested config object.
 * @throws ConfigurationException
 */
public Config getConfig(Class klass, String name) throws ConfigurationException {
  if (!providers.containsKey(klass)) {
    throw new ConfigurationException("No registered providers for components with class " + klass);
  }
  ProviderSet pset = providers.get(klass);
  name = resolveComponentName(klass, name);
  String path = pset.path + "." + name;
  if (!conf.get().hasPath(path)) {
    throw new ConfigurationException("Configuration path " + path + " does not exist");
  }
  return conf.get().getConfig(path);
}
origin: org.wikibrainapi/wikibrain-utils

name = resolveComponentName(klass, name);
Config config = getConfig(klass, name);
Map<String, Object> cache = components.get(klass);
origin: shilad/wikibrain

/**
 * Returns the config object associated with the given class and name.
 * @param klass The generic interface or superclass, not the specific implementation.
 * @param name The name of the class as it appears in the config file. If name is null,
 *             the configurator tries to guess by looking for a "default" entry in
 *             the config that provides the name for a default implementation or, if
 *             there is exactly one implementation returning it. Otherwise, if name is
 *             null it throws an error.
 * @return The requested config object.
 * @throws ConfigurationException
 */
public Config getConfig(Class klass, String name) throws ConfigurationException {
  if (!providers.containsKey(klass)) {
    throw new ConfigurationException("No registered providers for components with class " + klass);
  }
  ProviderSet pset = providers.get(klass);
  name = resolveComponentName(klass, name);
  String path = pset.path + "." + name;
  if (!conf.get().hasPath(path)) {
    throw new ConfigurationException("Configuration path " + path + " does not exist");
  }
  return conf.get().getConfig(path);
}
org.wikibrain.confConfiguratorresolveComponentName

Javadoc

If the component name is "default" or null, return the name of the default implementation of the compoenent. Otherwise, return the specified name.

Popular methods of Configurator

  • get
    Get a specific named instance of the component with the specified class.
  • <init>
    Constructs a new configuration object with the specified configuration.
  • getConf
  • getConfig
    Returns the config object associated with the given class and name.
  • construct
    Constructs an instance of the specified class with the passed in config. This bypasses the cache and
  • close
    Tries to close all open components, clears the components map.
  • constructInternal
  • makeCacheKey
    Returns a unique string for the name and params
  • registerProvider
    Instantiates providers for the component.
  • registerProviders
    Registers all class that extend Providers

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • BoxLayout (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now