<li><ahref="../../../../com/comphenix/protocol/reflect/PrettyPrinter.html"title="class in com.comphenix.protocol.reflect"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../../com/comphenix/protocol/reflect/StructureModifierTest.html"title="class in com.comphenix.protocol.reflect"><spanclass="strong">Next Class</span></a></li>
<dl><dt><spanclass="strong">Type Parameters:</span></dt><dd><code>TField</code> - Type of the fields to retrieve.</dd></dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><ahref="../../../../com/comphenix/protocol/reflect/compiler/CompiledStructureModifier.html"title="class in com.comphenix.protocol.reflect.compiler">CompiledStructureModifier</a></dd>
</dl>
<hr>
<br>
<pre>public class <spanclass="strong">StructureModifier<TField></span>
extends java.lang.Object</pre>
<divclass="block">Provides list-oriented access to the fields of a Minecraft packet.
<p>
Implemented by using reflection. Use a CompiledStructureModifier, if speed is essential.</div>
<dl><dt><spanclass="strong">Author:</span></dt>
<dd>Kristian</dd></dl>
</li>
</ul>
</div>
<divclass="summary">
<ulclass="blockList">
<liclass="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ulclass="blockList">
<liclass="blockList"><aname="field_summary">
<!---->
</a>
<h3>Field Summary</h3>
<tableclass="overviewSummary"border="0"cellpadding="3"cellspacing="0"summary="Field Summary table, listing fields, and an explanation">
<thclass="colFirst"scope="col">Modifier and Type</th>
<thclass="colLast"scope="col">Field and Description</th>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code>protected <ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
<tdclass="colFirst"><code>protected java.util.Map<java.lang.Class,<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a>></code></td>
<divclass="block">Retrieves the type of the object we're modifying.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code>java.util.List<<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> converter,
java.util.Map<java.lang.Class,<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a>> subTypeCache)</code>
<divclass="block">Initialize every field of this class.</div>
<tdclass="colLast"><code><strong><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html#initialize(com.comphenix.protocol.reflect.StructureModifier)">initialize</a></strong>(<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> other)</code>
<divclass="block">Initialize using the same field types.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
com.google.common.base.Function<<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>,<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> select)</code>
<divclass="block">Correctly modifies the value of a field.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a></code></td>
<divclass="block">Reads the value of a field given its index.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a></code></td>
<tdclass="colLast"><code><strong><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html#setConverter(com.comphenix.protocol.reflect.EquivalentConverter)">setConverter</a></strong>(<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> converter)</code>
<divclass="block">Set the current object converter.</div>
<divclass="block">Retrieve the number of readable types.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code>protected <T> <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><T></code></td>
<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><T> converter)</code>
<divclass="block">Create a new structure modifier for the new field type.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
<divclass="block">Retrieves a structure modifier of the same type for a different object target.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code><T> <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><T></code></td>
<divclass="block">Retrieves a structure modifier that only reads and writes fields of a given type.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code><T> <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><T></code></td>
<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><T> converter)</code>
<divclass="block">Retrieves a structure modifier that only reads and writes fields of a given type.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a> value)</code>
<divclass="block">Writes the value of a field given its index.</div>
</td>
</tr>
<trclass="rowColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
<divclass="block">Sets all non-primitive fields to a more fitting default value.</div>
</td>
</tr>
<trclass="altColor">
<tdclass="colFirst"><code><ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>></code></td>
<pre>protected <ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> converter</pre>
<pre>protected java.util.Map<java.lang.Class,<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a>> subtypeCache</pre>
<divclass="block">Creates a structure modifier.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>targetType</code> - - the structure to modify.</dd><dd><code>superclassExclude</code> - - a superclass to exclude.</dd><dd><code>requireDefault</code> - - whether or not we will be using writeDefaults().</dd></dl>
</li>
</ul>
<aname="StructureModifier()">
<!---->
</a>
<ulclass="blockListLast">
<liclass="blockList">
<h4>StructureModifier</h4>
<pre>protected StructureModifier()</pre>
<divclass="block">Consumers of this method should call "initialize".</div>
<pre>protected void initialize(<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> other)</pre>
<divclass="block">Initialize using the same field types.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>other</code> - - information to set.</dd></dl>
<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> converter,
java.util.Map<java.lang.Class,<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a>> subTypeCache)</pre>
<divclass="block">Initialize every field of this class.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>targetType</code> - - type of the object we're reading and writing from.</dd><dd><code>fieldType</code> - - the common type of the fields we're modifying.</dd><dd><code>data</code> - - list of fields to modify.</dd><dd><code>defaultFields</code> - - list of fields that will be automatically initialized.</dd><dd><code>converter</code> - - converts between the common field type and the actual type the consumer expects.</dd><dd><code>subTypeCache</code> - - a structure modifier cache.</dd></dl>
</li>
</ul>
<aname="read(int)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>read</h4>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a> read(int fieldIndex)
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Reads the value of a field given its index.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldIndex</code> - - index of the field.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>Value of the field.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - The field doesn't exist, or it cannot be accessed under the current security contraints.</dd></dl>
</li>
</ul>
<aname="readSafely(int)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>readSafely</h4>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a> readSafely(int fieldIndex)
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Reads the value of a field if and ONLY IF it exists.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldIndex</code> - - index of the field.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>Value of the field, or NULL if it doesn't exist.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - The field cannot be accessed under the current security contraints.</dd></dl>
</li>
</ul>
<aname="write(int,java.lang.Object)">
<!---->
</a><aname="write(int, TField)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>write</h4>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> write(int fieldIndex,
<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a> value)
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Writes the value of a field given its index.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldIndex</code> - - index of the field.</dd><dd><code>value</code> - - new value of the field.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>This structure modifier - for chaining.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - The field doesn't exist, or it cannot be accessed under the current security contraints.</dd></dl>
</li>
</ul>
<aname="writeSafely(int,java.lang.Object)">
<!---->
</a><aname="writeSafely(int, TField)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>writeSafely</h4>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> writeSafely(int fieldIndex,
<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a> value)
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Writes the value of a given field IF and ONLY if it exists.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldIndex</code> - - index of the potential field.</dd><dd><code>value</code> - - new value of the field.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>This structure modifer - for chaining.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - The field cannot be accessed under the current security contraints.</dd></dl>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> modify(int fieldIndex,
com.google.common.base.Function<<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>,<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> select)
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Correctly modifies the value of a field.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldIndex</code> - - index of the field to modify.</dd><dd><code>select</code> - - the function that modifies the field value.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>This structure modifier - for chaining.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - The field cannot be accessed under the current security contraints.</dd></dl>
</li>
</ul>
<aname="withType(java.lang.Class)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>withType</h4>
<pre>public <T> <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><T> withType(java.lang.Class fieldType)</pre>
<divclass="block">Retrieves a structure modifier that only reads and writes fields of a given type.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldType</code> - - the type, or supertype, of every field to modify.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>A structure modifier for fields of this type.</dd></dl>
</li>
</ul>
<aname="writeDefaults()">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>writeDefaults</h4>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> writeDefaults()
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Sets all non-primitive fields to a more fitting default value. See <ahref="../../../../com/comphenix/protocol/reflect/instances/DefaultInstances.html#getDefault(java.lang.Class)"><code>DefaultInstances.getDefault(Class)</code></a>.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>The current structure modifier - for chaining.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - If we're unable to write to the fields due to a security limitation.</dd></dl>
<pre>public <T> <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><T> withType(java.lang.Class fieldType,
<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><T> converter)</pre>
<divclass="block">Retrieves a structure modifier that only reads and writes fields of a given type.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldType</code> - - the type, or supertype, of every field to modify.</dd><dd><code>converter</code> - - converts objects into the given type.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>A structure modifier for fields of this type.</dd></dl>
<pre>protected <T> <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><T> withFieldType(java.lang.Class fieldType,
<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><T> converter)</pre>
<divclass="block">Create a new structure modifier for the new field type.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>fieldType</code> - - common type of each field.</dd><dd><code>filtered</code> - - list of fields after filtering the original modifier.</dd><dd><code>defaults</code> - - list of default values after filtering the original.</dd><dd><code>converter</code> - - the new converter.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>A new structure modifier.</dd></dl>
</li>
</ul>
<aname="withTarget(java.lang.Object)">
<!---->
</a>
<ulclass="blockList">
<liclass="blockList">
<h4>withTarget</h4>
<pre>public <ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="class in com.comphenix.protocol.reflect">StructureModifier</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> withTarget(java.lang.Object target)</pre>
<divclass="block">Retrieves a structure modifier of the same type for a different object target.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>target</code> - - different target of the same type.</dd>
<dt><spanclass="strong">Returns:</span></dt><dd>Structure modifier with the new target.</dd></dl>
<pre>protected void setConverter(<ahref="../../../../com/comphenix/protocol/reflect/EquivalentConverter.html"title="interface in com.comphenix.protocol.reflect">EquivalentConverter</a><<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> converter)</pre>
<divclass="block">Set the current object converter. Should only be called during construction.</div>
<dl><dt><spanclass="strong">Parameters:</span></dt><dd><code>converter</code> - - current object converter.</dd></dl>
<divclass="block">Retrieves a list of the fields matching the constraints of this structure modifier.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>List of fields.</dd></dl>
</li>
</ul>
<aname="getValues()">
<!---->
</a>
<ulclass="blockListLast">
<liclass="blockList">
<h4>getValues</h4>
<pre>public java.util.List<<ahref="../../../../com/comphenix/protocol/reflect/StructureModifier.html"title="type parameter in StructureModifier">TField</a>> getValues()
throws <ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></pre>
<divclass="block">Retrieve every value stored in the fields of the current type.</div>
<dl><dt><spanclass="strong">Returns:</span></dt><dd>Every field value.</dd>
<dt><spanclass="strong">Throws:</span></dt>
<dd><code><ahref="../../../../com/comphenix/protocol/reflect/FieldAccessException.html"title="class in com.comphenix.protocol.reflect">FieldAccessException</a></code> - Unable to access one or all of the fields</dd></dl>
<li><ahref="../../../../com/comphenix/protocol/reflect/PrettyPrinter.html"title="class in com.comphenix.protocol.reflect"><spanclass="strong">Prev Class</span></a></li>
<li><ahref="../../../../com/comphenix/protocol/reflect/StructureModifierTest.html"title="class in com.comphenix.protocol.reflect"><spanclass="strong">Next Class</span></a></li>