<commit_before>/*
    Copyright 2013, Strategic Gains, Inc.

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
 */
package com.strategicgains.restexpress.plugin.swagger;

import org.jboss.netty.handler.codec.http.HttpMethod;
import org.restexpress.Format;
import org.restexpress.RestExpress;
import org.restexpress.plugin.AbstractPlugin;

/**
 * @author toddf
 * @since Nov 21, 2013
 */
public class SwaggerPlugin
extends AbstractPlugin
{
	private SwaggerController controller;
	private String urlPath;
	private String apiVersion;
	private String swaggerVersion = "1.2";

	public SwaggerPlugin()
	{
		this("/api-docs");
	}

	public SwaggerPlugin(String urlPath)
	{
		super();
		this.urlPath = urlPath;
	}

	public SwaggerPlugin apiVersion(String version)
	{
		this.apiVersion = version;
		return this;
	}

	public SwaggerPlugin swaggerVersion(String version)
	{
		this.swaggerVersion = version;
		return this;
	}

	@Override
	public SwaggerPlugin register(RestExpress server)
	{
		if (isRegistered()) return this;

		super.register(server);<commit_msg>Refactored swaggerVersion value into a constant.<commit_after>/*
    Copyright 2013, Strategic Gains, Inc.

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
 */
package com.strategicgains.restexpress.plugin.swagger;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jboss.netty.handler.codec.http.HttpMethod;
import org.restexpress.Format;
import org.restexpress.RestExpress;
import org.restexpress.plugin.AbstractPlugin;

/**
 * @author toddf
 * @since Nov 21, 2013
 */
public class SwaggerPlugin
extends AbstractPlugin
{
	private static final String SWAGGER_VERSION = "1.2";

	private SwaggerController controller;
	private String urlPath;
	private String apiVersion;
	private String swaggerVersion = SWAGGER_VERSION;
	private List<String> flags = new ArrayList<String>();
	private Map<String, Object> parameters = new HashMap<String, Object>();

	public SwaggerPlugin()
	{
		this("/api-docs");
	}

	public SwaggerPlugin(String urlPath)
	{
		super();
		this.urlPath = urlPath;
	}

	public SwaggerPlugin apiVersion(String version)
	{
		this.apiVersion = version;
		return this;
	}

	public SwaggerPlugin swaggerVersion(String version)
	{
		this.swaggerVersion = version;
		return this;
	}

	@Override
	public SwaggerPlugin register(RestExpress server)
	{
		if (isRegistered()) return this;

		super.register(server);
{'fraction_non_alphanumeric': 0.08343160377358491, 'fraction_numerical': 0.009433962264150943, 'mean_word_length': 4.608264462809918, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1377847', 'n_tokens_mistral': 1050, 'n_tokens_neox': 975, 'n_words': 336}