1 6 package com.nightlabs.ipanema.config; 7 8 import java.io.Serializable ; 9 10 import com.nightlabs.inheritance.FieldMetaData; 11 import com.nightlabs.inheritance.NotWritableException; 12 13 21 public class ConfigModuleSimpleFieldMetaData 22 implements FieldMetaData, Serializable 23 { 24 25 28 protected ConfigModuleSimpleFieldMetaData() { 29 super(); 30 } 31 32 public ConfigModuleSimpleFieldMetaData(ConfigModule configModule, String fieldName) { 33 this.configModule = configModule; 34 this.organisationID = configModule.getOrganisationID(); 35 this.userConfigID = configModule.getConfigID(); 36 this.cfModKey = configModule.getCfModKey(); 37 this.fieldName = fieldName; 38 } 39 40 44 private String organisationID; 45 46 50 private String userConfigID; 51 52 56 private String cfModKey; 57 58 62 private String fieldName; 63 64 67 private ConfigModule configModule; 68 69 72 public String getFieldName() { 73 return fieldName; 74 } 75 76 79 public byte getWritableByChildren() { 80 if (configModule.isAllowUserOverride()) 81 return WRITABLEBYCHILDREN_YES; 82 else 83 return WRITABLEBYCHILDREN_NO; 84 } 85 86 89 private byte writableByChildren = WRITABLEBYCHILDREN_YES; 90 91 94 public void setWritableByChildren(byte writableByChildren) { 95 this.writableByChildren = writableByChildren; 96 } 97 98 101 public boolean isWritable() { 102 return writable; 103 } 104 105 108 private boolean writable = true; 109 110 113 public void assertWritable() throws NotWritableException { 114 if (!isWritable()) 115 throw new NotWritableException("Field "+fieldName+" of "+configModule.getClass().getName()+" is not writable."); 116 } 117 118 121 public void setWritable(boolean writable) { 122 this.writable = writable; 123 } 124 125 128 private boolean valueInherited = true; 129 130 133 public boolean isValueInherited() { 134 return valueInherited; 135 } 136 137 140 public void setValueInherited(boolean valueInherited) { 141 this.valueInherited = valueInherited; 142 } 143 144 } 145 | Popular Tags |