1 4 package com.tc.object.config; 5 6 7 public class Root { 8 private final static byte DSO_FINAL_NOT_SET = 0x01; 9 private final static byte NOT_DSO_FINAL = 0x02; 10 private final static byte DSO_FINAL = 0x03; 11 12 private final String className; 13 private final String fieldName; 14 private final String rootName; 15 private final byte dsoFinal; 16 17 public Root(String className, String fieldName, String rootName) { 18 this.className = className; 19 this.fieldName = fieldName; 20 this.rootName = rootName; 21 this.dsoFinal = DSO_FINAL_NOT_SET; 22 } 23 24 public Root(String className, String fieldName, String rootName, boolean dsoFinal) { 25 this.className = className; 26 this.fieldName = fieldName; 27 this.rootName = rootName; 28 this.dsoFinal = dsoFinal? DSO_FINAL : NOT_DSO_FINAL; 29 } 30 31 public boolean matches(String matchClassName, String matchFieldName) { 32 return className.equals(matchClassName) && fieldName.equals(matchFieldName); 33 } 34 35 public String getClassName() { 36 return this.className; 37 } 38 39 public String getFieldName() { 40 return this.fieldName; 41 } 42 43 public String getRootName() { 44 return this.rootName == null ? className + "." + fieldName : rootName; 45 } 46 47 public boolean isDsoFinal(boolean isPrimitive) { 48 if (dsoFinal != DSO_FINAL_NOT_SET) { 49 return (dsoFinal == DSO_FINAL); 50 } else { 51 return !isPrimitive; 52 } 53 } 54 55 private boolean isDsoFinal() { 56 return (dsoFinal == DSO_FINAL); 57 } 58 59 public String toString() { 60 return getClass().getName() + "[className=" + getClassName() + ", fieldName=" + getFieldName() + ", rootName=" 61 + getRootName() + ", dsoFinal=" + isDsoFinal() + "]"; 62 } 63 } | Popular Tags |