View Javadoc
1 package com.bonevich.erj.model; 2 3 import com.bonevich.erj.ErjConstants; 4 import com.bonevich.util.dependency.Dynamic; 5 6 /*** 7 * A class that represents an element in a Relational 8 * Data Model, such as a schema, relation, attribute, 9 * or key. 10 * 11 * @author Jeffrey D. Bonevich <bonevich@telocity.com> 12 */ 13 public abstract class ModelElement 14 implements ErjConstants 15 { 16 ////////////////////////////////////////////////////////// 17 // Constants 18 private static final String SEPARATOR = ":"; 19 20 ////////////////////////////////////////////////////////// 21 // Attributes 22 protected String _name; 23 protected String _identifier; 24 protected String _description; 25 26 ///////////////////////////////////////////////////////// 27 // Dynamic Sentries 28 protected Dynamic _dyn_name = new Dynamic(); 29 protected Dynamic _dyn_identifier = new Dynamic(); 30 protected Dynamic _dyn_description = new Dynamic(); 31 32 ////////////////////////////////////////////////////////// 33 // Getter/Setters 34 public String getName() 35 { 36 _dyn_name.onGet(); 37 return _name; 38 } 39 public void setName(String name) 40 { 41 if (!_name.equals(name)) 42 { 43 _dyn_name.onSet(); 44 _name = name; 45 } 46 } 47 public boolean isNameInitialized() 48 { 49 _dyn_name.onGet(); 50 return _name != null && !EMPTY_STR.equals(_name); 51 } 52 53 public String getIdentifier() 54 { 55 _dyn_identifier.onGet(); 56 return _identifier; 57 } 58 public void setIdentifier(String identifier) 59 { 60 if (!identifier.equals(_identifier)) 61 { 62 _dyn_identifier.onSet(); 63 _identifier = identifier; 64 } 65 } 66 67 public String getOclReferenceId() 68 { 69 return getClass().getName() + SEPARATOR + getIdentifier(); 70 } 71 72 public String getDescription() 73 { 74 _dyn_description.onGet(); 75 return _description; 76 } 77 public void setDescription(String description) 78 { 79 if (!_description.equals(description)) 80 { 81 _dyn_description.onSet(); 82 _description = description; 83 } 84 } 85 86 public String toString() 87 { 88 return getIdentifier(); 89 } 90 91 public boolean equals(Object rhs) 92 { 93 if (rhs != null && rhs instanceof ModelElement) 94 { 95 ModelElement that = (ModelElement)rhs; 96 if (that.getIdentifier().equals(getIdentifier())) 97 { 98 return true; 99 } 100 } 101 return false; 102 } 103 104 public abstract void dispose(); 105 106 public abstract void accept(ModelElementVisitor visitor); 107 108 } /* end class ModelElement */

This page was automatically generated by Maven