Tabnine Logo
JsonArray.length
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.leapframework/leap-spring-boot-web

@Override
protected Object readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
  try(InputStream is = inputMessage.getBody()) {
    if(clazz.isArray()) {
      try(InputStreamReader reader = new InputStreamReader(is, getCharset(inputMessage))) {
        try {
          JsonArray a = JSON.parse(reader).asJsonArray();
          Object o = Array.newInstance(clazz.getComponentType(), a.length());
          for(int i=0;i<a.length();i++) {
            Object item = Reflection.newInstance(clazz.getComponentType());
            ((JsonParsable)item).parseJson(a.getObject(i));
            Array.set(o, i, item);
          }
          return o;
        }catch (Exception e) {
          throw new HttpMessageNotReadableException(e.getMessage(), e);
        }
      }
    }else {
      Object o = Reflection.newInstance(clazz);
      try {
        ((JsonParsable)o).parseJson(IO.readString(is, getCharset(inputMessage)));
        return o;
      }catch (Exception e) {
        throw new HttpMessageNotReadableException(e.getMessage(), e);
      }
    }
  }
}
origin: org.leapframework/leap-db

  @Override
  public void parseJson(JsonValue value) {
    JsonObject o = value.asJsonObject();
    
    this.name   = o.getString("name");
    this.unique = o.getBoolean("unique",false);
    
    JsonArray columns = o.getArray("columnNames");
    if(null != columns){
      for(int i=0;i<columns.length();i++){
        addColumnName(columns.getString(i));
      }
    }
  }
}
leap.lang.jsonJsonArraylength

Javadoc

Returns the length of items.

Popular methods of JsonArray

  • forEach
  • <init>
  • asList
  • get
  • getObject
  • getString
  • isEmpty

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JOptionPane (javax.swing)
  • Top PhpStorm 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