1#! /bin/sh
2#
3# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5#
6# This code is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License version 2 only, as
8# published by the Free Software Foundation.  Oracle designates this
9# particular file as subject to the "Classpath" exception as provided
10# by Oracle in the LICENSE file that accompanied this code.
11#
12# This code is distributed in the hope that it will be useful, but WITHOUT
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15# version 2 for more details (a copy is included in the LICENSE file that
16# accompanied this code).
17#
18# You should have received a copy of the GNU General Public License version
19# 2 along with this work; if not, write to the Free Software Foundation,
20# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23# or visit www.oracle.com if you need additional information or have any
24# questions.
25#
26
27# Generate exception classes
28
29SPEC=$1
30DST=$2
31
32gen() {
33  ID=$1
34  WHAT=$2
35  SVUID=$3
36  ARG_TYPE=$4
37  ARG_ID=$5
38  ARG_PROP=$6
39  ARG_PHRASE=$7
40  ARG_PARAM="$ARG_TYPE$ $ARG_ID"
41  echo '-->' $DST/$ID.java
42  out=$DST/${ID}.java
43
44  $SH ${SCRIPTS}/addNotices.sh "$COPYRIGHT_YEARS" > $out
45
46  cat >>$out <<__END__
47
48// -- This file was mechanically generated: Do not edit! -- //
49
50package $PACKAGE;
51
52
53/**$WHAT
54 *
55 * @since $SINCE
56 */
57
58public `if [ ${ABSTRACT:-0} = 1 ];
59        then echo 'abstract '; fi`class $ID
60    extends ${SUPER}
61{
62
63    private static final long serialVersionUID = $SVUID;
64__END__
65
66  if [ $ARG_ID ]; then
67
68    cat >>$out <<__END__
69
70    private $ARG_TYPE $ARG_ID;
71
72    /**
73     * Constructs an instance of this class.
74     *
75     * @param  $ARG_ID
76     *         The $ARG_PHRASE
77     */
78    public $ID($ARG_TYPE $ARG_ID) {
79        super(String.valueOf($ARG_ID));
80	this.$ARG_ID = $ARG_ID;
81    }
82
83    /**
84     * Retrieves the $ARG_PHRASE.
85     *
86     * @return  The $ARG_PHRASE
87     */
88    public $ARG_TYPE get$ARG_PROP() {
89        return $ARG_ID;
90    }
91
92}
93__END__
94
95  else
96
97    cat >>$out <<__END__
98
99    /**
100     * Constructs an instance of this class.
101     */
102    public $ID() { }
103
104}
105__END__
106
107  fi
108}
109
110. $SPEC
111