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: Loader.java
13   * Created: 2007-09-25
14   * Author: apohllo
15   * $Id: Mappable.java 2232 2009-01-04 22:59:53Z apohllo $
16   */
17  
18  package pl.edu.agh.cast.model.mapper;
19  
20  /**
21   * The mappable interface should be implemented by all classes mapped
22   * to the base model.
23   *
24   * @author AGH CAST Team
25   */
26  public interface Mappable {
27  	/**
28  	 * The base model id of the object.
29  	 * @return Base model id.
30  	 */
31  	public long getMid();
32  
33  	/**
34  	 * Base model id setter.
35  	 * @param id to set.
36  	 */
37  	public void setMid(long id);
38  
39  	/**
40  	 * Domain specific id of the object.
41  	 * @return The id of the object.
42  	 */
43  	public String getId();
44  
45  	/**
46  	 * Domain specific id setter.
47  	 * @param id The id to set.
48  	 */
49  	public void setId(String id);
50  
51  	/**
52  	 * Value of the attribute with name 'name' mapped to the base model.
53  	 * @param name The name of the attribute
54  	 * @return The value of the attribute
55  	 */
56  	public Object getAttribute(String name);
57  
58  	/**
59  	 * Array of names of attributes mapped to the base model.
60  	 * @return array of names.
61  	 */
62  	public String[] getAttributeNames();
63  
64  	/**
65  	 * Returns the type of the attribute with given name.
66  	 * @param name The name of the attribute.
67  	 * @return The type (class) of the attribute.
68  	 */
69  	public Class getAttributeType(String name);
70  
71  	/**
72  	 * Sets the value of the attribute with given name.
73  	 * @param name The name of the attribute.
74  	 * @param value The value of the attribute.
75  	 */
76  	public void setAttribute(String name, Object value);
77  
78  	/**
79  	 * The mapped type of the object.
80  	 * @return The type.
81  	 */
82  	public String getType();
83  
84  	/**
85  	 * Clones the mappable.
86  	 * @return Copy of the object.
87  	 */
88  	public Mappable clone();
89  }