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

com.lunatech.doclets.jax.jaxrs.model.MethodParameter Maven / Gradle / Ivy

Go to download

jax-doclets allows you to generate JavaDoc documentation for specific Java annotation-based extensions.

The newest version!
/*
    Copyright 2009 Lunatech Research
    
    This file is part of jax-doclets.

    jax-doclets is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    jax-doclets is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with jax-doclets.  If not, see .
 */
package com.lunatech.doclets.jax.jaxrs.model;

import com.lunatech.doclets.jax.Utils;
import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag;
import com.sun.javadoc.Type;

public abstract class MethodParameter {

  protected AnnotationDesc paramAnnotation;

  protected MethodParameterType type;

  public MethodParameter(AnnotationDesc paramAnnotation, MethodParameterType type) {
    this.paramAnnotation = paramAnnotation;
    this.type = type;
  }

  public String getName() {
    return (String) Utils.getAnnotationValue(paramAnnotation);
  }

  public abstract String getDoc();

  public boolean isWrapped() {
    Type parameterType = getType();
    return !parameterType.isPrimitive() && parameterType.qualifiedTypeName().equals("java.lang.String")
           && Utils.getTag(getParameterDoc(), "inputWrapped") != null;
  }

  public String getWrappedType() {
    if (!isWrapped())
      return null;
    Tag tag = Utils.getTag(getParameterDoc(), "inputWrapped");
    return tag.text();
  }

  protected abstract Type getParameterType();

  public abstract Doc getParameterDoc();

  public abstract Tag[] getFirstSentenceTags();

  public String getTypeString() {
    return getParameterType().qualifiedTypeName() + getParameterType().dimension();
  }

  public Type getType() {
    return getParameterType();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy