Exemplo n.º 1
0
 @Override
 public void addEntity(Entity entity) {
   Attribute attribute = (Attribute) entity;
   attributes.add((AttributeImpl) attribute);
   if (attribute.getDynamicType() != null && !this.isIdentical(attribute.getDynamicType()))
     throw new IllegalStateException(
         "Attribute '"
             + attribute
             + "' belongs to another dynamicType :"
             + attribute.getDynamicType());
   ((AttributeImpl) attribute).setParent(this);
 }
Exemplo n.º 2
0
 public void removeAttribute(Attribute attribute) {
   checkWritable();
   String matchingAttributeKey = findAttribute(attribute);
   if (matchingAttributeKey == null) {
     return;
   }
   attributes.remove(attribute);
   if (this.equals(attribute.getDynamicType())) {
     if (((AttributeImpl) attribute).isReadOnly()) {
       throw new IllegalArgumentException(
           "Attribute is not writable. It does not belong to the same dynamictype instance");
     }
     ((AttributeImpl) attribute).setParent(null);
   }
 }