Sets an attribute on the given receiver for the specified arguments. The sender is the class that is setting the attribute from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided. The isCallToSuper and fromInsideClass help the Gro
(final Class sender, final Object object, final String attribute, final Object newValue, final boolean useSuper, final boolean fromInsideClass)
| 3200 | * @param fromInsideClass Whether the call was invoked from the inside or the outside of the class |
| 3201 | */ |
| 3202 | @Override |
| 3203 | public void setAttribute(final Class sender, final Object object, final String attribute, final Object newValue, final boolean useSuper, final boolean fromInsideClass) { |
| 3204 | checkInitalised(); |
| 3205 | |
| 3206 | boolean isStatic = (theClass != Class.class && object instanceof Class); |
| 3207 | if (isStatic && object != theClass) { |
| 3208 | MetaClass mc = registry.getMetaClass((Class<?>) object); |
| 3209 | mc.setAttribute(sender, object, attribute, newValue, useSuper, fromInsideClass); |
| 3210 | return; |
| 3211 | } |
| 3212 | |
| 3213 | MetaProperty mp = getMetaProperty(sender, attribute, useSuper, isStatic); |
| 3214 | if (mp != null) { |
| 3215 | if (mp instanceof MetaBeanProperty mbp) { |
| 3216 | mp = mbp.getField(); |
| 3217 | } |
| 3218 | if (mp != null) { |
| 3219 | mp.setProperty(object, newValue); |
| 3220 | return; |
| 3221 | } |
| 3222 | } |
| 3223 | |
| 3224 | throw new MissingFieldException(attribute, !useSuper ? theClass : theClass.getSuperclass()); |
| 3225 | } |
| 3226 | |
| 3227 | /** |
| 3228 | * Obtains a reference to the original AST for the MetaClass if it is available at runtime |
nothing calls this directly
no test coverage detected