Beispiel #1
0
 public void setProperty(String property, Object newValue) {
   if ("delegate".equals(property)) {
     setDelegate(newValue);
   } else if ("metaClass".equals(property)) {
     setMetaClass((MetaClass) newValue);
   } else if ("resolveStrategy".equals(property)) {
     setResolveStrategy(((Number) newValue).intValue());
   } else if ("directive".equals(property)) {
     setDirective(((Number) newValue).intValue());
   } else {
     switch (resolveStrategy) {
       case DELEGATE_FIRST:
         setPropertyDelegateFirst(property, newValue);
         break;
       case DELEGATE_ONLY:
         InvokerHelper.setProperty(this.delegate, property, newValue);
         break;
       case OWNER_ONLY:
         InvokerHelper.setProperty(this.owner, property, newValue);
         break;
       case TO_SELF:
         super.setProperty(property, newValue);
         break;
       default:
         setPropertyOwnerFirst(property, newValue);
     }
   }
 }
Beispiel #2
0
 private void setPropertyDelegateFirst(String property, Object newValue) {
   if (delegate == null) setPropertyOwnerFirst(property, newValue);
   else setPropertyTryThese(property, newValue, this.delegate, this.owner);
 }