View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.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    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: AttributeEntry.java
13   * Created: 2008-01-04
14   * Author: apohllo
15   * $Id: AttributeEntry.java 2335 2009-01-13 16:40:16Z entrop $
16   */
17  
18  package pl.edu.agh.cast.model.mapper.internal;
19  
20  import java.lang.reflect.Method;
21  
22  import pl.edu.agh.cast.model.mapper.annotation.MapAttribute;
23  
24  /**
25   * The attribute entry class is used to map methods to
26   * their mapping annotations.
27   *
28   * @author AGH CAST Team
29   */
30  class AttributeEntry {
31  
32  	private Method key;
33  
34  	private MapAttribute value;
35  
36  	/**
37  	 * The constructor.
38  	 * @param method The method.
39  	 * @param annotation The annotation bound to the method.
40  	 */
41  	public AttributeEntry(Method method, MapAttribute annotation) {
42  		key = method;
43  		value = annotation;
44  	}
45  
46  	/**
47  	 * Method getter.
48  	 * @return The method.
49  	 */
50  	public Method getMethod() {
51  		return key;
52  	}
53  
54  	/**
55  	 * Annotation getter.
56  	 * @return The annotation.
57  	 */
58  	public MapAttribute getAnnotation() {
59  		return value;
60  	}
61  
62  	/**
63  	 * Annotation setter.
64  	 * @param newValue The new annotation.
65  	 * @return The old value of the annotation.
66  	 */
67  	public MapAttribute setValue(MapAttribute newValue) {
68  		MapAttribute oldValue = value;
69  		value = newValue;
70  		return oldValue;
71  	}
72  
73  }