1 package org.eclipse.emf.examples.jet.article2.model; 2 3 4 13 public class Attribute 14 { 15 16 private boolean mKey = false; 17 18 private String mName = ""; 19 20 private String mType = ""; 21 22 25 public Attribute() 26 { 27 super(); 28 } 29 30 42 public Attribute(String type, String name, boolean isKey) 43 { 44 super(); 45 mType = type; 46 mName = name; 47 mKey = isKey; 48 } 49 50 57 public String toGetMethod() 58 { 59 return ("boolean".equals(getType())) ? "is" + getCappedName() : "get" + getCappedName(); 60 } 61 62 69 public String getCappedName() 70 { 71 return NameUtil.capName(getName()); 72 } 73 74 81 public String getUncappedName() 82 { 83 return NameUtil.uncapName(getName()); 84 } 85 86 public boolean isBoolean() 87 { 88 return "boolean".equals(getType()); 89 } 90 91 public boolean isInt() 92 { 93 return "int".equals(getType()); 94 } 95 96 public boolean isChar() 97 { 98 return "char".equals(getType()); 99 } 100 101 public boolean isByte() 102 { 103 return "byte".equals(getType()); 104 } 105 106 public boolean isShort() 107 { 108 return "short".equals(getType()); 109 } 110 111 public boolean isLong() 112 { 113 return "long".equals(getType()); 114 } 115 116 public boolean isDouble() 117 { 118 return "double".equals(getType()); 119 } 120 121 public boolean isFloat() 122 { 123 return "float".equals(getType()); 124 } 125 126 131 public String getName() 132 { 133 return mName; 134 } 135 136 141 public String getType() 142 { 143 return mType; 144 } 145 146 152 public void setName(String name) 153 { 154 mName = name; 155 } 156 157 163 public void setType(String type) 164 { 165 mType = type; 166 } 167 168 175 public boolean isKey() 176 { 177 return mKey; 178 } 179 180 188 public void setKey(boolean isKey) 189 { 190 mKey = isKey; 191 } 192 } | Popular Tags |