ProtocolLib/Javadoc/com/comphenix/protocol/reflect/FieldUtils.html

734 lines
35 KiB
HTML
Raw Normal View History

2012-09-18 17:27:59 +02:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
2012-10-11 03:00:53 +02:00
<!-- Generated by javadoc (version 1.7.0_07) on Thu Oct 11 02:58:30 CEST 2012 -->
2012-09-18 17:27:59 +02:00
<title>FieldUtils</title>
2012-10-11 03:00:53 +02:00
<meta name="date" content="2012-10-11">
2012-09-18 17:27:59 +02:00
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="FieldUtils";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FieldUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/comphenix/protocol/reflect/FieldAccessException.html" title="class in com.comphenix.protocol.reflect"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/comphenix/protocol/reflect/FuzzyReflection.html" title="class in com.comphenix.protocol.reflect"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/comphenix/protocol/reflect/FieldUtils.html" target="_top">Frames</a></li>
<li><a href="FieldUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.comphenix.protocol.reflect</div>
<h2 title="Class FieldUtils" class="title">Class FieldUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.comphenix.protocol.reflect.FieldUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">FieldUtils</span>
extends java.lang.Object</pre>
2012-10-17 07:58:24 +02:00
<div class="block">Utilities for working with fields by reflection. Adapted and refactored from
the dormant [reflect] Commons sandbox component.
<p>
The ability is provided to break the scoping restrictions coded by the
programmer. This can allow fields to be changed that shouldn't be. This
2012-09-18 17:27:59 +02:00
facility should be used with care.</div>
<dl><dt><span class="strong">Since:</span></dt>
<dd>2.5</dd>
<dt><span class="strong">Version:</span></dt>
<dd>$Id: FieldUtils.java 1057009 2011-01-09 19:48:06Z niallp $</dd>
<dt><span class="strong">Author:</span></dt>
<dd>Apache Software Foundation, Matt Benson</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#FieldUtils()">FieldUtils</a></strong>()</code>
<div class="block">FieldUtils instances should NOT be constructed in standard programming.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.reflect.Field</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#getField(java.lang.Class, java.lang.String)">getField</a></strong>(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName)</code>
<div class="block">Gets an accessible <code>Field</code> by name respecting scope.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.reflect.Field</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#getField(java.lang.Class, java.lang.String, boolean)">getField</a></strong>(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
boolean&nbsp;forceAccess)</code>
2012-10-17 07:58:24 +02:00
<div class="block">Gets an accessible <code>Field</code> by name breaking scope if
2012-09-18 17:27:59 +02:00
requested.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readField(java.lang.reflect.Field, java.lang.Object)">readField</a></strong>(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target)</code>
<div class="block">Read an accessible Field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readField(java.lang.reflect.Field, java.lang.Object, boolean)">readField</a></strong>(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target,
boolean&nbsp;forceAccess)</code>
<div class="block">Read a Field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readField(java.lang.Object, java.lang.String)">readField</a></strong>(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName)</code>
<div class="block">Read the named public field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readField(java.lang.Object, java.lang.String, boolean)">readField</a></strong>(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName,
boolean&nbsp;forceAccess)</code>
<div class="block">Read the named field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readStaticField(java.lang.Class, java.lang.String)">readStaticField</a></strong>(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName)</code>
<div class="block">Read the named public static field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readStaticField(java.lang.Class, java.lang.String, boolean)">readStaticField</a></strong>(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
boolean&nbsp;forceAccess)</code>
<div class="block">Read the named static field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readStaticField(java.lang.reflect.Field)">readStaticField</a></strong>(java.lang.reflect.Field&nbsp;field)</code>
<div class="block">Read an accessible static Field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#readStaticField(java.lang.reflect.Field, boolean)">readStaticField</a></strong>(java.lang.reflect.Field&nbsp;field,
boolean&nbsp;forceAccess)</code>
<div class="block">Read a static Field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeField(java.lang.reflect.Field, java.lang.Object, java.lang.Object)">writeField</a></strong>(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target,
java.lang.Object&nbsp;value)</code>
<div class="block">Write an accessible field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeField(java.lang.reflect.Field, java.lang.Object, java.lang.Object, boolean)">writeField</a></strong>(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)</code>
<div class="block">Write a field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeField(java.lang.Object, java.lang.String, java.lang.Object)">writeField</a></strong>(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value)</code>
<div class="block">Write a public field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeField(java.lang.Object, java.lang.String, java.lang.Object, boolean)">writeField</a></strong>(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)</code>
<div class="block">Write a field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeStaticField(java.lang.Class, java.lang.String, java.lang.Object)">writeStaticField</a></strong>(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value)</code>
<div class="block">Write a named public static Field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeStaticField(java.lang.Class, java.lang.String, java.lang.Object, boolean)">writeStaticField</a></strong>(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)</code>
<div class="block">Write a named static Field.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeStaticField(java.lang.reflect.Field, java.lang.Object)">writeStaticField</a></strong>(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;value)</code>
<div class="block">Write a public static Field.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/reflect/FieldUtils.html#writeStaticField(java.lang.reflect.Field, java.lang.Object, boolean)">writeStaticField</a></strong>(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)</code>
<div class="block">Write a static Field.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="FieldUtils()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>FieldUtils</h4>
<pre>public&nbsp;FieldUtils()</pre>
2012-10-17 07:58:24 +02:00
<div class="block">FieldUtils instances should NOT be constructed in standard programming.
<p>
This constructor is public to permit tools that require a JavaBean
2012-09-18 17:27:59 +02:00
instance to operate.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getField(java.lang.Class, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getField</h4>
<pre>public static&nbsp;java.lang.reflect.Field&nbsp;getField(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName)</pre>
2012-10-17 07:58:24 +02:00
<div class="block">Gets an accessible <code>Field</code> by name respecting scope.
2012-09-18 17:27:59 +02:00
Superclasses/interfaces will be considered.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd>
<dt><span class="strong">Returns:</span></dt><dd>the Field object</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class or field name is null</dd></dl>
</li>
</ul>
<a name="getField(java.lang.Class, java.lang.String, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getField</h4>
<pre>public static&nbsp;java.lang.reflect.Field&nbsp;getField(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
boolean&nbsp;forceAccess)</pre>
2012-10-17 07:58:24 +02:00
<div class="block">Gets an accessible <code>Field</code> by name breaking scope if
2012-09-18 17:27:59 +02:00
requested. Superclasses/interfaces will be considered.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the Field object</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class or field name is null</dd></dl>
</li>
</ul>
<a name="readStaticField(java.lang.reflect.Field)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readStaticField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readStaticField(java.lang.reflect.Field&nbsp;field)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read an accessible static Field.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - to read</dd>
<dt><span class="strong">Returns:</span></dt><dd>the field value</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null or not static</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not accessible</dd></dl>
</li>
</ul>
<a name="readStaticField(java.lang.reflect.Field, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readStaticField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readStaticField(java.lang.reflect.Field&nbsp;field,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read a static Field.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - to read</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
2012-09-18 17:27:59 +02:00
<code>setAccessible</code> method.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the field value</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null or not static</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible</dd></dl>
</li>
</ul>
<a name="readStaticField(java.lang.Class, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readStaticField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readStaticField(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read the named public static field. Superclasses will be considered.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value of the field</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class or field name is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not accessible</dd></dl>
</li>
</ul>
<a name="readStaticField(java.lang.Class, java.lang.String, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readStaticField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readStaticField(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read the named static field. Superclasses will be considered.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - the class to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the Field object</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class or field name is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible</dd></dl>
</li>
</ul>
<a name="readField(java.lang.reflect.Field, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readField(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read an accessible Field.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - the field to use</dd><dd><code>target</code> - the object to call on, may be null for static fields</dd>
<dt><span class="strong">Returns:</span></dt><dd>the field value</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not accessible</dd></dl>
</li>
</ul>
<a name="readField(java.lang.reflect.Field, java.lang.Object, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readField(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read a Field.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - the field to use</dd><dd><code>target</code> - the object to call on, may be null for static fields</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
2012-09-18 17:27:59 +02:00
<code>setAccessible</code> method.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the field value</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible</dd></dl>
</li>
</ul>
<a name="readField(java.lang.Object, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readField(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read the named public field. Superclasses will be considered.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>target</code> - the object to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value of the field</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class or field name is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the named field is not public</dd></dl>
</li>
</ul>
<a name="readField(java.lang.Object, java.lang.String, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readField</h4>
<pre>public static&nbsp;java.lang.Object&nbsp;readField(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Read the named field. Superclasses will be considered.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>target</code> - the object to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the field value</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class or field name is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the named field is not made accessible</dd></dl>
</li>
</ul>
<a name="writeStaticField(java.lang.reflect.Field, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeStaticField</h4>
<pre>public static&nbsp;void&nbsp;writeStaticField(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;value)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a public static Field.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - to write</dd><dd><code>value</code> - to set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null or not static</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not public or is final</dd></dl>
</li>
</ul>
<a name="writeStaticField(java.lang.reflect.Field, java.lang.Object, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeStaticField</h4>
<pre>public static&nbsp;void&nbsp;writeStaticField(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a static Field.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - to write</dd><dd><code>value</code> - to set</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null or not static</dd>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible or is
2012-09-18 17:27:59 +02:00
final</dd></dl>
</li>
</ul>
<a name="writeStaticField(java.lang.Class, java.lang.String, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeStaticField</h4>
<pre>public static&nbsp;void&nbsp;writeStaticField(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a named public static Field. Superclasses will be considered.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - Class on which the Field is to be found</dd><dd><code>fieldName</code> - to write</dd><dd><code>value</code> - to set</dd>
<dt><span class="strong">Throws:</span></dt>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalArgumentException</code> - if the field cannot be located or is not
2012-09-18 17:27:59 +02:00
static</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not public or is final</dd></dl>
</li>
</ul>
<a name="writeStaticField(java.lang.Class, java.lang.String, java.lang.Object, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeStaticField</h4>
<pre>public static&nbsp;void&nbsp;writeStaticField(java.lang.Class&nbsp;cls,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a named static Field. Superclasses will be considered.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cls</code> - Class on which the Field is to be found</dd><dd><code>fieldName</code> - to write</dd><dd><code>value</code> - to set</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Throws:</span></dt>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalArgumentException</code> - if the field cannot be located or is not
2012-09-18 17:27:59 +02:00
static</dd>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible or is
2012-09-18 17:27:59 +02:00
final</dd></dl>
</li>
</ul>
<a name="writeField(java.lang.reflect.Field, java.lang.Object, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeField</h4>
<pre>public static&nbsp;void&nbsp;writeField(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target,
java.lang.Object&nbsp;value)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write an accessible field.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - to write</dd><dd><code>target</code> - the object to call on, may be null for static fields</dd><dd><code>value</code> - to set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not accessible or is final</dd></dl>
</li>
</ul>
<a name="writeField(java.lang.reflect.Field, java.lang.Object, java.lang.Object, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeField</h4>
<pre>public static&nbsp;void&nbsp;writeField(java.lang.reflect.Field&nbsp;field,
java.lang.Object&nbsp;target,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a field.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>field</code> - to write</dd><dd><code>target</code> - the object to call on, may be null for static fields</dd><dd><code>value</code> - to set</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the field is null</dd>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible or is
2012-09-18 17:27:59 +02:00
final</dd></dl>
</li>
</ul>
<a name="writeField(java.lang.Object, java.lang.String, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeField</h4>
<pre>public static&nbsp;void&nbsp;writeField(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a public field. Superclasses will be considered.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>target</code> - the object to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd><dd><code>value</code> - to set</dd>
<dt><span class="strong">Throws:</span></dt>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalArgumentException</code> - if <code>target</code> or
2012-09-18 17:27:59 +02:00
<code>fieldName</code> is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not accessible</dd></dl>
</li>
</ul>
<a name="writeField(java.lang.Object, java.lang.String, java.lang.Object, boolean)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>writeField</h4>
<pre>public static&nbsp;void&nbsp;writeField(java.lang.Object&nbsp;target,
java.lang.String&nbsp;fieldName,
java.lang.Object&nbsp;value,
boolean&nbsp;forceAccess)
throws java.lang.IllegalAccessException</pre>
<div class="block">Write a field. Superclasses will be considered.</div>
2012-10-17 07:58:24 +02:00
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>target</code> - the object to reflect, must not be null</dd><dd><code>fieldName</code> - the field name to obtain</dd><dd><code>value</code> - to set</dd><dd><code>forceAccess</code> - whether to break scope restrictions using the
<code>setAccessible</code> method. <code>False</code> will
2012-09-18 17:27:59 +02:00
only match public fields.</dd>
<dt><span class="strong">Throws:</span></dt>
2012-10-17 07:58:24 +02:00
<dd><code>java.lang.IllegalArgumentException</code> - if <code>target</code> or
2012-09-18 17:27:59 +02:00
<code>fieldName</code> is null</dd>
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FieldUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/comphenix/protocol/reflect/FieldAccessException.html" title="class in com.comphenix.protocol.reflect"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/comphenix/protocol/reflect/FuzzyReflection.html" title="class in com.comphenix.protocol.reflect"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/comphenix/protocol/reflect/FieldUtils.html" target="_top">Frames</a></li>
<li><a href="FieldUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>