org.apache.myfaces.buildtools.maven2.plugin.builder.qdox
Class QdoxHelper

java.lang.Object
  extended by org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper

public class QdoxHelper
extends Object

Helper class used by QdoxModelBuilder and provide utility methods.

Since:
1.0.4
Version:
$Revision: 1067554 $ $Date: 2011-02-05 19:33:43 -0500 (Sat, 05 Feb 2011) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Nested Class Summary
static class QdoxHelper.JavaClassComparator
           
 
Constructor Summary
QdoxHelper()
           
 
Method Summary
static void addFileToJavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder builder, org.codehaus.plexus.components.io.fileselectors.FileSelector selector, File path)
           
static void addFileToJavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder builder, org.codehaus.plexus.components.io.fileselectors.FileSelector selector, File path, String basePath)
           
static String clean(Object srcObj)
          Remove all leading whitespace and a quotemark if it exists.
static String evaluateParameterInitializationExpression(String value)
           
static com.thoughtworks.qdox.model.Annotation getAnnotation(com.thoughtworks.qdox.model.AbstractJavaEntity entity, String annoName)
           
static Boolean getBoolean(com.thoughtworks.qdox.model.JavaClass clazz, String key, Map map, Boolean dflt)
          Get the named attribute from a doc-annotation and convert to a boolean.
static String getFirstSentence(String doc)
          Given the full javadoc for a component, extract just the "first sentence".
static String getFullyQualifiedClassName(com.thoughtworks.qdox.model.JavaClass clazz, String fqn)
           
static com.thoughtworks.qdox.model.JavaClass[] getSourceClasses(List sourceDirs, String includes, String excludes)
           
static String getString(com.thoughtworks.qdox.model.JavaClass clazz, String key, Map map, String dflt)
          Get the named attribute from a doc-annotation.
static void initBehaviorAncestry(Map javaClassByName, Model model, ClassMeta modelItem)
          Same as initComponentAncestry but for converters
static void initComponentAncestry(Map javaClassByName, Model model, ClassMeta modelItem)
          For each component, try to find its "logical" parent component, ie the nearest superclass that is also annotated as a component and therefore has an entry in the model.
static void initConverterAncestry(Map javaClassByName, Model model, ClassMeta modelItem)
          Same as initComponentAncestry but for converters
static void initFaceletTagHandlerAncestry(Map javaClassByName, Model model, ClassMeta modelItem)
           
static void initValidatorAncestry(Map javaClassByName, Model model, ClassMeta modelItem)
          Same as initComponentAncestry but for validators.
static boolean isTagClassMissing(String tagClassName, List sourceDirs)
          Returns true if the tagClassName is not null, but the corresponding source file cannot be found in the specified source dirs.
static String methodToPropName(String methodName)
          Convert a method name to a property name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QdoxHelper

public QdoxHelper()
Method Detail

methodToPropName

public static String methodToPropName(String methodName)
Convert a method name to a property name.


getFirstSentence

public static String getFirstSentence(String doc)
Given the full javadoc for a component, extract just the "first sentence".

Initially, just find the first dot, and strip out any linefeeds. Later, try to handle "e.g." and similar (see javadoc algorithm for sentence detection).


getFullyQualifiedClassName

public static String getFullyQualifiedClassName(com.thoughtworks.qdox.model.JavaClass clazz,
                                                String fqn)

initComponentAncestry

public static void initComponentAncestry(Map javaClassByName,
                                         Model model,
                                         ClassMeta modelItem)
For each component, try to find its "logical" parent component, ie the nearest superclass that is also annotated as a component and therefore has an entry in the model.

In most cases this could be done at the time the component is processed. The processClass() method does try to process the classes that qdox discovers in ancestor->descendant order.

However there is one case where this just doesn't work. Therefore a two-pass approach is used: first create a ComponentMeta for each component, and then on a second pass find the matching parent for each one.

The problem case is where an annotated java class extends a generated one. In this case when walking up the ancestry tree of the hand-written class we find an entry for which there is no ComponentMeta entry. We do not know whether this is because the parent exists but is not annotated, or whether a ComponentMeta for that parent will be generated once we have processed some other class that happens to have the matching annotation.


initValidatorAncestry

public static void initValidatorAncestry(Map javaClassByName,
                                         Model model,
                                         ClassMeta modelItem)
Same as initComponentAncestry but for validators.


initConverterAncestry

public static void initConverterAncestry(Map javaClassByName,
                                         Model model,
                                         ClassMeta modelItem)
Same as initComponentAncestry but for converters


getAnnotation

public static com.thoughtworks.qdox.model.Annotation getAnnotation(com.thoughtworks.qdox.model.AbstractJavaEntity entity,
                                                                   String annoName)

initBehaviorAncestry

public static void initBehaviorAncestry(Map javaClassByName,
                                        Model model,
                                        ClassMeta modelItem)
Same as initComponentAncestry but for converters


initFaceletTagHandlerAncestry

public static void initFaceletTagHandlerAncestry(Map javaClassByName,
                                                 Model model,
                                                 ClassMeta modelItem)

evaluateParameterInitializationExpression

public static String evaluateParameterInitializationExpression(String value)

addFileToJavaDocBuilder

public static void addFileToJavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder builder,
                                           org.codehaus.plexus.components.io.fileselectors.FileSelector selector,
                                           File path)

addFileToJavaDocBuilder

public static void addFileToJavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder builder,
                                           org.codehaus.plexus.components.io.fileselectors.FileSelector selector,
                                           File path,
                                           String basePath)

clean

public static String clean(Object srcObj)
Remove all leading whitespace and a quotemark if it exists.

Qdox comments like foo val= "bar" return a value with leading whitespace and quotes, so remove them.


getString

public static String getString(com.thoughtworks.qdox.model.JavaClass clazz,
                               String key,
                               Map map,
                               String dflt)
Get the named attribute from a doc-annotation. Param clazz is the class the annotation is attached to; only used when reporting errors.


getBoolean

public static Boolean getBoolean(com.thoughtworks.qdox.model.JavaClass clazz,
                                 String key,
                                 Map map,
                                 Boolean dflt)
Get the named attribute from a doc-annotation and convert to a boolean. Param clazz is the class the annotation is attached to; only used when reporting errors.


isTagClassMissing

public static boolean isTagClassMissing(String tagClassName,
                                        List sourceDirs)
Returns true if the tagClassName is not null, but the corresponding source file cannot be found in the specified source dirs.


getSourceClasses

public static com.thoughtworks.qdox.model.JavaClass[] getSourceClasses(List sourceDirs,
                                                                       String includes,
                                                                       String excludes)


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.