package com.doc.jersey.parser;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;

import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import com.simplapi.jersey.doc.annotation.ApiAuthor;
import com.simplapi.jersey.doc.annotation.ApiDeprecated;
import com.simplapi.jersey.doc.annotation.ApiDoc;
import com.simplapi.jersey.doc.annotation.ApiUnimplemented;
import com.simplapi.jersey.doc.annotation.ApiVersion;

import com.doc.jersey.content.AbstractBaseContent;

/**
 * Provide a shared parsing check for both method parse, and class parse
 * 
 * @author Deisss
 * @version 0.1
 */
public class BaseParser {
	/**
	 * Default parse for both method and class
	 * 
	 * @param annotation The current annotation
	 * @param content The currently performed class result
	 */
	public static boolean complete(Annotation annotation, AbstractBaseContent content) {
		boolean found = false;

		// PATH combine - @Path
		if(annotation instanceof Path) {
			found = true;
			Path p = (Path) annotation;
			content.setPath(p.value());
		}

		// Input/output - @Produces / @ Consumes
		if(annotation instanceof Produces) {
			found = true;
			Produces pr = (Produces) annotation;
			ArrayList<String> produceList = new ArrayList<String>(Arrays.asList(pr.value()));
			content.setProduceList(produceList);
		}
		if(annotation instanceof Consumes) {
			found = true;
			Consumes cs = (Consumes) annotation;
			ArrayList<String> consumeList = new ArrayList<String>(Arrays.asList(cs.value()));
			content.setConsumeList(consumeList);
		}

		// jersey-doc-annotation - @ApiDoc
		if(annotation instanceof ApiDoc) {
			ApiDoc ad = (ApiDoc) annotation;
			content.setDoc(ad.value());
		}

		// jersey-doc-annotation - @ApiDeprecated
		// or java - @Deprecated
		if(
				(annotation instanceof ApiDeprecated) ||
				(annotation instanceof Deprecated)
		) {
			found = true;
			content.setDeprecated(true);
		}

		// jersey-doc-annotation - @ApiUnimplemented
		if(annotation instanceof ApiUnimplemented) {
			found = true;
			content.setUnimplemented(true);
		}

		// jersey-doc-annotation - @ApiAuthor
		if(annotation instanceof ApiAuthor) {
			ApiAuthor aa = (ApiAuthor) annotation;
			content.setAuthor(aa.value());
		}

		// jersey-doc-annotation - @ApiVersion
		if(annotation instanceof ApiVersion) {
			ApiVersion av = (ApiVersion) annotation;
			content.setVersion(av.value());
		}

		return found;
	}
}

@@ -1808,22 +1808,16 @@
 ed%0A%09%09if(
-%0A%09%09%09%09(
 annotati
@@ -1849,15 +1849,70 @@
 ed) 
-%7C%7C
+%7B
 %0A%09%09%09
-%09
+found = true;%0A%09%09%09content.setDeprecated(true);%0A%09%09%7D else if
 (ann
@@ -1945,31 +1945,10 @@
 ted)
-%0A%09%09) %7B%0A%09%09%09found = true;
+ %7B
 %0A%09%09%09

Remove tiny bug because @Deprecated tag.