Subversion Repositories SmartDukaan

Rev

Rev 323 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10 shop2020 1
/**
2
 * 
3
 */
4
package in.shop2020.metamodel.definitions;
5
 
16 naveen 6
import java.util.ArrayList;
10 shop2020 7
import java.util.List;
8
 
9
/**
49 naveen 10
 * Defines composite type of data object. 
10 shop2020 11
 * @author naveen
12
 *
13
 */
14
public class CompositeDefinition extends DatatypeDefinition {
15
 
16
	/**
17
	 * 
18
	 */
19
	private static final long serialVersionUID = 1L;
49 naveen 20
 
21
	/**
22
	 * Character or String used to separate different parts
23
	 */
20 naveen 24
	private String separator;
49 naveen 25
 
26
	/**
27
	 * List of parts
28
	 */
10 shop2020 29
	private List<CompositePartDefinition> compositePartDefinitions;
49 naveen 30
 
10 shop2020 31
	/**
49 naveen 32
	 * 
33
	 * @param newID 
34
	 * @param name
35
	 * @param separator
10 shop2020 36
	 */
20 naveen 37
	public CompositeDefinition(long newID, String name, String separator) {
16 naveen 38
		super(newID, name);
20 naveen 39
		this.separator = separator;
10 shop2020 40
	}
41
 
42
	/**
20 naveen 43
	 * @return the separator
44
	 */
45
	public String getSeparator() {
46
		return separator;
47
	}
48
 
49
	/**
49 naveen 50
	 * Handy method to add new parts to existing composite definition
16 naveen 51
	 * 
49 naveen 52
	 * @param partDefinition Composite Part Definition
16 naveen 53
	 */
54
	public void addCompositePartDefinition(
55
			CompositePartDefinition partDefinition) {
56
 
57
		if(this.compositePartDefinitions == null) {
58
			this.compositePartDefinitions = 
59
				new ArrayList<CompositePartDefinition>();
60
		}
61
 
62
		this.compositePartDefinitions.add(partDefinition);
63
	}
64
 
65
	/**
10 shop2020 66
	 * @param compositePartDefinitions the compositePartDefinitions to set
67
	 */
68
	public void setCompositePartDefinitions(List<CompositePartDefinition> compositePartDefinitions) {
69
		this.compositePartDefinitions = compositePartDefinitions;
70
	}
71
 
72
	/**
73
	 * @return the compositePartDefinitions
74
	 */
75
	public List<CompositePartDefinition> getCompositePartDefinitions() {
76
		return compositePartDefinitions;
77
	}
78
 
16 naveen 79
	/* (non-Javadoc)
80
	 * @see java.lang.Object#toString()
81
	 */
82
	@Override
83
	public String toString() {
84
		return "CompositeDefinition [compositePartDefinitions="
20 naveen 85
				+ compositePartDefinitions + ", separator=" + separator
86
				+ ", getDescription()=" + getDescription() + ", getName()="
87
				+ getName() + ", getID()=" + getID() + "]";
16 naveen 88
	}
10 shop2020 89
}