"Variable Assignment Request" Object Design
<p>I have multiple classes that are not allowed to modify each other's fields, but instead must request to modify by adding a request object to the Main class's queue. The Main class, at the end of each loop, will perform the requested modifications.</p>

<pre><code>public class Main {

    public static ClassA a = new ClassA();
    public static ClassB b = new ClassB();

    private static List&lt;Request&gt; requestQueue = new ArrayList&lt;Request&gt;(); // List holds all requests

    public static void main(String args[]) {
        while (true) {
            a.tick();
            b.tick();
            for (Request r : requestQueue) {
                r.field = r.value; // All requests are fulfilled 
            }
            requestQueue.clear();
        }
    }

    public static &lt;ValueType&gt; void addModificationRequest(ValueType field,
            ValueType value) {
        requestQueue.add(new Request&lt;ValueType&gt;(field, value));
    }
}

// Request Object
public class Request&lt;ValueType&gt; {

    ValueType field;
    ValueType value;

    public Request(ValueType field, ValueType value) {
        this.field = field;
        this.value = value;
    }
}

// Classes
public class ClassA {
    String name = "A";

    public void tick() {
        Main.addModificationRequest(Main.b.name, "NewNameB"); // Try to change b name
    }
}

public class ClassB {
    String name = "B";

    public void tick() {
        // Nothing
    }
}
</code></pre>

<p>I know the code is messy, but its the simplest way I have thought of so far. Does anyone know any good design patterns that can accomplish this in a simpler and more robust way?
(Note: I must have it this way, there is no possibility of allowing the classes to directly modify each other.)</p>

<p><strong>Edit:</strong> The classes will have more than one modifiable variable. I also need to determine if any requests try to modify the same variable, so I can ignore one or both.</p>

<p><strong>Edit:</strong> Thanks for all the help, I really appreciate it! I have decided to let the classes keep track of their own modifications. I am also going to use the same Request object I have been using because it is simple and straightforward. Again, thank you.</p>
