Package com.eclipsesource.json

Examples of com.eclipsesource.json.JsonObject.names()


    try
    {
      JsonObject json = Util.getJsonFromFile( file.getPath() );

      boolean containsFields = json.names().contains( "fields" );
      boolean containsSelects = json.names().contains( "selects" );

      if ( containsFields )
      {
        parseTableFromFile( json, name );
View Full Code Here


    try
    {
      JsonObject json = Util.getJsonFromFile( file.getPath() );

      boolean containsFields = json.names().contains( "fields" );
      boolean containsSelects = json.names().contains( "selects" );

      if ( containsFields )
      {
        parseTableFromFile( json, name );
      } else if ( containsSelects )
View Full Code Here

          {
            table.setPrimaryKey( type, info.get( "name" ).asString() );
          }

          ArrayList<Constraint> constraints = new ArrayList<Constraint>();
          if ( info.names().contains( "constraints" ) )
          {
            for ( JsonValue jsonconstaint : info.get( "constraints" ).asArray() )
            {
              JsonObject constraint = (JsonObject) jsonconstaint;
              String definition = constraint.get( "definition" ).asString();
View Full Code Here

                if ( field != null )
                {
                  table.setPrimaryKey( field );
                }
              }
              constraints.add( new Constraint( constraint.names().contains( "name" ) ? constraint.get( "name" ).asString() : null, definition ) );
            }
          }
          table.addField( type, info.get( "name" ).asString(), constraints );
        }
      } catch ( NullPointerException e )
View Full Code Here

              if ( field != null )
              {
                table.setPrimaryKey( field );
              }
            }
            table.addConstraint( info.names().contains( "name" ) ? info.get( "name" ).asString() : null, definition );
          }
        } catch ( NullPointerException e )
        {
          throw new ParserException( "Couldn't parse the constraints in this table." );
        }
View Full Code Here

      try
      {
        for ( JsonValue jsoninfo : jsonview.get( "selects" ).asArray() )
        {
          JsonObject info = (JsonObject) jsoninfo;
          view.addSelect( (info.names().contains( "as" )) ? info.get( "as" ).asString() : null, info.get( "select" ).asString() );
        }
      } catch ( NullPointerException e )
      {
        throw new ParserException( "Couldn't parse the selects in this view." );
      }
View Full Code Here

        if ( jsonview.names().contains( "order" ) )
        {
          for ( JsonValue jsoninfo : jsonview.get( "order" ).asArray() )
          {
            JsonObject info = (JsonObject) jsoninfo;
            view.addOrder( info.get( "by" ).asString(), (info.names().contains( "sort" )) ? info.get( "sort" ).asString() : "ASC" );
          }
        }
      } catch ( NullPointerException e )
      {
        throw new ParserException( "Couldn't parse the ordering in this view." );
View Full Code Here

    projectPrefs.setProjectSpecific( true );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( new JsonObject().add( "b", 2 ), configuration );
    assertEquals( Arrays.asList( "b" ), configuration.names() );
  }

  @Test
  public void filtersCommentsFromWorkspaceConfig() {
    workspacePrefs.setConfig( "{\n// \"a\": 1,\n\"b\": 2 /*, \"c\": 3*/}" );
View Full Code Here

    workspacePrefs.setConfig( "{\n// \"a\": 1,\n\"b\": 2 /*, \"c\": 3*/}" );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( new JsonObject().add( "b", 2 ), configuration );
    assertEquals( Arrays.asList( "b" ), configuration.names() );
  }

  private void createProjectConfig( JsonObject projectConfig ) {
    TestUtil.createFile( project, ".jshintrc", projectConfig.toString() );
  }
View Full Code Here

  public void results_structure() {
    CaliperResultsPreprocessor preprocessor = new CaliperResultsPreprocessor( caliperJson );

    JsonObject results = preprocessor.getResults();

    assertEquals( asList( "name", "details", "measurements" ), results.names() );
    assertTrue( results.get( "name" ).isString() );
    assertTrue( results.get( "details" ).isObject() );
    assertTrue( results.get( "measurements" ).isArray() );
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.