congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
YAML
Code IndexAdd Tabnine to your IDE (free)

How to use
YAML
in
leap.lang.yaml

Best Java code snippets using leap.lang.yaml.YAML (Showing top 6 results out of 315)

origin: org.leapframework/leap-lang

/**
 * Parse the yaml content to {@link YamlValue}.
 */
public static YamlValue parse(Reader reader) throws YamlException {
  return YamlValue.of(decode(reader));
}
origin: org.leapframework/leap-core

@Override
public boolean readProperties(AppPropertyContext context, Resource resource) {
  String filename = resource.getFilename();
  if(Strings.endsWithIgnoreCase(filename, ".yaml") || Strings.endsWithIgnoreCase(filename,".yml")) {
    String content = resource.getContent();
    if(Strings.isEmpty(content)) {
      return true;
    }
    Map<String, Object> map = YAML.parse(content).asMap();
    if(map.isEmpty()) {
      return true;
    }
    Map<String, String> props = Maps.toProperties(map);
    props.forEach((key, value) -> putProperty(context, resource, key, value));
    return true;
  }
  return false;
}
origin: org.leapframework/leap-lang

/**
 * Parse the yaml content to {@link YamlValue}.
 */
public static YamlValue parse(String string) throws YamlException {
  return YamlValue.of(decode(string));
}
origin: org.leapframework/jmms-plugins-swagger-doc

public SwaggerDoc(String dir) {
  this.dir = leap.lang.path.Paths.suffixWithSlash(dir);
  Map map = null;
  File swaggerFile = Paths.get(dir).resolve("./swagger.json").toFile();
  if(swaggerFile.exists()) {
    map = JSON.decodeMap(IO.readString(swaggerFile, Charsets.UTF_8));
  }else {
    swaggerFile = Paths.get(dir).resolve("./swagger.yaml").toFile();
    if(swaggerFile.exists()) {
      map = YAML.decode(Resources.createFileResource(swaggerFile).getContent());
    }
  }
  if(null != map) {
    this.swagger = JsonObject.of(map);
  }
}
origin: org.leapframework/leap-webapi

@Override
public ApiMetadataBuilder read(Reader reader) throws IOException {
  String content = IO.readString(reader).trim();
  Map<String,Object> swagger;
  if(content.startsWith("{")) {
    swagger = JSON.decode(content);
  }else{
    swagger = YAML.decode(content);
  }
  ApiMetadataBuilder m = new ApiMetadataBuilder();
  readSwagger(swagger, m);
  return m;
}
origin: org.leapframework/leap-core

protected void readMessages(MessageContext context, Resource resource) {
  try {
    String localeName = Locales.extractFromFilename(resource.getFilename());
    Locale locale     = Strings.isEmpty(localeName) ? null : Locales.forName(localeName);
    Map<String, String> props;
    try (Reader reader = resource.getInputStreamReader(charset)) {
      Map map = YAML.decode(reader);
      if (null == map || map.isEmpty()) {
        return;
      }
      props = Maps.toProperties(map);
    }
    for (String key : props.keySet()) {
      readMessage(context, resource, locale, props, (String) key);
    }
  } catch (Exception e) {
    throw new AppConfigException("Error reading messages from properties resource [" +
        resource.getURLString() + "], " + e.getMessage(), e);
  }
}
leap.lang.yamlYAML

Most used methods

  • decode
    Decodes the yaml content to raw value. The raw value may be null, map, list or simpl value.
  • parse
    Parse the yaml content to YamlValue.

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • startActivity (Activity)
  • Menu (java.awt)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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