Update of
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-qtags/src/main/java/org/xdoclet/plugin/qtags
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21143/src/main/java/org/xdoclet/plugin/qtags
Modified Files:
AbstractQTagsPlugin.java QTagUtils.java
Log Message:
Reformating with Jalopy
Index: QTagUtils.java
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-qtags/src/main/java/org/xdoclet/plugin/qtags/QTagUtils.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** QTagUtils.java 13 Dec 2004 16:15:54 -0000 1.10
--- QTagUtils.java 31 May 2005 11:28:56 -0000 1.11
***************
*** 1,11 ****
package org.xdoclet.plugin.qtags;
import com.thoughtworks.qdox.model.DocletTag;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaMethod;
- import org.generama.QDoxCapableMetadataProvider;
- import org.generama.MetadataProvider;
-
- import java.lang.reflect.InvocationTargetException;
/**
--- 1,17 ----
+ /*
+ * Copyright (c) 2003
+ * XDoclet Team
+ * All rights reserved.
+ */
package org.xdoclet.plugin.qtags;
+ import java.lang.reflect.InvocationTargetException;
+
+ import org.generama.MetadataProvider;
+ import org.generama.QDoxCapableMetadataProvider;
+
import com.thoughtworks.qdox.model.DocletTag;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaMethod;
/**
***************
*** 15,31 ****
*/
public class QTagUtils {
- /**
- * whether generation is desired for this class.
- * we generate only if class ( interface ) is it is not ignored
- */
- public boolean shouldGenerate(Object metadata) {
- JavaClass javaClass = (JavaClass) metadata;
- boolean isTagClass = javaClass.isA(DocletTag.class.getName());
-
- boolean enabled = javaClass.getTagByName("qtags.ignore") == null;
-
- return javaClass.isInterface() && isTagClass && enabled;
- }
-
public String getDocletTagName(JavaClass clazz) {
String name = clazz.getName();
--- 21,24 ----
***************
*** 43,54 ****
String result = hyphenate(method.getPropertyName(), false);
! if (method.getName().equals("getName")
! || method.getName().equals("getValue")) {
! throw new RuntimeException(
! "In order to declare a tag parameter named '" + result
! + "', declare a method called " + method.getName()
! + "_() instead of " + method.getName()
! + "(). This is to avoid clash with the method "
! + method.getName() + "() in " +
DocletTag.class.getName());
}
--- 36,44 ----
String result = hyphenate(method.getPropertyName(), false);
! if (method.getName().equals("getName") ||
method.getName().equals("getValue")) {
! throw new RuntimeException("In order to declare a tag parameter
named '" + result +
! "', declare a method called " + method.getName() + "_()
instead of " + method.getName() +
! "(). This is to avoid clash with the method " +
method.getName() + "() in " +
! DocletTag.class.getName());
}
***************
*** 64,72 ****
}
private String hyphenate(String camelCase, boolean firstIsDot) {
StringBuffer sb = new StringBuffer();
-
sb.append(Character.toLowerCase(camelCase.charAt(0)));
-
char[] chars = camelCase.toCharArray();
char separator = firstIsDot ? '.' : '-';
--- 54,116 ----
}
+ public boolean allowedOn(JavaClass clazz, String location) {
+ return !disallowedOn(clazz, location);
+ }
+
+ public boolean disallowedOn(JavaClass clazz, String location) {
+ DocletTag[] tags = clazz.getTagsByName("qtags.location");
+
+ if (tags.length == 0) {
+ return false;
+ }
+
+ for (int i = 0; i < tags.length; i++) {
+ if (location.equals(tags[i].getValue())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * register own tag library
+ */
+ public void registerLibrary(QDoxCapableMetadataProvider metadataProvider)
{
+ // try to register our tag library, not for us, but for users...
+ // if available
+ try {
+ Class clazz =
getClass().getClassLoader().loadClass("org.xdoclet.plugin.qtags.qtags.TagLibrary");
+
+ if (clazz != null) {
+ clazz.getDeclaredConstructor(new Class[]
{MetadataProvider.class}).newInstance(new Object[] {metadataProvider});
+ }
+ } catch (ClassNotFoundException cnfe) {
+ // we just do not care - shit can happen...
+ } catch (InstantiationException ie) {
+ // we just do not care - shit can happen...
+ } catch (IllegalAccessException ie) {
+ // we just do not care - shit can happen...
+ } catch (NoSuchMethodException ie) {
+ // we just do not care - shit can happen...
+ } catch (InvocationTargetException ie) {
+ // we just do not care - shit can happen...
+ }
+ }
+
+ /**
+ * whether generation is desired for this class.
+ * we generate only if class ( interface ) is it is not ignored
+ */
+ public boolean shouldGenerate(Object metadata) {
+ JavaClass javaClass = (JavaClass) metadata;
+ boolean isTagClass = javaClass.isA(DocletTag.class.getName());
+ boolean enabled = javaClass.getTagByName("qtags.ignore") == null;
+ return javaClass.isInterface() && isTagClass && enabled;
+ }
+
private String hyphenate(String camelCase, boolean firstIsDot) {
StringBuffer sb = new StringBuffer();
sb.append(Character.toLowerCase(camelCase.charAt(0)));
char[] chars = camelCase.toCharArray();
char separator = firstIsDot ? '.' : '-';
***************
*** 91,135 ****
return hyphenated;
}
!
! /**
! * register own tag library
! */
! public void registerLibrary(QDoxCapableMetadataProvider
metadataProvider) {
! // try to register our tag library, not for us, but for users...
! // if available
! try {
! Class clazz =
getClass().getClassLoader().loadClass("org.xdoclet.plugin.qtags.qtags.TagLibrary");
! if(clazz != null) {
! clazz.getDeclaredConstructor(new Class[]
{MetadataProvider.class}).newInstance(new Object[] {metadataProvider});
! }
! } catch(ClassNotFoundException cnfe) {
! // we just do not care - shit can happen...
! } catch(InstantiationException ie) {
! // we just do not care - shit can happen...
! } catch(IllegalAccessException ie) {
! // we just do not care - shit can happen...
! } catch(NoSuchMethodException ie) {
! // we just do not care - shit can happen...
! } catch(InvocationTargetException ie) {
! // we just do not care - shit can happen...
! }
!
! }
!
! public boolean allowedOn( JavaClass clazz, String location ) {
! return ! disallowedOn(clazz, location);
! }
!
! public boolean disallowedOn(JavaClass clazz, String location) {
! DocletTag[] tags = clazz.getTagsByName("qtags.location");
! if (tags.length == 0) {
! return false;
! }
! for (int i = 0; i < tags.length; i++) {
! if (location.equals(tags[i].getValue())) {
! return false;
! }
! }
! return true;
! }
! }
--- 135,137 ----
return hyphenated;
}
! }
\ No newline at end of file
Index: AbstractQTagsPlugin.java
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-qtags/src/main/java/org/xdoclet/plugin/qtags/AbstractQTagsPlugin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AbstractQTagsPlugin.java 16 Jan 2005 19:21:43 -0000 1.1
--- AbstractQTagsPlugin.java 31 May 2005 11:28:56 -0000 1.2
***************
*** 1,2 ****
--- 1,7 ----
+ /*
+ * Copyright (c) 2003
+ * XDoclet Team
+ * All rights reserved.
+ */
package org.xdoclet.plugin.qtags;
***************
*** 4,7 ****
--- 9,13 ----
import org.generama.TemplateEngine;
import org.generama.WriterMapper;
+
import org.generama.defaults.QDoxPlugin;
***************
*** 11,46 ****
*/
public abstract class AbstractQTagsPlugin extends QDoxPlugin {
! private String namespace;
! protected QTagUtils qTagUtils = new QTagUtils();
! /**
! * @param templateEngine
! * @param metadataProvider
! * @param writerMapper
! */
! public AbstractQTagsPlugin(TemplateEngine templateEngine,
! QDoxCapableMetadataProvider metadataProvider,
WriterMapper writerMapper) {
! super(templateEngine, metadataProvider, writerMapper);
! qTagUtils.registerLibrary(metadataProvider);
! }
! /**
! * plugin namespace will be used in documenation
! * @return
! */
! public String getNamespace() {
! return namespace;
! }
! /**
! * @return Returns the qTagUtils.
! */
! public QTagUtils getQTagUtils() {
! return qTagUtils;
! }
! public void setNamespace(String namespace) {
! this.namespace = namespace;
! }
!
! }
--- 17,51 ----
*/
public abstract class AbstractQTagsPlugin extends QDoxPlugin {
+ protected QTagUtils qTagUtils = new QTagUtils();
+ private String namespace;
! /**
! * @param templateEngine
! * @param metadataProvider
! * @param writerMapper
! */
! public AbstractQTagsPlugin(TemplateEngine templateEngine,
QDoxCapableMetadataProvider metadataProvider,
! WriterMapper writerMapper) {
! super(templateEngine, metadataProvider, writerMapper);
! qTagUtils.registerLibrary(metadataProvider);
! }
! public void setNamespace(String namespace) {
! this.namespace = namespace;
! }
! /**
! * plugin namespace will be used in documenation
! * @return
! */
! public String getNamespace() {
! return namespace;
! }
! /**
! * @return Returns the qTagUtils.
! */
! public QTagUtils getQTagUtils() {
! return qTagUtils;
! }
! }
\ No newline at end of file
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits