Search in sources :

Example 1 with GraphQLSchemaTypeDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.GraphQLSchemaTypeDTO in project carbon-apimgt by wso2.

the class GraphqlQueryAnalysisMappingUtil method fromGraphqlSchemaTypeListtoDTO.

/**
 * Converts a list of GraphqlSchemaType objects into a DTO object.
 *
 * @param typeList List<GraphqlSchemaType>
 * @return a new GraphQLSchemaTypeListDTO object corresponding to given list of GraphqlSchemaType objects
 */
public static GraphQLSchemaTypeListDTO fromGraphqlSchemaTypeListtoDTO(List<GraphqlSchemaType> typeList) {
    GraphQLSchemaTypeListDTO graphQLSchemaTypeListDTO = new GraphQLSchemaTypeListDTO();
    List<GraphQLSchemaTypeDTO> graphQLSchemaTypeDTOList = new ArrayList<>();
    for (GraphqlSchemaType graphqlSchemaType : typeList) {
        GraphQLSchemaTypeDTO graphQLSchemaTypeDTO = new GraphQLSchemaTypeDTO();
        List<String> fieldList = new ArrayList<>(graphqlSchemaType.getFieldList());
        graphQLSchemaTypeDTO.setType(graphqlSchemaType.getType());
        graphQLSchemaTypeDTO.setFieldList(fieldList);
        graphQLSchemaTypeDTOList.add(graphQLSchemaTypeDTO);
    }
    graphQLSchemaTypeListDTO.setTypeList(graphQLSchemaTypeDTOList);
    return graphQLSchemaTypeListDTO;
}
Also used : GraphqlSchemaType(org.wso2.carbon.apimgt.api.model.graphql.queryanalysis.GraphqlSchemaType) GraphQLSchemaTypeListDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.GraphQLSchemaTypeListDTO) ArrayList(java.util.ArrayList) GraphQLSchemaTypeDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.GraphQLSchemaTypeDTO)

Aggregations

ArrayList (java.util.ArrayList)1 GraphqlSchemaType (org.wso2.carbon.apimgt.api.model.graphql.queryanalysis.GraphqlSchemaType)1 GraphQLSchemaTypeDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.GraphQLSchemaTypeDTO)1 GraphQLSchemaTypeListDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.GraphQLSchemaTypeListDTO)1