Ejemplo n.º 1
0
 @Override
 public boolean setValue(Object entity, String attrName, Object value, String typ) {
   if (University.PROPERTY_NAME.equalsIgnoreCase(attrName)) {
     ((University) entity).setName((String) value);
     return true;
   }
   if (University.PROPERTY_STUDENTS.equalsIgnoreCase(attrName)) {
     ((University) entity).addToStudents((Student) value);
     return true;
   }
   if (University.PROPERTY_ROOMS.equalsIgnoreCase(attrName)) {
     ((University) entity).addToRooms((Room) value);
     return true;
   }
   if (University.PROPERTY_ICH.equalsIgnoreCase(attrName)) {
     ((University) entity).setIch("" + value);
     return true;
   }
   if (University.PROPERTY_USER.equalsIgnoreCase(attrName)) {
     ((University) entity).setUser("" + value);
     return true;
   }
   if (University.PROPERTY_VALUE.equalsIgnoreCase(attrName)) {
     ((University) entity).setValue("" + value);
     return true;
   }
   return false;
 }
Ejemplo n.º 2
0
  @Override
  public Object getValue(Object entity, String attrName) {
    int pos = attrName.indexOf(".");
    String attribute = attrName;

    if (pos > 0) {
      attribute = attrName.substring(0, pos);
    }
    if (University.PROPERTY_NAME.equalsIgnoreCase(attribute)) {
      return ((University) entity).getName();
    }
    if (University.PROPERTY_STUDENTS.equalsIgnoreCase(attribute)) {
      return ((University) entity).getStudents();
    }
    if (University.PROPERTY_ROOMS.equalsIgnoreCase(attribute)) {
      return ((University) entity).getRooms();
    }
    if (University.PROPERTY_ICH.equalsIgnoreCase(attribute)) {
      return ((University) entity).getIch();
    }
    if (University.PROPERTY_USER.equalsIgnoreCase(attribute)) {
      return ((University) entity).getUser();
    }
    if (University.PROPERTY_VALUE.equalsIgnoreCase(attribute)) {
      return ((University) entity).getValue();
    }
    return null;
  }