@Test public void testFilterSuperTypes() { Map<String, List<String>> projectSuperTypes = new HashMap<String, List<String>>(); projectSuperTypes.put("org.test.Person", Arrays.asList(new String[]{"org.test.GrandParent", "org.test.Parent"})); projectSuperTypes.put("org.test.sub.Person", Arrays.asList(new String[]{"org.test.sub.GrandParent", "org.test.sub.Parent"})); projectSuperTypes.put("org.test.sub.Address", Arrays.asList(new String[]{"org.test.sub.Location"})); projectSuperTypes.put("org.test.Address", Arrays.asList(new String[]{"org.test.Location"})); Imports imports = new Imports(); imports.addImport(new Import("org.test.sub.Person")); imports.addImport(new Import("org.test.sub.Address")); Map<String, List<String>> filterSuperTypes = AsyncPackageDataModelOracleUtilities.filterSuperTypes( "org.another", imports, projectSuperTypes); assertEquals(2, filterSuperTypes.size()); assertContains("Person", filterSuperTypes.keySet()); assertContains("Address", filterSuperTypes.keySet()); final List<String> personSuperTypes = filterSuperTypes.get("Person"); assertEquals(2, personSuperTypes.size()); assertEquals("org.test.sub.GrandParent", personSuperTypes.get(0)); assertEquals("org.test.sub.Parent", personSuperTypes.get(1)); final List<String> addressSuperTypes = filterSuperTypes.get("Address"); assertEquals(1, addressSuperTypes.size()); assertEquals("org.test.sub.Location", addressSuperTypes.get(0)); }
public static Map<String, List<String>> filterSuperTypes(final String packageName, final Imports imports, final Map<String, List<String>> projectSuperTypes) { final Map<String, List<String>> scopedSuperTypes = new HashMap<String, List<String>>(); for (Map.Entry<String, List<String>> e : projectSuperTypes.entrySet()) { final String typeQualifiedType = e.getKey(); final String typePackageName = getPackageName(typeQualifiedType); final String typeTypeName = getTypeName(typeQualifiedType); final List<String> superTypeQualifiedTypes = e.getValue(); if (superTypeQualifiedTypes == null) { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { scopedSuperTypes.put(typeTypeName, superTypeQualifiedTypes); } } else { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { ArrayList<String> result = new ArrayList<String>(); for (String superTypeQualifiedType : superTypeQualifiedTypes) { final String superTypePackageName = getPackageName(superTypeQualifiedType); final String superTypeTypeName = getTypeName(superTypeQualifiedType); if (superTypePackageName.equals(packageName) || isImported(superTypeQualifiedType, imports)) { result.add(superTypeTypeName); } else { result.add(superTypeQualifiedType); } } scopedSuperTypes.put(typeTypeName, result); } } } return scopedSuperTypes; }
AsyncPackageDataModelOracleUtilities { public static Map<String, List<String>> filterSuperTypes(final String packageName, final Imports imports, final Map<String, List<String>> projectSuperTypes) { final Map<String, List<String>> scopedSuperTypes = new HashMap<String, List<String>>(); for (Map.Entry<String, List<String>> e : projectSuperTypes.entrySet()) { final String typeQualifiedType = e.getKey(); final String typePackageName = getPackageName(typeQualifiedType); final String typeTypeName = getTypeName(typeQualifiedType); final List<String> superTypeQualifiedTypes = e.getValue(); if (superTypeQualifiedTypes == null) { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { scopedSuperTypes.put(typeTypeName, superTypeQualifiedTypes); } } else { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { ArrayList<String> result = new ArrayList<String>(); for (String superTypeQualifiedType : superTypeQualifiedTypes) { final String superTypePackageName = getPackageName(superTypeQualifiedType); final String superTypeTypeName = getTypeName(superTypeQualifiedType); if (superTypePackageName.equals(packageName) || isImported(superTypeQualifiedType, imports)) { result.add(superTypeTypeName); } else { result.add(superTypeQualifiedType); } } scopedSuperTypes.put(typeTypeName, result); } } } return scopedSuperTypes; } }
AsyncPackageDataModelOracleUtilities { public static Map<String, List<String>> filterSuperTypes(final String packageName, final Imports imports, final Map<String, List<String>> projectSuperTypes) { final Map<String, List<String>> scopedSuperTypes = new HashMap<String, List<String>>(); for (Map.Entry<String, List<String>> e : projectSuperTypes.entrySet()) { final String typeQualifiedType = e.getKey(); final String typePackageName = getPackageName(typeQualifiedType); final String typeTypeName = getTypeName(typeQualifiedType); final List<String> superTypeQualifiedTypes = e.getValue(); if (superTypeQualifiedTypes == null) { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { scopedSuperTypes.put(typeTypeName, superTypeQualifiedTypes); } } else { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { ArrayList<String> result = new ArrayList<String>(); for (String superTypeQualifiedType : superTypeQualifiedTypes) { final String superTypePackageName = getPackageName(superTypeQualifiedType); final String superTypeTypeName = getTypeName(superTypeQualifiedType); if (superTypePackageName.equals(packageName) || isImported(superTypeQualifiedType, imports)) { result.add(superTypeTypeName); } else { result.add(superTypeQualifiedType); } } scopedSuperTypes.put(typeTypeName, result); } } } return scopedSuperTypes; }  }
AsyncPackageDataModelOracleUtilities { public static Map<String, List<String>> filterSuperTypes(final String packageName, final Imports imports, final Map<String, List<String>> projectSuperTypes) { final Map<String, List<String>> scopedSuperTypes = new HashMap<String, List<String>>(); for (Map.Entry<String, List<String>> e : projectSuperTypes.entrySet()) { final String typeQualifiedType = e.getKey(); final String typePackageName = getPackageName(typeQualifiedType); final String typeTypeName = getTypeName(typeQualifiedType); final List<String> superTypeQualifiedTypes = e.getValue(); if (superTypeQualifiedTypes == null) { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { scopedSuperTypes.put(typeTypeName, superTypeQualifiedTypes); } } else { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { ArrayList<String> result = new ArrayList<String>(); for (String superTypeQualifiedType : superTypeQualifiedTypes) { final String superTypePackageName = getPackageName(superTypeQualifiedType); final String superTypeTypeName = getTypeName(superTypeQualifiedType); if (superTypePackageName.equals(packageName) || isImported(superTypeQualifiedType, imports)) { result.add(superTypeTypeName); } else { result.add(superTypeQualifiedType); } } scopedSuperTypes.put(typeTypeName, result); } } } return scopedSuperTypes; }  static void populateDataModelOracle(final AsyncPackageDataModelOracle oracle,
                                               final PackageDataModelOracleIncrementalPayload payload); static Map<String, ModelField[]> filterModelFields(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, ModelField[]> projectModelFields,
                                                              final FactNameToFQCNHandleRegistry registry); static Map<String, Boolean> filterCollectionTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, Boolean> projectCollectionTypes); static Map<String, String> filterGlobalTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, String> packageGlobalTypes); static Map<String, Boolean> filterEventTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, Boolean> projectEventTypes); static Map<String, TypeSource> filterTypeSources(final String packageName,
                                                            final Imports imports,
                                                            final Map<String, TypeSource> projectTypeSources); static Map<String, List<String>> filterSuperTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, List<String>> projectSuperTypes); static Map<String, Set<Annotation>> filterTypeAnnotations(final String packageName,
                                                                     final Imports imports,
                                                                     final Map<String, Set<Annotation>> projectTypeAnnotations); static Map<String, Map<String, Set<Annotation>>> filterTypeFieldsAnnotations(final String packageName,
                                                                                        final Imports imports,
                                                                                        final Map<String, Map<String, Set<Annotation>>> projectTypeFieldsAnnotations); static Map<String, String[]> filterEnumDefinitions(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, String[]> enumDefinitions); static void visitMethodInformation(final Map<String, List<MethodInfo>> projectMethodInformation,
                                              final FactNameToFQCNHandleRegistry registry); static Map<String, String> filterFieldParametersTypes(final String packageName,
                                                                 final Imports imports,
                                                                 final Map<String, String> projectFieldParametersTypes); static String getPackageName(final String qualifiedType); static String getTypeName(final String qualifiedType); static ModelField[] correctModelFields(final String packageName,
                                                  final ModelField[] originalModelFields,
                                                  final Imports imports); static ModelField correctModelFields(final String packageName,
                                                final Imports imports,
                                                final ModelField mf); static MethodInfo correctMethodInformation(final String packageName,
                                                      final MethodInfo originalMethodInformation,
                                                      final Imports imports); static List<MethodInfo> correctMethodInformation(final String packageName,
                                                            final List<MethodInfo> originalMethodInformation,
                                                            final Imports imports); }
AsyncPackageDataModelOracleUtilities { public static Map<String, List<String>> filterSuperTypes(final String packageName, final Imports imports, final Map<String, List<String>> projectSuperTypes) { final Map<String, List<String>> scopedSuperTypes = new HashMap<String, List<String>>(); for (Map.Entry<String, List<String>> e : projectSuperTypes.entrySet()) { final String typeQualifiedType = e.getKey(); final String typePackageName = getPackageName(typeQualifiedType); final String typeTypeName = getTypeName(typeQualifiedType); final List<String> superTypeQualifiedTypes = e.getValue(); if (superTypeQualifiedTypes == null) { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { scopedSuperTypes.put(typeTypeName, superTypeQualifiedTypes); } } else { if (typePackageName.equals(packageName) || isImported(typeQualifiedType, imports)) { ArrayList<String> result = new ArrayList<String>(); for (String superTypeQualifiedType : superTypeQualifiedTypes) { final String superTypePackageName = getPackageName(superTypeQualifiedType); final String superTypeTypeName = getTypeName(superTypeQualifiedType); if (superTypePackageName.equals(packageName) || isImported(superTypeQualifiedType, imports)) { result.add(superTypeTypeName); } else { result.add(superTypeQualifiedType); } } scopedSuperTypes.put(typeTypeName, result); } } } return scopedSuperTypes; }  static void populateDataModelOracle(final AsyncPackageDataModelOracle oracle,
                                               final PackageDataModelOracleIncrementalPayload payload); static Map<String, ModelField[]> filterModelFields(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, ModelField[]> projectModelFields,
                                                              final FactNameToFQCNHandleRegistry registry); static Map<String, Boolean> filterCollectionTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, Boolean> projectCollectionTypes); static Map<String, String> filterGlobalTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, String> packageGlobalTypes); static Map<String, Boolean> filterEventTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, Boolean> projectEventTypes); static Map<String, TypeSource> filterTypeSources(final String packageName,
                                                            final Imports imports,
                                                            final Map<String, TypeSource> projectTypeSources); static Map<String, List<String>> filterSuperTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, List<String>> projectSuperTypes); static Map<String, Set<Annotation>> filterTypeAnnotations(final String packageName,
                                                                     final Imports imports,
                                                                     final Map<String, Set<Annotation>> projectTypeAnnotations); static Map<String, Map<String, Set<Annotation>>> filterTypeFieldsAnnotations(final String packageName,
                                                                                        final Imports imports,
                                                                                        final Map<String, Map<String, Set<Annotation>>> projectTypeFieldsAnnotations); static Map<String, String[]> filterEnumDefinitions(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, String[]> enumDefinitions); static void visitMethodInformation(final Map<String, List<MethodInfo>> projectMethodInformation,
                                              final FactNameToFQCNHandleRegistry registry); static Map<String, String> filterFieldParametersTypes(final String packageName,
                                                                 final Imports imports,
                                                                 final Map<String, String> projectFieldParametersTypes); static String getPackageName(final String qualifiedType); static String getTypeName(final String qualifiedType); static ModelField[] correctModelFields(final String packageName,
                                                  final ModelField[] originalModelFields,
                                                  final Imports imports); static ModelField correctModelFields(final String packageName,
                                                final Imports imports,
                                                final ModelField mf); static MethodInfo correctMethodInformation(final String packageName,
                                                      final MethodInfo originalMethodInformation,
                                                      final Imports imports); static List<MethodInfo> correctMethodInformation(final String packageName,
                                                            final List<MethodInfo> originalMethodInformation,
                                                            final Imports imports);  }