KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > controls > runtime > generator > apt > ControlAnnotationProcessorFactory


1 package org.apache.beehive.controls.runtime.generator.apt;
2
3 /*
4  * Copyright 2004 The Apache Software Foundation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * $Header:$
19  */

20
21 import java.util.Arrays JavaDoc;
22 import java.util.ArrayList JavaDoc;
23 import java.util.Collection JavaDoc;
24 import java.util.Collections JavaDoc;
25 import java.util.Set JavaDoc;
26
27 import com.sun.mirror.apt.AnnotationProcessor;
28 import com.sun.mirror.apt.AnnotationProcessorFactory;
29 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
30 import com.sun.mirror.declaration.AnnotationTypeDeclaration;
31
32 public class ControlAnnotationProcessorFactory implements AnnotationProcessorFactory
33 {
34     private static final Collection JavaDoc<String JavaDoc> _supportedAnnotations =
35             Collections.unmodifiableCollection(
36                 Arrays.asList(new String JavaDoc[] {
37                     org.apache.beehive.controls.api.bean.ControlInterface.class.getName(),
38                     org.apache.beehive.controls.api.bean.ControlExtension.class.getName(),
39                     org.apache.beehive.controls.api.bean.ControlImplementation.class.getName(),
40                     org.apache.beehive.controls.api.properties.PropertySet.class.getName()
41                     }));
42
43     private static final Collection JavaDoc<String JavaDoc> _supportedOptions =
44             Collections.unmodifiableCollection(
45                 Arrays.asList(new String JavaDoc[] {
46                     "-AcontrolGenerator", // sets CodeGenerator class
47
}));
48
49     public Collection JavaDoc<String JavaDoc> supportedOptions()
50     {
51         return _supportedOptions;
52     }
53
54     public Collection JavaDoc<String JavaDoc> supportedAnnotationTypes()
55     {
56         return _supportedAnnotations;
57     }
58
59     public AnnotationProcessor getProcessorFor(Set JavaDoc<AnnotationTypeDeclaration> atds,
60                                                AnnotationProcessorEnvironment env)
61     {
62         return new ControlAnnotationProcessor(atds, env);
63     }
64 }
65
Popular Tags