1 /*
2 * Copyright 2005 Werner Guttmann
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14 package org.exolab.castor.builder;
15
16 import org.exolab.castor.builder.info.ClassInfo;
17 import org.exolab.castor.builder.info.FieldInfo;
18 import org.exolab.castor.xml.schema.Facet;
19 import org.exolab.castor.xml.schema.SimpleType;
20 import org.exolab.javasource.JClass;
21 import org.exolab.javasource.JEnum;
22 import org.exolab.javasource.JEnumConstant;
23 import org.exolab.javasource.JField;
24 import org.exolab.javasource.JMethod;
25
26 /**
27 * This interface is a hook for (external) tools to add annotations to classes, fields and enums
28 * during the XML code generation process.
29 *
30 * Custom implementations of {@link AnnotationBuilder} instances can be added to a code generation
31 * execution using {@link SourceGenerator#addAnnotationBuilder(AnnotationBuilder)}
32 *
33 * @since 1.1.3
34 */
35 public interface AnnotationBuilder {
36
37 /**
38 * add annotations to a JClass.
39 *
40 * @param classInfo the classInfo
41 * @param jClass the jClass
42 */
43 void addClassAnnotations(ClassInfo classInfo, JClass jClass);
44
45 /**
46 * add annotation to a property definition.
47 *
48 * @param fieldInfo the fieldInfo
49 * @param field the jField
50 */
51 void addFieldAnnotations(FieldInfo fieldInfo, JField field);
52
53 /**
54 * add annotations to a getter of a property.
55 *
56 * @param fieldInfo the fieldInfo
57 * @param method the getter method
58 */
59 void addFieldGetterAnnotations(FieldInfo fieldInfo, JMethod method);
60
61 /**
62 * add annotations to a java5 enum.
63 *
64 * @param simpleType the corresponding simpleType
65 * @param jEnums the jEnum
66 */
67 void addEnumAnnotations(SimpleType simpleType, JEnum jEnums);
68
69 /**
70 * add annotations to a java5 enum constant.
71 *
72 * @param facet the corresponding facet
73 * @param enumConstant the jEnumConstant
74 */
75 void addEnumConstantAnnotations(Facet facet, JEnumConstant enumConstant);
76
77 }