@Test public void testNoInterfaces(@TuneProvider Tune tune) { TypeModel model = new TypeModel(); TypeSpec.Builder builder = TypeSpec.classBuilder("Test"); new InterfaceHandler(tune, null, null).process(builder, model); TypeSpec spec = builder.build(); assertEquals("Test", spec.name, "Wrong class name found"); List<TypeName> interfaces = spec.superinterfaces; assertEquals(0, interfaces.size(), "Interfaces found"); }
@Override public void process(TypeSpec.Builder typeSpec, TypeModel typeModel) { Set<VariableModel> interfaceDefinitions = new HashSet<>(); interfaceDefinitions.addAll(tune.interfaces()); interfaceDefinitions.addAll(typeModel.getInterfaces()); if (interfaceDefinitions.size() == 0) { return; } List<TypeName> interfaces = interfaceDefinitions.stream() .map(model -> getResolvedTypeName(model, metaInfo.getGenericVariables(), tune.getChords())) .collect(Collectors.toList()); typeSpec.addSuperinterfaces(interfaces); }
InterfaceHandler extends Handler { @Override public void process(TypeSpec.Builder typeSpec, TypeModel typeModel) { Set<VariableModel> interfaceDefinitions = new HashSet<>(); interfaceDefinitions.addAll(tune.interfaces()); interfaceDefinitions.addAll(typeModel.getInterfaces()); if (interfaceDefinitions.size() == 0) { return; } List<TypeName> interfaces = interfaceDefinitions.stream() .map(model -> getResolvedTypeName(model, metaInfo.getGenericVariables(), tune.getChords())) .collect(Collectors.toList()); typeSpec.addSuperinterfaces(interfaces); } }
InterfaceHandler extends Handler { @Override public void process(TypeSpec.Builder typeSpec, TypeModel typeModel) { Set<VariableModel> interfaceDefinitions = new HashSet<>(); interfaceDefinitions.addAll(tune.interfaces()); interfaceDefinitions.addAll(typeModel.getInterfaces()); if (interfaceDefinitions.size() == 0) { return; } List<TypeName> interfaces = interfaceDefinitions.stream() .map(model -> getResolvedTypeName(model, metaInfo.getGenericVariables(), tune.getChords())) .collect(Collectors.toList()); typeSpec.addSuperinterfaces(interfaces); } InterfaceHandler(Tune tune, MetaInfo metaInfo, RuleSet ruleSet); }
InterfaceHandler extends Handler { @Override public void process(TypeSpec.Builder typeSpec, TypeModel typeModel) { Set<VariableModel> interfaceDefinitions = new HashSet<>(); interfaceDefinitions.addAll(tune.interfaces()); interfaceDefinitions.addAll(typeModel.getInterfaces()); if (interfaceDefinitions.size() == 0) { return; } List<TypeName> interfaces = interfaceDefinitions.stream() .map(model -> getResolvedTypeName(model, metaInfo.getGenericVariables(), tune.getChords())) .collect(Collectors.toList()); typeSpec.addSuperinterfaces(interfaces); } InterfaceHandler(Tune tune, MetaInfo metaInfo, RuleSet ruleSet); @Override void process(TypeSpec.Builder typeSpec, TypeModel typeModel); }
InterfaceHandler extends Handler { @Override public void process(TypeSpec.Builder typeSpec, TypeModel typeModel) { Set<VariableModel> interfaceDefinitions = new HashSet<>(); interfaceDefinitions.addAll(tune.interfaces()); interfaceDefinitions.addAll(typeModel.getInterfaces()); if (interfaceDefinitions.size() == 0) { return; } List<TypeName> interfaces = interfaceDefinitions.stream() .map(model -> getResolvedTypeName(model, metaInfo.getGenericVariables(), tune.getChords())) .collect(Collectors.toList()); typeSpec.addSuperinterfaces(interfaces); } InterfaceHandler(Tune tune, MetaInfo metaInfo, RuleSet ruleSet); @Override void process(TypeSpec.Builder typeSpec, TypeModel typeModel);  }