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

org.apache.cxf.tools.common.model.JavaParameter Maven / Gradle / Ivy

There is a newer version: 3.0.0-milestone2
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you 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 org.apache.cxf.tools.common.model;


public class JavaParameter extends JavaType implements JavaAnnotatable {

    private boolean holder;
    private String holderName;
    private JAnnotation annotation;
    private String partName;

    private JavaMethod javaMethod;

    /**
     * Describe callback here.
     */
    private boolean callback;
    
    public JavaParameter() {
    }

    public JavaParameter(String n, String t, String tns) {
        super(n, t, tns);
    }

    public boolean isHolder() {
        return holder;
    }

    public void setHolder(boolean b) {
        holder = b;
    }

    public String getHolderName() {
        return holderName;
    }

    public void setHolderName(String hn) {
        this.holderName = hn;
    }

    public void setAnnotation(JAnnotation anno) {
        this.annotation = anno;
        for (String importClz : annotation.getImports()) {
            getMethod().getInterface().addImport(importClz);
        }        
    }

    public JAnnotation getAnnotation() {
        return this.annotation;
    }

    public void setPartName(String name) {
        this.partName = name;
    }
    
    public String getPartName() {
        return this.partName;
    }
    
    public String toString() {
        final StringBuffer sb = new StringBuffer();
        sb.append(super.toString());
        if (holder) {
            sb.append("\nIS Holder: [Holder Name]:");
            sb.append(holderName);
        }
        if (isHeader()) {
            sb.append("\nIS Header");
        }
        sb.append("\n Annotation:");
        sb.append(annotation);
        
        sb.append("\n PartName");
        sb.append(partName);
        return sb.toString();
    }
    
    public void setMethod(JavaMethod jm) {
        this.javaMethod = jm;
    }

    public JavaMethod getMethod() {
        return this.javaMethod;
    }

    public void annotate(Annotator annotator) {
        annotator.annotate(this);
    }

    /**
     * Get the Callback value.
     *
     * @return a boolean value
     */
    public final boolean isCallback() {
        return callback;
    }

    /**
     * Set the Callback value.
     *
     * @param newCallback The new Callback value.
     */
    public final void setCallback(final boolean newCallback) {
        this.callback = newCallback;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy