170 public boolean hasSetterFunction(final ScriptObject obj) { 171 return obj.getSpill(setterSlot) != null; 172 } 173 174 @Override 175 public Object getObjectValue(final ScriptObject self, final ScriptObject owner) { 176 return userAccessorGetter(owner, getGetterSlot(), self); 177 } 178 179 @Override 180 public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) { 181 userAccessorSetter(owner, getSetterSlot(), strict ? getKey() : null, self, value); 182 } 183 184 @Override 185 public MethodHandle getGetter(final Class<?> type) { 186 return Lookup.filterReturnType(USER_ACCESSOR_GETTER.methodHandle(), type); 187 } 188 189 @Override 190 public ScriptFunction getGetterFunction(final ScriptObject obj) { 191 final Object value = obj.getSpill(getterSlot); 192 return (value instanceof ScriptFunction) ? (ScriptFunction) value : null; 193 } 194 195 @Override 196 public MethodHandle getSetter(final Class<?> type, final PropertyMap currentMap) { 197 return USER_ACCESSOR_SETTER.methodHandle(); 198 } 199 200 @Override 201 public ScriptFunction getSetterFunction(final ScriptObject obj) { 202 final Object value = obj.getSpill(setterSlot); 203 return (value instanceof ScriptFunction) ? (ScriptFunction) value : null; 204 } 205 206 // User defined getter and setter are always called by "dyn:call". Note that the user 207 // getter/setter may be inherited. If so, proto is bound during lookup. In either 208 // inherited or self case, slot is also bound during lookup. Actual ScriptFunction 209 // to be called is retrieved everytime and applied. | 170 public boolean hasSetterFunction(final ScriptObject obj) { 171 return obj.getSpill(setterSlot) != null; 172 } 173 174 @Override 175 public Object getObjectValue(final ScriptObject self, final ScriptObject owner) { 176 return userAccessorGetter(owner, getGetterSlot(), self); 177 } 178 179 @Override 180 public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) { 181 userAccessorSetter(owner, getSetterSlot(), strict ? getKey() : null, self, value); 182 } 183 184 @Override 185 public MethodHandle getGetter(final Class<?> type) { 186 return Lookup.filterReturnType(USER_ACCESSOR_GETTER.methodHandle(), type); 187 } 188 189 @Override 190 void initMethodHandles(Class<?> structure) { 191 throw new UnsupportedOperationException(); 192 } 193 194 @Override 195 public ScriptFunction getGetterFunction(final ScriptObject obj) { 196 final Object value = obj.getSpill(getterSlot); 197 return (value instanceof ScriptFunction) ? (ScriptFunction) value : null; 198 } 199 200 @Override 201 public MethodHandle getSetter(final Class<?> type, final PropertyMap currentMap) { 202 return USER_ACCESSOR_SETTER.methodHandle(); 203 } 204 205 @Override 206 public ScriptFunction getSetterFunction(final ScriptObject obj) { 207 final Object value = obj.getSpill(setterSlot); 208 return (value instanceof ScriptFunction) ? (ScriptFunction) value : null; 209 } 210 211 // User defined getter and setter are always called by "dyn:call". Note that the user 212 // getter/setter may be inherited. If so, proto is bound during lookup. In either 213 // inherited or self case, slot is also bound during lookup. Actual ScriptFunction 214 // to be called is retrieved everytime and applied. |