001// Copyright 2005-2006 Ferdinand Prantl <prantl@users.sourceforge.net>
002// Copyright 2001-2004 The Apache Software Foundation
003// All rights reserved.
004//
005// Licensed under the Apache License, Version 2.0 (the "License");
006// you may not use this file except in compliance with the License.
007// You may obtain a copy of the License at
008//
009// http://www.apache.org/licenses/LICENSE-2.0
010//
011// Unless required by applicable law or agreed to in writing, software
012// distributed under the License is distributed on an "AS IS" BASIS,
013// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014// See the License for the specific language governing permissions and
015// limitations under the License.
016//
017// See http://ant-eclipse.sourceforge.net for the most recent version
018// and more information.
019
020package prantl.ant.eclipse;
021
022/**
023 * Describes an element under the element classpath referring to compiled classes. The
024 * attributes <tt>exported</tt> and <tt>source</tt> are optional.
025 * 
026 * @since Ant-Eclipse 1.0
027 * @author Ferdinand Prantl &lt;prantl@users.sourceforge.net&gt;
028 */
029public abstract class ClassPathEntryBinaryElement extends ClassPathEntryPathElement {
030
031    private boolean exported = false;
032
033    private String source = null;
034
035    private String javadoc = null;
036
037    /**
038     * Creates a new instance of the element containing binary code.
039     * 
040     * @since Ant-Eclipse 1.0
041     */
042    public ClassPathEntryBinaryElement() {
043    }
044
045    /**
046     * Returns if the referred compiled byte-code is exported during the jar-file
047     * generation (not by default).
048     * 
049     * @return <tt>True</tt> if the referred compiled byte-code is exported during the
050     *         jar-file generation.
051     */
052    public boolean getExported() {
053        return exported;
054    }
055
056    /**
057     * Sets if the referred compiled byte-code is exported during the jar-file generation.
058     * 
059     * @param flag
060     *        <tt>True</tt> if the referred compiled byte-code is exported during the
061     *        jar-file generation.
062     * @since Ant-Eclipse 1.0
063     */
064    public void setExported(boolean flag) {
065        exported = flag;
066    }
067
068    /**
069     * Returns a path with source code to the referred compiled byte-code or <tt>null</tt>
070     * if it has not been set, which means that the sources are not available.
071     * 
072     * @return A path with source code to the referred compiled byte-code or <tt>null</tt>
073     *         if not having been set.
074     */
075    public String getSource() {
076        return source;
077    }
078
079    /**
080     * Sets the path with source code to the referred compiled byte-code.
081     * 
082     * @param value
083     *        The path with source code to the referred compiled byte-code.
084     * @since Ant-Eclipse 1.0
085     */
086    public void setSource(String value) {
087        source = value;
088    }
089
090    /**
091     * Returns a path with a generated javadoc documentation to the referred compiled
092     * byte-code or <tt>null</tt> if it has not been set, which means that the javadoc
093     * is not available.
094     * 
095     * The path must be in formats accepted by Eclipse; either a path to a directory or a
096     * path to a zip-archive with correct prefixing:
097     * 
098     * <ul>
099     * <li>file:/path/to/a/directory/</li>
100     * <li>jar:file:/path/to/a/file.zip!/</li>
101     * </ul>
102     * 
103     * @return A path with javadoc to the referred compiled byte-code or <tt>null</tt>
104     *         if not having been set.
105     */
106    public String getJavadoc() {
107        return javadoc;
108    }
109
110    /**
111     * Sets the path with a generated javadoc documentation to the referred compiled
112     * byte-code.
113     * 
114     * The path must be in formats accepted by Eclipse; either a path to a directory or a
115     * path to a zip-archive with correct prefixing:
116     * 
117     * <ul>
118     * <li>file:/path/to/a/directory/</li>
119     * <li>jar:file:/path/to/a/file.zip!/</li>
120     * </ul>
121     * 
122     * @param value
123     *        The path with javadoc to the referred compiled byte-code.
124     * @since Ant-Eclipse 1.0
125     */
126    public void setJavadoc(String value) {
127        javadoc = value;
128    }
129
130}