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

How to use
forEach
method
in
leap.lang.json.JsonArray

Best Java code snippets using leap.lang.json.JsonArray.forEach (Showing top 3 results out of 315)

origin: org.leapframework/leap-lang

/**
 * Invokes the given function for every item of array.
 *
 * <p/>
 * Do nothing if the array not exists or empty item.
 */
public void getArray(String key, Consumer<JsonValue> func) {
  JsonArray a = getArray(key);
  if(null == a) {
    return;
  }
  a.forEach(func);
}
origin: org.leapframework/jmms-plugins-swagger-doc

private void prepare(Map<String, OpsGroup> map, JsonObject swagger) {
  JsonArray tags = swagger.getArray(TAGS);
  if(null == tags || tags.isEmpty()) {
    map.put(DEFAULT, new OpsGroup(DEFAULT));
  }else {
    tags.forEach(tag -> {
      OpsGroup group = new OpsGroup(tag.asJsonObject());;
      map.put(group.getName(), group);
    });
  }
}
origin: org.leapframework/leap-spring-boot-web

@Override
public Object read(Type type, Class contextClass, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
  if(type instanceof Class<?>) {
    return readInternal((Class)type, inputMessage);
  }else {
    ParameterizedType parameterizedType = (ParameterizedType)type;
    Class typeArgument = (Class)parameterizedType.getActualTypeArguments()[0];
    Collection c = newCollection((Class)parameterizedType.getRawType());
    try(InputStream is = inputMessage.getBody()) {
      try(InputStreamReader reader = new InputStreamReader(is, getCharset(inputMessage))) {
        try {
          JsonArray a = JSON.parse(reader).asJsonArray();
          a.forEach(item -> {
            if(null == item) {
              c.add(null);
            }else {
              Object o = Reflection.newInstance(typeArgument);
              ((JsonParsable)o).parseJson(item);
              c.add(o);
            }
          });
        }catch (Exception e) {
          throw new HttpMessageNotReadableException(e.getMessage(), e);
        }
      }
    }
    return c;
  }
}
leap.lang.jsonJsonArrayforEach

Popular methods of JsonArray

  • length
    Returns the length of items.
  • <init>
  • asList
  • get
  • getObject
  • getString
  • isEmpty

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • setRequestProperty (URLConnection)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 12 Jupyter Notebook Extensions
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