Exemplo n.º 1
0
  /**
   * Conveniency method that allows you to obtain a particular {@link MetaSlotsssss} by it's name.
   *
   * @param name the name of the meta slot
   * @return the meta slot with the given name or <code>null</code> if not found
   */
  public MetaSlot getSlot(String name) {
    if (name == null) {
      return null;
    }

    for (MetaSlot slot : getAllSlots()) {
      if (slot.getName().equals(name)) {
        return slot;
      }
    }

    return null;
  }
  @Override
  protected void commit() {
    for (MetaSlot slot : getAllSlots()) {
      if (slot.isSetterIgnored()) {
        continue;
      }

      if (slot.isCached()) {
        Object value = slot.getObject();

        try {
          setProperty(slot, value);
        } catch (Exception e) {
          throw new RuntimeException(
              "could not write property '" + slot.getName() + "' in object " + getObject(), e);
        }
      }
    }
  }
 protected void setProperty(MetaSlot slot, Object value) {
   RendererPropertyUtils.setProperty(getObject(), slot.getName(), value, false);
 }