/*
 * Copyright 2003, 2004  The Apache Software Foundation
 * 
 * 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 org.apache.ws.jaxme.xs.jaxb.impl;

import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
import org.apache.ws.jaxme.xs.xml.XsObject;


/**
 * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
 * @version $Id: JAXBClassImpl.java 231785 2004-02-16 23:39:59Z jochen $
 */
public class JAXBClassImpl extends JAXBXsObjectImpl implements JAXBClass {
  /** <p>Creates a new instance of ClassImpl.</p>
   */
  protected JAXBClassImpl(XsObject pParent) {
    super(pParent);
  }

  private String name;
  private String implClass;
  private JAXBJavadoc javadoc;

  /** <p>Sets the interfaces class name, not including the package name.
   * The package name is set in the schema bindings or
   * derived from the target namespace.</p>
   */
  public void setName(String pName) {
    name = pName;
  }

  /** <p>Returns the interfaces class name, not including the package name.
   * The package name is set in the schema bindings or
   * derived from the target namespace.</p>
   */
  public String getName() {
    return name;
  }

  /** <p>Sets the implementation classes name, including the package
   * name.</p>
   */
  public void setImplClass(String pImplClass) {
    implClass = pImplClass;
  }

  /** <p>Returns the implementation classes name, including the package
   * name.</p>
   */
  public String getImplClass() {
    return implClass;
  }

  /** <p>Sets the classes Javadoc documentation.</p>
   */
  public JAXBJavadoc createJavadoc() {
    if (javadoc == null) {
      javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
      return javadoc;
    } else {
      throw new IllegalStateException("Multiple Javadoc elements are not supported.");
    }
  }

  /** <p>Returns the classes Javadoc documentation.</p>
   */
  public JAXBJavadoc getJavadoc() {
    return javadoc;
  }
}
