Restore all fields from value stored in session except if they.
@param fields Fields to restore from session.
@param actionBean ActionBean.
@param context ActionBeanContext.
@throws IllegalAccessException Cannot get access to some fields.
194889
protected void restoreFields(Collection<Field> fields, ActionBean actionBean, ActionBeanContext context) throws IllegalAccessException {
        HttpSession session = context.getRequest().getSession(false);
        if (session != null) {
	        Set<String> parameters = this.getParameters(context.getRequest());
	        for (Field field : fields) {
	            if (!field.isAccessible()) {
	                field.setAccessible(true);
	            }
	            if (!parameters.contains(field.getName())) {
	                // Replace value.
	                Object value = session.getAttribute(getFieldKey(field, actionBean.getClass()));
	                // If value is null and field is primitive, don't set value.
	                if (!(value == null && field.getType().isPrimitive())) {
	                    field.set(actionBean, value);
	                }
	            }
	        }
        }
    }
418042
public static void setFieldValue(final Class<?> source, final Object target, final String fieldName, final Object value) throws NoSuchFieldException
    {
        try
        {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>()
            {
                @Override
                public Void run() throws Exception
                {
                    Field field = source.getDeclaredField(fieldName);
                    if(!field.isAccessible())
                    {
                        field.setAccessible(true);
                    }
                    field.set(target, value);
                    return null;
                }
            });
        }
        // Unwrap
        catch (final PrivilegedActionException pae)
        {
            final Throwable t = pae.getCause();
            // Rethrow
            if (t instanceof NoSuchFieldException)
            {
                throw (NoSuchFieldException) t;
            }
            else
            {
                // No other checked Exception thrown by Class.getConstructor
                try
                {
                    throw (RuntimeException) t;
                }
                // Just in case we've really messed up
                catch (final ClassCastException cce)
                {
                    throw new RuntimeException("Obtained unchecked Exception; this code should never be reached", t);
                }
            }
        }
    }
569924
@Override
    public void visitClassContext(ClassContext classContext) {

        try {
            if ((collectionClass == null) || (mapClass == null)) {
                return;
            }
            stack = new OpcodeStack();
            fieldUserValues = new HashMap<>();
            classContext.getJavaClass().accept(this);
        } finally {
            fieldUserValues = null;
            stack = null;
        }
    }
365425
public static Field makeAccessible(Field field) {
        if (field == null) {
            throw new IllegalArgumentException("Method argument field must not be null.");
        }
        if (isInaccessible(field) && !field.isAccessible()) {
            field.setAccessible(true);
        }

        return field;
    }
1081713
public static void uninitJavaControls( ServletContext servletContext, PageFlowManagedObject controlClient )
    {
        Map controlFields = getAccessibleControlFieldAnnotations( controlClient.getClass(), servletContext );

        for ( Iterator i = controlFields.keySet().iterator(); i.hasNext(); )
        {
            Field controlField = ( Field ) i.next();

            try
            {
                Object fieldValue = controlField.get( controlClient );

                if ( fieldValue != null )
                {
                    controlField.set( controlClient, null );
                    destroyControl( fieldValue );
                }
            }
            catch ( IllegalAccessException e )
            {
                LOG.error( "Exception while uninitializing Java Control " + controlField.getName(), e );
            }
        }
    }
412639
private static void setField(final Object instance, final Field field, final Object value)
   {
      final boolean accessability = field.isAccessible();

      try
      {
         field.setAccessible(true);
         field.set(instance, value);
      }
      catch (Exception e)
      {
         InjectionException.rethrow(e);
      }
      finally
      {
         field.setAccessible(accessability);
      }
   }
1267495
@Override
    protected void saveBeans(List<ProxyActionStatus> addedBeans, List<ProxyActionStatus> modifiedBeans,
            List<ProxyActionStatus> removedBeans) {
        // CRUD operations on Target will be done through repository methods
    }
972673
private static MappedField checkAccessors(XML xml, Class<?> aClass, Field nestedField){

		MappedField field = checkGetAccessor(xml, aClass, nestedField);
		verifySetterMethods(aClass,field);
		return field;
	}
229785
public void setIndexFields(java.util.Collection<IndexFieldStatus> indexFields) {
        if (indexFields == null) {
            this.indexFields = null;
            return;
        }

        this.indexFields = new com.amazonaws.internal.SdkInternalList<IndexFieldStatus>(indexFields);
    }
777952
protected static boolean useFieldAccessors ()
    {
        try {
            SecurityManager security = System.getSecurityManager();
            if (security != null) {
                security.checkPermission(new ReflectPermission("suppressAccessChecks"));
            }
            return false;
        } catch (SecurityException se) {
            return true;
        }
    }
912480
private static void setFields(final Object from, final Object to,
	                              final Field[] fields, final boolean accessible,
	                              final Map objMap, final Map metadataMap)
	{
		for (int f = 0, fieldsLength = fields.length; f < fieldsLength; ++f)
		{
			final Field field = fields[f];
			final int modifiers = field.getModifiers();
			if ((Modifier.STATIC & modifiers) != 0) continue;
			if ((Modifier.FINAL & modifiers) != 0)
				throw new ObjectCopyException("cannot set final field [" + field.getName() + "] of class [" + from.getClass().getName() + "]");
			if (!accessible && ((Modifier.PUBLIC & modifiers) == 0))
			{
				try
				{
					field.setAccessible(true);
				}
				catch (SecurityException e)
				{
					throw new ObjectCopyException("cannot access field [" + field.getName() + "] of class [" + from.getClass().getName() + "]: " + e.toString(), e);
				}
			}
			try
			{
				cloneAndSetFieldValue(field, from, to, objMap, metadataMap);
			}
			catch (Exception e)
			{
				throw new ObjectCopyException("cannot set field [" + field.getName() + "] of class [" + from.getClass().getName() + "]: " + e.toString(), e);
			}
		}
	}
264995
def load_fields(self, *fields):
        ''''''
        if self._loadedfields is not None:
            if self.session is None:
                raise SessionNotAvailable('No session available')
            meta = self._meta
            kwargs = {meta.pkname(): self.pkvalue()}
            obj = session.query(self).load_only(fields).get(**kwargs)
            for name in fields:
                field = meta.dfields.get(name)
                if field is not None:
                    setattr(self, field.attname,
                            getattr(obj, field.attname, None))
206783
public static Object unwrapFormBean( ActionForm form )
    {
        if ( form == null ) return null;

        if ( form instanceof AnyBeanActionForm )
        {
            return ( ( AnyBeanActionForm ) form ).getBean();
        }

        return form;
    }
246417
private static void setField(Object object, Object value, Field foundField) {
        foundField.setAccessible(true);
        try {
            int fieldModifiersMask = foundField.getModifiers();
            removeFinalModifierIfPresent(foundField);
            foundField.set(object, value);
            restoreModifiersToFieldIfChanged(fieldModifiersMask, foundField);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Internal error: Failed to set field in method setInternalState.", e);
        }
    }
207908
public void addFields(List<ModelFieldBean> modelFields) {
		Assert.notNull(modelFields, "modelFields must not be null");

		for (ModelFieldBean bean : modelFields) {
			this.fields.put(bean.getName(), bean);
		}
	}
421456
public void resolveActionBeanClass(BeanMethodActionRule beanMethodActionRule) throws IllegalRuleException {
        String beanIdOrClass = beanMethodActionRule.getBeanId();
        if (beanIdOrClass != null) {
            Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanMethodActionRule);
            if (beanClass != null) {
                beanMethodActionRule.setBeanClass(beanClass);
                reserveBeanReference(beanClass, beanMethodActionRule);
            } else {
                reserveBeanReference(beanIdOrClass, beanMethodActionRule);
            }
        }
    }
645664
private void initialize() throws IllegalArgumentException,
			IllegalAccessException {
		Field[] fields = this.getClass().getFields();
		for (Field f : fields) {
			if (this.getProperty(f.getName()) == null) {
				System.err.print("Property '" + f.getName()
						+ "' not defined in config file");
			}
			if (f.getType().equals(String.class)) {
				f.set(this, this.getProperty(f.getName()));
			} else if (f.getType().equals(long.class)) {
				f.setLong(this, Long.valueOf(this.getProperty(f.getName())));
			} else if (f.getType().equals(int.class)) {
				f.setInt(this, Integer.valueOf(this.getProperty(f.getName())));
			} else if (f.getType().equals(boolean.class)) {
				f.setBoolean(this,
						Boolean.valueOf(this.getProperty(f.getName())));
			} else if (f.getType().equals(String[].class)) {
				f.set(this, this.getProperty(f.getName()).split(";"));
			} else if (f.getType().equals(int[].class)) {
				String[] tmp = this.getProperty(f.getName()).split(";");
				int[] ints = new int[tmp.length];
				for (int i = 0; i < tmp.length; i++) {
					ints[i] = Integer.parseInt(tmp[i]);
				}
				f.set(this, ints);
			} else if (f.getType().equals(long[].class)) {
				String[] tmp = this.getProperty(f.getName()).split(";");
				long[] longs = new long[tmp.length];
				for (int i = 0; i < tmp.length; i++) {
					longs[i] = Long.parseLong(tmp[i]);
				}
				f.set(this, longs);
			}
		}
	}