All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.kongchen.swagger.docgen.remote.model.JOAuth Maven / Gradle / Ivy

package com.github.kongchen.swagger.docgen.remote.model;

import java.util.ArrayList;
import java.util.List;

import com.github.kongchen.swagger.docgen.remote.ListConverter;
import com.github.kongchen.swagger.docgen.util.Utils;
import com.wordnik.swagger.model.AuthorizationScope;
import com.wordnik.swagger.model.GrantType;
import com.wordnik.swagger.model.OAuth;

/**
 * Created by chekong on 10/11/14.
 */

public class JOAuth implements CanBeSwaggerModel {
    private String type;
    private List scopes;
    private List grantTypes;

    
    public String getType() {
        return type;
    }

    
    public void setType(String type) {
        this.type = type;
    }

    public List getScopes() {
        return scopes;
    }

    public void setScopes(List scopes) {
        this.scopes = scopes;
    }

    public List getGrantTypes() {
        return grantTypes;
    }

    public void setGrantTypes(List grantTypes) {
        this.grantTypes = grantTypes;
    }

    @Override
    public OAuth toSwaggerModel() {
        List gtypes = new ArrayList();
        for (JGrantType jgt : grantTypes) {
            gtypes.add(jgt.getAuthorization_code().toSwaggerModel());
            gtypes.add(jgt.getImplicit().toSwaggerModel());
        }
        return new OAuth(
                new ListConverter(scopes).convert(),
                Utils.toScalaImmutableList(gtypes));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy