Skip to contentMethod: HasDefault(String)
      1: package model.definition;
2: 
3: /**
4:  * Representation for definitions with a default value.
5:  * 
6:  * @author HFW410RA - Philipp Rammos
7:  * 
8:  */
9: public class HasDefault implements DefaultValue {
10:         /**
11:          * Represents the defaultValue.
12:          */
13:         private final String defaultValue;
14: 
15:         /**
16:          * Constructor, just sets fields. No side effects.
17:          * 
18:          * @param defaultValue
19:          *            The default value to set.
20:          */
21:         public HasDefault(final String defaultValue) {
22:                 this.defaultValue = defaultValue;
23:         }
24: 
25:         @Override
26:         public boolean equals(final Object obj) {
27:                 return obj instanceof HasDefault
28:                                 && ((HasDefault) obj).getDefaultValue().equals(this.getDefaultValue());
29:         }
30: 
31:         @Override
32:         public int hashCode() {
33:                 return this.getDefaultValue().hashCode() + this.getDefaultValue().hashCode();
34:         }
35: 
36:         /**
37:          * Returns the field defaultValue. No side effects.
38:          * 
39:          * @return this.defaultValue;
40:          */
41:         public String getDefaultValue() {
42:                 return this.defaultValue;
43:         }
44: 
45:         @Override
46:         public String toString() {
47:                 return basic.PrinterConstants.SPACE + basic.PrinterConstants.QUOTATIONMARK
48:                                 + this.defaultValue + basic.PrinterConstants.QUOTATIONMARK;
49:         }
50: 
51: }