001 package org.apache.myfaces.tobago.apt;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one or more
005 * contributor license agreements. See the NOTICE file distributed with
006 * this work for additional information regarding copyright ownership.
007 * The ASF licenses this file to You under the Apache License, Version 2.0
008 * (the "License"); you may not use this file except in compliance with
009 * the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020 import com.sun.mirror.apt.AnnotationProcessor;
021 import com.sun.mirror.apt.AnnotationProcessorEnvironment;
022 import com.sun.mirror.apt.AnnotationProcessorFactory;
023 import com.sun.mirror.declaration.AnnotationTypeDeclaration;
024
025 import java.util.Arrays;
026 import java.util.Collection;
027 import java.util.Collections;
028 import java.util.Set;
029
030 /*
031 * Created: Mar 5, 2005 12:39:32 PM
032 * $Id: TaglibAnnotationProcessorFactory.java 636712 2008-03-13 11:14:02Z bommel $
033 */
034 public class TaglibAnnotationProcessorFactory implements AnnotationProcessorFactory {
035
036 private static final Collection<String> SUPPORTED_ANNOTATIONS
037 = Collections.unmodifiableCollection(Arrays.asList(
038 "org.apache.myfaces.tobago.apt.annotation.Tag",
039 "org.apache.myfaces.tobago.apt.annotation.TagAttribute",
040 "org.apache.myfaces.tobago.apt.annotation.Taglib"));
041
042 private static final Collection<String> SUPPORTED_OPTIONS = Collections.emptySet();
043
044 private TaglibAnnotationProcessor annotationProcessor = null;
045
046 public Collection<String> supportedAnnotationTypes() {
047 return SUPPORTED_ANNOTATIONS;
048 }
049
050 public Collection<String> supportedOptions() {
051 return SUPPORTED_OPTIONS;
052 }
053
054 public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
055 AnnotationProcessorEnvironment env) {
056 if (annotationProcessor == null) {
057 annotationProcessor = new TaglibAnnotationProcessor(atds, env);
058 }
059 return annotationProcessor;
060 }
061
062 }