01: /*******************************************************************************
02: * Copyright (c) 2005 BEA Systems, Inc.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * jgarms@bea.com - initial API and implementation
10: *
11: *******************************************************************************/package org.eclipse.jdt.apt.tests.annotations;
12:
13: import java.util.ArrayList;
14: import java.util.Collection;
15: import java.util.Collections;
16:
17: import com.sun.mirror.apt.AnnotationProcessorFactory;
18:
19: /**
20: * Base class for annotation factories. Takes care of supported
21: * annotations and supported options.
22: */
23: public abstract class BaseFactory implements AnnotationProcessorFactory {
24:
25: private final Collection<String> _supportedAnnotations;
26:
27: /**
28: * Pass in supported annotations. At least one is required,
29: * the rest are optional.
30: *
31: * @param anno main annotation
32: * @param otherAnnos other supported annotations. Not necessary if
33: * no extra annotations are supported.
34: */
35: public BaseFactory(String anno, String... otherAnnos) {
36: _supportedAnnotations = new ArrayList<String>(
37: 1 + otherAnnos.length);
38: _supportedAnnotations.add(anno);
39: for (String s : otherAnnos) {
40: _supportedAnnotations.add(s);
41: }
42: }
43:
44: public Collection<String> supportedOptions() {
45: return Collections.emptyList();
46: }
47:
48: public Collection<String> supportedAnnotationTypes() {
49: return _supportedAnnotations;
50: }
51:
52: }
|