示例#1
0
  /** Returns a SortedMap of all attributes that either belong to this ObjEntity or inherited. */
  @Override
  public SortedMap<String, ObjAttribute> getAttributeMap() {
    if (superEntityName == null) {
      return (SortedMap<String, ObjAttribute>) super.getAttributeMap();
    }

    SortedMap<String, ObjAttribute> attributeMap = new TreeMap<String, ObjAttribute>();
    appendAttributes(attributeMap);
    return attributeMap;
  }
示例#2
0
  /** Recursively appends all attributes in the entity inheritance hierarchy. */
  final void appendAttributes(Map<String, ObjAttribute> map) {
    map.putAll((Map<String, ObjAttribute>) super.getAttributeMap());

    ObjEntity superEntity = getSuperEntity();
    if (superEntity != null) {
      SortedMap<String, ObjAttribute> attributeMap = new TreeMap<String, ObjAttribute>();
      superEntity.appendAttributes(attributeMap);
      for (String attributeName : attributeMap.keySet()) {

        String overridedDbPath = attributeOverrides.get(attributeName);

        ObjAttribute attribute = new ObjAttribute(attributeMap.get(attributeName));
        attribute.setEntity(this);
        if (overridedDbPath != null) {
          attribute.setDbAttributePath(overridedDbPath);
        }
        map.put(attributeName, attribute);
      }
    }
  }