734 Zeilen
34 KiB
HTML
734 Zeilen
34 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (version 1.7.0_21) on Tue May 14 01:28:32 CEST 2013 -->
|
|
<title>FieldUtils</title>
|
|
<meta name="date" content="2013-05-14">
|
|
<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: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </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>
|
|
<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
|
|
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"> </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"> </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 cls,
|
|
java.lang.String 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 cls,
|
|
java.lang.String fieldName,
|
|
boolean forceAccess)</code>
|
|
<div class="block">Gets an accessible <code>Field</code> by name breaking scope if
|
|
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 field,
|
|
java.lang.Object 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 field,
|
|
java.lang.Object target,
|
|
boolean 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 target,
|
|
java.lang.String 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 target,
|
|
java.lang.String fieldName,
|
|
boolean 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 cls,
|
|
java.lang.String 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 cls,
|
|
java.lang.String fieldName,
|
|
boolean 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 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 field,
|
|
boolean 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 field,
|
|
java.lang.Object target,
|
|
java.lang.Object 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 field,
|
|
java.lang.Object target,
|
|
java.lang.Object value,
|
|
boolean 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 target,
|
|
java.lang.String fieldName,
|
|
java.lang.Object 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 target,
|
|
java.lang.String fieldName,
|
|
java.lang.Object value,
|
|
boolean 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 cls,
|
|
java.lang.String fieldName,
|
|
java.lang.Object 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 cls,
|
|
java.lang.String fieldName,
|
|
java.lang.Object value,
|
|
boolean 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 field,
|
|
java.lang.Object 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 field,
|
|
java.lang.Object value,
|
|
boolean 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 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 FieldUtils()</pre>
|
|
<div class="block">FieldUtils instances should NOT be constructed in standard programming.
|
|
<p>
|
|
This constructor is public to permit tools that require a JavaBean
|
|
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 java.lang.reflect.Field getField(java.lang.Class cls,
|
|
java.lang.String fieldName)</pre>
|
|
<div class="block">Gets an accessible <code>Field</code> by name respecting scope.
|
|
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 java.lang.reflect.Field getField(java.lang.Class cls,
|
|
java.lang.String fieldName,
|
|
boolean forceAccess)</pre>
|
|
<div class="block">Gets an accessible <code>Field</code> by name breaking scope if
|
|
requested. 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
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 java.lang.Object readStaticField(java.lang.reflect.Field 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 java.lang.Object readStaticField(java.lang.reflect.Field field,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Read a static Field.</div>
|
|
<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
|
|
<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 java.lang.Object readStaticField(java.lang.Class cls,
|
|
java.lang.String 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 java.lang.Object readStaticField(java.lang.Class cls,
|
|
java.lang.String fieldName,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Read the named 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
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 java.lang.Object readField(java.lang.reflect.Field field,
|
|
java.lang.Object 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 java.lang.Object readField(java.lang.reflect.Field field,
|
|
java.lang.Object target,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Read a 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<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 java.lang.Object readField(java.lang.Object target,
|
|
java.lang.String 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 java.lang.Object readField(java.lang.Object target,
|
|
java.lang.String fieldName,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Read the named 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>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
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 void writeStaticField(java.lang.reflect.Field field,
|
|
java.lang.Object 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 void writeStaticField(java.lang.reflect.Field field,
|
|
java.lang.Object value,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Write a 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
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>
|
|
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible or is
|
|
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 void writeStaticField(java.lang.Class cls,
|
|
java.lang.String fieldName,
|
|
java.lang.Object 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>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if the field cannot be located or is 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.Class, java.lang.String, java.lang.Object, boolean)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>writeStaticField</h4>
|
|
<pre>public static void writeStaticField(java.lang.Class cls,
|
|
java.lang.String fieldName,
|
|
java.lang.Object value,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Write a named 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
only match public fields.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if the field cannot be located or is not
|
|
static</dd>
|
|
<dd><code>java.lang.IllegalAccessException</code> - if the field is not made accessible or is
|
|
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 void writeField(java.lang.reflect.Field field,
|
|
java.lang.Object target,
|
|
java.lang.Object 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 void writeField(java.lang.reflect.Field field,
|
|
java.lang.Object target,
|
|
java.lang.Object value,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Write a 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
only match public fields.</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 or is
|
|
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 void writeField(java.lang.Object target,
|
|
java.lang.String fieldName,
|
|
java.lang.Object 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>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if <code>target</code> or
|
|
<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 void writeField(java.lang.Object target,
|
|
java.lang.String fieldName,
|
|
java.lang.Object value,
|
|
boolean forceAccess)
|
|
throws java.lang.IllegalAccessException</pre>
|
|
<div class="block">Write a 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><dd><code>forceAccess</code> - whether to break scope restrictions using the
|
|
<code>setAccessible</code> method. <code>False</code> will
|
|
only match public fields.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if <code>target</code> or
|
|
<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: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
</body>
|
|
</html>
|