1 7 package com.inversoft.verge.mvc.model; 8 9 import com.inversoft.verge.mvc.MVCException; 10 11 12 22 public abstract class AbstractMetaData implements MetaData { 23 24 protected String id; 25 protected String property; 26 27 28 33 public AbstractMetaData(String definition) throws MVCException { 34 assert (definition != null) : "definition == null"; 35 36 int index = definition.indexOf("."); 37 if (index == -1) { 38 throw new MVCException("Invalid definition: " + definition); 39 } 40 41 id = definition.substring(0, index); 42 property = definition.substring(index + 1); 43 } 44 45 48 public AbstractMetaData(String id, String property) { 49 assert (id != null) : "id == null"; 50 this.id = id; 51 this.property = property; 52 } 53 54 55 60 public String getID() { 61 return id; 62 } 63 64 69 public String getProperty() { 70 return property; 71 } 72 73 78 public String getDefinition() { 79 assert (property != null) : "property == null"; 80 81 if (property == null) { 84 return null; 85 } 86 87 StringBuffer buf = new StringBuffer (id).append(".").append(property); 88 return buf.toString(); 89 } 90 } | Popular Tags |