#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
export LC_ALL=C
set -A types
set -A props
set -A range
pkg=
while getopts i:o: x; do
case $x in
exec < $OPTARG
;;
exec > $OPTARG
;;
esac
done
if [[ -z "$pkg" ]]; then
pkg=$1
class=$2
fi
echo "package $pkg;"
echo
echo "import java.beans.*;"
echo "import java.io.Serializable;"
integer i=0
test -z "$type" && break
if [[ "$type" = "import" ]]; then
continue;
fi
types[${#types[*]}]=$type
props[${#props[*]}]=$prop
cmts[${#cmts[*]}]=$cmt
range[$i]=$i
i=$((i+1))
done
echo
echo "public class $class implements Serializable"
echo "{"
echo "\tprivate static final long serialVersionUID = 1;"
# instance variables
echo "\tprivate ${types[$i]} ${props[$i]}_;"
done
echo
# constructor properties
echo "\t@ConstructorProperties({\c"
echo "\"${props[$i]}\"\c"
done
echo "})"
# constructor
echo "\tpublic $class(\c"
echo "${types[$i]} ${props[$i]}\c"
done
echo ") {"
echo "\t\t${props[$i]}_ = ${props[$i]};"
done
echo "\t}"
# methods
type=${types[$i]}
# accessor
echo
if [[ -n $cmt ]]; then
echo "\t/**"
echo "\t * $cmt"
echo "\t */"
fi
else
fi
echo "\t{"
echo "\t\treturn (${prop}_);"
echo "\t}"
# mutator
echo
echo "\t{"
echo "\t\t${prop}_ = $prop;"
echo "\t}"
done
# verbatim additions
echo "}"