CollectionTypeDefinitionBuilder implements DeclaredTypeDefinitionBuilder { @Override public void build(ProcessingEnvironment processingEnv, DeclaredType type, TypeDefinition typeDefinition) { type.getTypeArguments() .stream() .map(typeArgument -> TypeDefinitionBuilder.build(processingEnv, typeArgument)) .filter(Objects::nonNull) .forEach(typeDefinition.getItems()::add); }  @Override boolean accept(ProcessingEnvironment processingEnv, DeclaredType type); @Override void build(ProcessingEnvironment processingEnv, DeclaredType type, TypeDefinition typeDefinition); @Override int getPriority();  }
@Test public void testBuild() { buildAndAssertTypeDefinition(processingEnv, stringsField, "java.util.Collection<java.lang.String>", "java.lang.String", builder); buildAndAssertTypeDefinition(processingEnv, colorsField, "java.util.List<org.apache.dubbo.metadata.annotation.processing.model.Color>", "org.apache.dubbo.metadata.annotation.processing.model.Color", builder); buildAndAssertTypeDefinition(processingEnv, primitiveTypeModelsField, "java.util.Queue<org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel>", "org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel", builder); buildAndAssertTypeDefinition(processingEnv, modelsField, "java.util.Deque<org.apache.dubbo.metadata.annotation.processing.model.Model>", "org.apache.dubbo.metadata.annotation.processing.model.Model", builder); buildAndAssertTypeDefinition(processingEnv, modelArraysField, "java.util.Set<org.apache.dubbo.metadata.annotation.processing.model.Model[]>", "org.apache.dubbo.metadata.annotation.processing.model.Model[]", builder); }