11/*
2- * To change this license header, choose License Headers in Project Properties.
3- * To change this template file, choose Tools | Templates
4- * and open the template in the editor.
2+ * The MIT License
3+ *
4+ * Copyright 2017 Arvind Sasikumar.
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to deal
8+ * in the Software without restriction, including without limitation the rights
9+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ * copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in
14+ * all copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+ * THE SOFTWARE.
523 */
24+
625package sync .db .mysql ;
726
827/**
9- *
28+ * An object of this class maps an attribute of the source table to an attribute
29+ * of the destination table.
1030 * @author Arvind Sasikumar
1131 */
1232public class AttributeMap {
@@ -16,23 +36,63 @@ public class AttributeMap {
1636
1737 private final AttributeType type ;
1838
19- public AttributeMap (String sourceAttribute , String destinationAttribute , AttributeType type ){
39+ /**
40+ * Create a new attribute map using this constructor.
41+ * The sourceAttribute and destinationAttribute parameters refer to the
42+ * source and destination attribute names respectively that are to be mapped
43+ * as found in their respective tables. The type parameter indicates whether
44+ * the datatype of the attributes to be mapped is of form
45+ * {@link sync.db.mysql.AttributeType#STRING} or
46+ * {@link sync.db.mysql.AttributeType#NUMERICAL}.
47+ * @param sourceAttribute attribute name in the source table
48+ * @param destinationAttribute corresponding attribute name in the
49+ * destination table
50+ * @param type specifies whether the attribute is of type
51+ * {@link sync.db.mysql.AttributeType#STRING} or
52+ * {@link sync.db.mysql.AttributeType#NUMERICAL},
53+ * as defined in the enum {@link sync.db.mysql.AttributeType}.
54+ * @see sync.db.mysql.AttributeType
55+ * @see sync.db.mysql.AttributeType#STRING
56+ * @see sync.db.mysql.AttributeType#NUMERICAL
57+ */
58+ public AttributeMap (String sourceAttribute , String destinationAttribute ,
59+ AttributeType type ){
2060
2161 this .sourceAttribute = sourceAttribute ;
2262 this .destinationAttribute = destinationAttribute ;
2363 this .type = type ;
2464 }
2565
66+ /**
67+ * Gets the attribute name of the source table in the current attribute
68+ * mapping.
69+ * @return attribute name of the source table in the current attribute
70+ * mapping
71+ */
2672 public String getSourceAttribute (){
2773
2874 return sourceAttribute ;
2975 }
3076
77+ /**
78+ * Gets the attribute name of the destination table in the current attribute
79+ * mapping.
80+ * @return attribute name of the destination table in the current attribute
81+ * mapping
82+ */
3183 public String getDestinationAttribute (){
3284
3385 return destinationAttribute ;
3486 }
3587
88+ /**
89+ * Gets the attribute type of the current attribute mapping.
90+ * @return type of the current attribute mapping, as defined by the enum
91+ * {@link sync.db.mysql.AttributeType}.
92+ * @see sync.db.mysql.AttributeType
93+ * @see sync.db.mysql.AttributeType#STRING
94+ * @see sync.db.mysql.AttributeType#NUMERICAL
95+ */
3696 public AttributeType getType (){
3797
3898 return type ;
0 commit comments