/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Properties supported and tag syntax:
*
* @beaninfo
* bound: flag
* constrained: flag
* expert: flag
* hidden: flag
* preferred: flag
* description: string
* displayname: string
* propertyeditorclass: string (with dots: foo.bar.MyPropertyEditor
* attribute: key1 value1
* attribute: key2 value2
*
* TODO: getValue and genDocletInfo needs some cleaning.
*
* @author Hans Muller
* @author Rich Schiavi
* @author Mark Davidson
*/
public class GenDocletBeanInfo {
"constrained",
"expert",
"hidden",
"preferred",
"displayname",
"propertyeditorclass",
"customizerclass",
"displayname",
"description",
"enum",
"attribute" };
private static boolean DEBUG = false;
/**
* Method called from the javadoc environment to determint the options length.
* Doclet options:
* -t template location
* -d outputdir
* -x true Enable debug output.
*/
// remind: this needs to be cleaned up
return 2;
return 2;
return 2;
return 0;
}
/** @beaninfo
* bound:true
* constrained:false
* expert:true
* hidden:true
* preferred:false
* description: the description of this method can
* do all sorts of funky things. if it \n
* is indented like this, we have to remove
* all char spaces greater than 2 and also any hard-coded \n
* newline characters and all newlines
* displayname: theString
* propertyeditorclass: foo.bar.MyPropertyEditorClass
* customizerclass: foo.bar.MyCustomizerClass
* attribute:key1 value1
* attribute: key2 value2
*
*/
return false;
}
return false;
}
* "Foo Foo.I1 Foo.I2 Bar Bar.I1 Bar.I2"
* i.e., with all the innerclasses of classes specified in the command
* line. We don't want to generate BeanInfo for any of these inner
* classes, so we ignore these by remembering what the last outer
* class was. A hack, I admit, but makes the build faster.
*/
if (previousClass != null &&
continue;
}
// XXX - debug
// Examine the javadoc tags and look for the the @beaninfo tag
// This first block looks at the javadoc for the class
if (DEBUG)
break;
}
}
// This block looks at the javadoc for the class methods.
int startPos = -1;
// actually don't "introspect" - look for all
// methods with a @beaninfo tag
startPos = 3;
startPos = 2;
else
startPos = 0;
if (DEBUG)
break;
}
}
}
if (DEBUG) {
// dump our classes doc beaninfo
while (e.hasMoreElements()) {
}
}
// Use the generator to create the beaninfo code for the class.
// reset the values!
} // end for loop
return true;
}
/**
* Reads the command line options.
* Side Effect, sets class variables templateDir, fileDir and DEBUG
*/
// Parse the command line args
DEBUG=true;
else
DEBUG=false;
}
}
}
/**
* Create a "BeanInfo" data structure from the tag. This is a data structure
* which contains all beaninfo data for a method or a class.
*
* @param text All the text after the @beaninfo tag.
* @param name Name of the property i.e., mnemonic for setMnemonic
*/
int beanflags = 0;
int index;
index = 0;
}
}
displayname = value;
}
}
}
}
}
}
/** here we create our doclet-beaninfo data structure, which we read in
* later if it has anything worthwhile
*/
// Construct a new Descriptor class
}
/**
* Parses the substring and returns the cleaned up value for the attribute.
* @param substring Full String of the attrib tag.
* i.e., "attribute: visualUpdate true" will return "visualUpdate true";
*/
try {
/** if the ATTRIBUTE_NAMES is NOT the description, then we
* parse until newline
* if it is the description we read until the next token
* and then look for a match in the last MAXMATCH index
* and truncate the description
* if it is the attribute we wead until no more
*/
try {
// we want to return : key1 value1 key2 value2
while (t.hasMoreTokens()){
break;
}
} catch (Exception e){
}
}
// trim off that
break;
}
}
}
// trim off that
break;
}
}
}
else {
// Single value properties like bound: true
}
// now we need to look for a match of any of the
// property
return value;
}
catch (Exception e){
return "invalidValue";
}
}
/**
* Creates a HashMap containing the key value pair for the parsed values
* of the "attributes" and "enum" tags.
* ie. For attribute value: visualUpdate true
* The HashMap will have key: visualUpdate, value: true
*/
if (num > 0) {
for (int i = 0; i < num; i++) {
}
}
return map;
}
// looks for extra spaces, \n hard-coded and invisible,etc
int toss = 0;
// remove double spaces
for (int i = 0; i < len; i++){
if ((chars[i] == ' ')) {
if (i+1 < len) {
{
--len;
--i;
}
}
}
if (chars[i] == '\n'){
chars[i] = ' ';
i -= 2;
}
if (chars[i] == '\\') {
if (i+1 < len) {
--len;
--i;
}
}
}
}
}
}