Author: Alex.Kolonitsky
Date: 2010-03-31 06:46:24 -0400 (Wed, 31 Mar 2010)
New Revision: 16689
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
Log:
fix checkstyle errors
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java 2010-03-31
08:21:38 UTC (rev 16688)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Alias.java 2010-03-31
10:46:24 UTC (rev 16689)
@@ -23,10 +23,8 @@
package org.richfaces.cdk.annotations;
-import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
/**
* <p class="changed_added_4_0">
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-31
08:21:38 UTC (rev 16688)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributeProcessor.java 2010-03-31
10:46:24 UTC (rev 16689)
@@ -31,7 +31,6 @@
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.util.Strings;
-import javax.lang.model.element.TypeElement;
import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.MirroredTypesException;
import javax.lang.model.type.TypeMirror;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-31
08:21:38 UTC (rev 16688)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-03-31
10:46:24 UTC (rev 16689)
@@ -26,14 +26,11 @@
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.SubComponent;
import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.Test;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
import org.richfaces.cdk.model.ClassName;
@@ -81,73 +78,7 @@
setClassNames(componentElement, component, annotation.generate());
setComponentProperties(componentElement, component, annotation, library);
for (final SubComponent subcomponent : annotation.components()) {
- JsfComponent subAnnotation = new JsfComponent() {
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return JsfComponent.class;
- }
-
- @Override
- public String type() {
- return subcomponent.type();
- }
-
- @Override
- public Test test() {
- return subcomponent.test();
- }
-
- @Override
- public Tag[] tag() {
- return subcomponent.tag();
- }
-
- @Override
- public JsfRenderer renderer() {
- return subcomponent.renderer();
- }
-
- @Override
- public Class<?>[] interfaces() {
- return subcomponent.interfaces();
- }
-
- @Override
- public String generate() {
- return subcomponent.generate();
- }
-
- @Override
- public Event[] fires() {
- return new Event[0];
- }
-
- @Override
- public String family() {
- return annotation.family();
- }
-
- @Override
- public Facet[] facets() {
- return subcomponent.facets();
- }
-
- @Override
- public Description description() {
- return subcomponent.description();
- }
-
- @Override
- public SubComponent[] components() {
- return new SubComponent[0];
- }
-
- @Override
- public String[] attributes() {
- return subcomponent.attributes();
- }
- };
+ JsfComponent subAnnotation = new JsfSubComponent(subcomponent,
annotation.family());
ComponentModel subcomponentModel = new ComponentModel();
subcomponentModel.setBaseClass(component.getTargetClass());
subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
@@ -175,12 +106,12 @@
}
} catch (MirroredTypesException e) {
List<? extends TypeMirror> typeMirrors = e.getTypeMirrors();
- for(TypeMirror mirror :typeMirrors){
+ for (TypeMirror mirror : typeMirrors) {
// TODO call processAttributes with element from type mirror.
interfaceNames.add(ClassName.parseName(mirror.toString()));
}
}
- processAttributes(componentElement, component,annotation.attributes());
+ processAttributes(componentElement, component, annotation.attributes());
for (Tag tag : annotation.tag()) {
setTagInfo(tag, component);
Added:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2010-03-31
10:46:24 UTC (rev 16689)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright , Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.cdk.apt.processors;
+
+import org.richfaces.cdk.annotations.Description;
+import org.richfaces.cdk.annotations.Event;
+import org.richfaces.cdk.annotations.Facet;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.SubComponent;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.Test;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author akolonitsky
+ * @since Mar 31, 2010
+ */
+public class JsfSubComponent implements JsfComponent {
+
+ private SubComponent subcomponent;
+
+ private String family;
+
+ public JsfSubComponent(SubComponent subcomponent, String family) {
+ this.subcomponent = subcomponent;
+ this.family = family;
+ }
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return JsfComponent.class;
+ }
+
+ @Override
+ public String type() {
+ return this.subcomponent.type();
+ }
+
+ @Override
+ public Test test() {
+ return this.subcomponent.test();
+ }
+
+ @Override
+ public Tag[] tag() {
+ return this.subcomponent.tag();
+ }
+
+ @Override
+ public JsfRenderer renderer() {
+ return this.subcomponent.renderer();
+ }
+
+ @Override
+ public Class<?>[] interfaces() {
+ return this.subcomponent.interfaces();
+ }
+
+ @Override
+ public String generate() {
+ return this.subcomponent.generate();
+ }
+
+ @Override
+ public Event[] fires() {
+ return new Event[0];
+ }
+
+ @Override
+ public String family() {
+ return this.family;
+ }
+
+ @Override
+ public Facet[] facets() {
+ return this.subcomponent.facets();
+ }
+
+ @Override
+ public Description description() {
+ return this.subcomponent.description();
+ }
+
+ @Override
+ public SubComponent[] components() {
+ return new SubComponent[0];
+ }
+
+ @Override
+ public String[] attributes() {
+ return this.subcomponent.attributes();
+ }
+}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-31
08:21:38 UTC (rev 16688)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2010-03-31
10:46:24 UTC (rev 16689)
@@ -24,7 +24,6 @@
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import java.util.Collection;
-import java.util.List;
import java.util.Set;
public abstract class ProcessorBase {
@@ -83,7 +82,7 @@
}
protected void setDescription(DescriptionGroup component, Description description,
String docComment) {
- if(!Strings.isEmpty(docComment)){
+ if (!Strings.isEmpty(docComment)) {
component.setDescription(docComment);
}
if (description != null) {
@@ -119,7 +118,7 @@
}
protected String getDocComment(TypeElement componentElement) {
- return null !=
componentElement?getSourceUtils().getDocComment(asClassDesctiption(componentElement)):null;
+ return null != componentElement ?
getSourceUtils().getDocComment(asClassDesctiption(componentElement)) : null;
}
protected void processAttributes(TypeElement componentElement, final BeanModelBase
component, String[] annotationAttributes) throws CdkException {
@@ -141,7 +140,7 @@
});
// Process all files from @Jsf.. attributes property.
- for(String attributes : annotationAttributes){
+ for (String attributes : annotationAttributes) {
try {
component.getAttributes().addAll(parseProperties(
CdkEntityResolver.URN_ATTRIBUTES + attributes));