public void buildAdditionalPortInfo(JSONObject oper,JSONObject portClassHierarchy,JSONObject portTypesWithSchemaClasses){
  try {
    JSONArray ports=oper.getJSONArray(OperatorDiscoverer.PORT_TYPE_INFO_KEY);
    for (int i=0; i < ports.length(); i++) {
      JSONObject port=ports.getJSONObject(i);
      String portType=port.optString("type");
      if (portType == null) {
        continue;
      }
      if (typeGraph.size() == 0) {
        buildTypeGraph();
      }
      try {
        LinkedList<String> queue=new LinkedList<>();
        queue.add(portType);
        while (!queue.isEmpty()) {
          String currentType=queue.remove();
          if (portClassHierarchy.has(currentType)) {
            continue;
          }
          List<String> immediateParents=typeGraph.getParents(currentType);
          if (immediateParents == null) {
            portClassHierarchy.put(currentType,new ArrayList<String>());
            continue;
          }
          portClassHierarchy.put(currentType,immediateParents);
          queue.addAll(immediateParents);
        }
      }
 catch (      JSONException e) {
        LOG.warn("building port type hierarchy {}",portType,e);
      }
      if (portTypesWithSchemaClasses.has(portType)) {
        continue;
      }
      if (portType.equals("byte") || portType.equals("short") || portType.equals("char")|| portType.equals("int")|| portType.equals("long")|| portType.equals("float")|| portType.equals("double")|| portType.equals("java.lang.String")|| portType.equals("java.lang.Object")) {
        continue;
      }
      if (port.has("typeArgs")) {
        continue;
      }
      boolean hasSchemaClasses=false;
      List<String> instantiableDescendants=typeGraph.getInstantiableDescendants(portType);
      if (instantiableDescendants != null) {
        for (        String descendant : instantiableDescendants) {
          try {
            if (typeGraph.isInstantiableBean(descendant)) {
              hasSchemaClasses=true;
              break;
            }
          }
 catch (          JSONException ex) {
            LOG.warn("checking descendant is instantiable {}",descendant);
          }
        }
      }
      portTypesWithSchemaClasses.put(portType,hasSchemaClasses);
    }
  }
 catch (  JSONException e) {
    LOG.error("JSON Exception {}",e);
    throw new RuntimeException(e);
  }
}

public void buildAdditionalPortInfo ( JSONObject oper , JSONObject portClassHierarchy , JSONObject portTypesWithSchemaClasses ) { try { JSONArray ports = oper . getJSONArray ( OperatorDiscoverer . PORT_TYPE_INFO_KEY ) ; for ( int i = 0 ; i < ports . length ( ) ; i ++ ) { JSONObject port = ports . getJSONObject ( i ) ; String portType = port . optString ( "type" ) ; if ( portType == null ) { continue ; } if ( typeGraph . size ( ) == 0 ) { buildTypeGraph ( ) ; } try { LinkedList < String > queue = new LinkedList < > ( ) ; queue . add ( portType ) ; while ( ! queue . isEmpty ( ) ) { String currentType = queue . remove ( ) ; if ( portClassHierarchy . has ( currentType ) ) { continue ; } List < String > immediateParents = typeGraph . getParents ( currentType ) ; if ( immediateParents == null ) { portClassHierarchy . put ( currentType , new ArrayList < String > ( ) ) ; continue ; } portClassHierarchy . put ( currentType , immediateParents ) ; queue . addAll ( immediateParents ) ; } } catch ( JSONException e ) { LOG . warn ( "building port type hierarchy {}" , portType , e ) ; } if ( portTypesWithSchemaClasses . has ( portType ) ) { continue ; } if ( portType . equals ( "byte" ) || portType . equals ( "short" ) || portType . equals ( "char" ) || portType . equals ( "int" ) || portType . equals ( "long" ) || portType . equals ( "float" ) || portType . equals ( "double" ) || portType . equals ( "java.lang.String" ) || portType . equals ( "java.lang.Object" ) ) { continue ; } if ( port . has ( "typeArgs" ) ) { continue ; } boolean hasSchemaClasses = false ; List < String > instantiableDescendants = typeGraph . getInstantiableDescendants ( portType ) ; if ( instantiableDescendants != null ) { for ( String descendant : instantiableDescendants ) { try { if ( typeGraph . isInstantiableBean ( descendant ) ) { hasSchemaClasses = true ; break ; } } catch ( JSONException ex ) { LOG . warn ( "checking descendant is instantiable {}" , descendant ) ; } } } portTypesWithSchemaClasses . put ( portType , hasSchemaClasses ) ; } } catch ( JSONException e ) { LOG . error ( "JSON Exception {}" , e ) ; throw new RuntimeException ( e ) ; } }
enrich portclasshier with class / interface names that map to a list of parent classes / interfaces . for any class encountered , find its parents too . < br / > also find the port types which have assignable schema classes .
