Permalink
Browse files

Adding some formatting

  • Loading branch information...
1 parent 34acc83 commit 6e68b32815ca50e54abb8da0e0ea204fb557d4ad @lguerin lguerin committed Oct 5, 2010
@@ -76,9 +76,9 @@ public Taglib build(String rootPackage, String[] supportedPackages, URL[] urls)
log.debug("Creating taglib object model...");
-
- for(String subPackage : supportedPackages){
- String pkgname = rootPackage +"."+ subPackage;
+ for (String subPackage : supportedPackages)
+ {
+ String pkgname = rootPackage + "." + subPackage;
log.debug("Processing taglib for full package named : " + pkgname);
@@ -119,7 +119,6 @@ public Taglib build(String rootPackage, String[] supportedPackages, URL[] urls)
}
}
-
log.debug("Taglib object model completed");
return taglib;
}
@@ -133,8 +132,8 @@ public Taglib build(String rootPackage, String[] supportedPackages, URL[] urls)
*/
private List<Field> getFieldAnnotatedWithParameter(String rootPackage, Class<?> c)
{
- Reflections reflection = new Reflections(rootPackage, new SingleTypeFieldAnnotationScanner(c).filterResultsBy(new FilterBuilder.Include(
- Parameter.class.getCanonicalName())));
+ Reflections reflection = new Reflections(rootPackage, new SingleTypeFieldAnnotationScanner(c).filterResultsBy(new FilterBuilder.Include(Parameter.class
+ .getCanonicalName())));
Collection<String> fieldsAsString = reflection.getStore().get(SingleTypeFieldAnnotationScanner.class).values();
List<Field> fields = new ArrayList<Field>();
for (String fAsString : fieldsAsString)
@@ -155,7 +154,7 @@ private Tag buildTagFromClass(String rootPackage, Class<?> c)
{
Tag tag = new Tag();
tag.setTagClass(c.getName());
- tag.setName(c.getSimpleName());
+ tag.setName(c.getSimpleName().toLowerCase());
List<Field> fields = getFieldAnnotatedWithParameter(rootPackage, c);
@@ -178,21 +177,22 @@ private Attribute buildAttributeFromField(Field field)
log.debug("Processing Attribute : " + field.getName());
Attribute attribute = new Attribute();
- attribute.setName(StringUtils.isNotEmpty(field.getAnnotation(Parameter.class).name())?field.getAnnotation(Parameter.class).name():field.getName());
+ attribute.setName(StringUtils.isNotEmpty(field.getAnnotation(Parameter.class).name()) ? field.getAnnotation(Parameter.class).name() : field.getName());
attribute.setDeferredValue(field.getType().getName());
attribute.setRequired(field.getAnnotation(Parameter.class).required());
attribute.setParameterDescription(buildParameterDescription(field.getAnnotation(Parameter.class)));
-
+
return attribute;
}
-
- private String buildParameterDescription(Parameter p){
+
+ private String buildParameterDescription(Parameter p)
+ {
StringBuilder builder = new StringBuilder();
-
+
builder.append(TapestryTldGenConstants.ALLOW_NULL_TXT).append(p.allowNull()).append("\n");
builder.append(TapestryTldGenConstants.DEFAULT_TLD_SEPARATOR).append(TapestryTldGenConstants.DEFAULT_PREFIX_TXT).append(p.defaultPrefix()).append("\n");
-
+
return builder.toString();
}
}
@@ -41,9 +41,8 @@
/**
* Text displaying a generated by comment
*/
- public static final String GENERATED_BY = "<!-- Generated by tapestry-tldgen - http://exanpe.free.fr/tapestry-tldgen/-->";
+ public static final String GENERATED_BY = "<!-- Generated by tapestry-tldgen - http://exanpe.free.fr/tapestry-tldgen/ -->";
-
/**
* xmlns for &lt;taglib&gt; tag
*/
@@ -69,22 +68,22 @@
*/
public final static String[] TAPESTRY_SUPPORTED_SUBPACKAGES = new String[]
{ "base", "components" };
-
+
/**
* Allow null String in description
*/
public static final String ALLOW_NULL_TXT = "Allow null : ";
-
+
/**
* Default prefix in description
*/
public static final String DEFAULT_PREFIX_TXT = "Default prefix : ";
-
+
/**
* Separator in tld for multiple information in a single tag
*/
public static final String DEFAULT_TLD_SEPARATOR = " <br/> ";
-
+
/**
* Text displayed when no description has been found
*/

0 comments on commit 6e68b32

Please sign in to comment.