<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
span.literal
{mso-style-name:literal;}
span.st0
{mso-style-name:st0;}
span.st1
{mso-style-name:st1;}
span.st2
{mso-style-name:st2;}
span.st3
{mso-style-name:st3;}
span.string
{mso-style-name:string;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:729118117;
mso-list-type:hybrid;
mso-list-template-ids:-1687657514 -1604008954 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:Calibri;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:892500278;
mso-list-template-ids:-883234634;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2
{mso-list-id:1209335990;
mso-list-template-ids:-522924916;}
@list l2:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level2
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level3
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level5
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level6
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level8
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level9
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l3
{mso-list-id:1405646441;
mso-list-template-ids:-149358122;}
@list l4
{mso-list-id:1797480419;
mso-list-type:hybrid;
mso-list-template-ids:983445158 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l4:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l4:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l4:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style>
</head>
<body lang="en-CZ" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">I’ve added some factories below, which may simplify handling of some common custom attribute cases, for example:<o:p></o:p></span></p>
<pre style="background:white"><span style="color:black"> Classfile.<span class="st0"><i>of</i></span>(Classfile.<span class="st0"><i>AttributeMapperOption</i></span>.<span class="st0"><i>of</i></span>(attrName -> </span><span class="literal"><span style="color:#336BDD">switch</span></span><span style="color:black"> (attrName.stringValue()) {<o:p></o:p></span></pre>
<pre style="background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">case</span></span><span style="color:black"> </span><span class="string"><span style="color:#1E9347">"MyCustomBinaryContentAttribute"</span></span><span style="color:black"> -> <span class="st0"><i>selfContainedCustomAttribute</i></span>(attrName.stringValue());<o:p></o:p></span></pre>
<pre style="background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">case</span></span><span style="color:black"> </span><span class="string"><span style="color:#1E9347">"MyCustomAttributeWithCPReference"</span></span><span style="color:black"> -> <span class="st0"><i>singleConstantPoolEntryCustomAttribute</i></span>(attrName.stringValue());<o:p></o:p></span></pre>
<pre style="background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">default</span></span><span style="color:black"> -> </span><span class="literal"><span style="color:#336BDD">null</span></span><span style="color:black">;<o:p></o:p></span></pre>
<pre style="background:white"><span style="color:black"> }));<o:p></o:p></span></pre>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">For category #1 there might be a single factory getting attribute name and returning attribute mapper.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-family:"Courier New";color:#336BDD">
</span><span style="font-family:"Courier New";color:#336BDD">static</span><span style="font-family:"Courier New";color:black"> <T
</span><span style="font-family:"Courier New";color:#336BDD">extends</span><span style="font-family:"Courier New";color:black"> CustomAttribute<T>><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> AttributeMapper<T>
<b><i>selfContainedCustomAttribute</i></b>(String attributeName,<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> BiFunction<AttributeMapper<T>,
</span><span style="font-family:"Courier New";color:#336BDD">byte</span><span style="font-family:"Courier New";color:black">[], T> attributeFactory,<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> Function<T,
</span><span style="font-family:"Courier New";color:#336BDD">byte</span><span style="font-family:"Courier New";color:black">[]> contentAccessor) {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">return</span><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">new</span><span style="font-family:"Courier New";color:black"> AttributeMapper<T>() {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> @Override<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">public</span><span style="font-family:"Courier New";color:black"> String
<b>name</b>() {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">return</span><span style="font-family:"Courier New";color:black"> attributeName;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> @Override<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">public</span><span style="font-family:"Courier New";color:black"> T
<b>readAttribute</b>(AttributedElement enclosing, ClassReader cf, </span><span style="font-family:"Courier New";color:#336BDD">int</span><span style="font-family:"Courier New";color:black"> pos) {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">return</span><span style="font-family:"Courier New";color:black"> attributeFactory.apply(</span><span style="font-family:"Courier New";color:#336BDD">this</span><span style="font-family:"Courier New";color:black">,
cf.readBytes(pos, cf.readInt(pos - 4)));<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> @Override<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">public</span><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">void</span><span style="font-family:"Courier New";color:black">
<b>writeAttribute</b>(BufWriter buf, T attr) {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> buf.writeBytes(contentAccessor.apply(attr));<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> };<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">static</span><span style="font-family:"Courier New";color:black"> AttributeMapper<?
</span><span style="font-family:"Courier New";color:#336BDD">extends</span><span style="font-family:"Courier New";color:black"> CustomAttribute>
<b><i>selfContainedCustomAttribute</i></b>(String attributeName) {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">class</span><span style="font-family:"Courier New";color:black">
<b>SelfContainedAttribute</b> </span><span style="font-family:"Courier New";color:#336BDD">extends</span><span style="font-family:"Courier New";color:black"> CustomAttribute<SelfContainedAttribute> {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">final</span><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">byte</span><span style="font-family:"Courier New";color:black">[]
</span><span style="font-family:"Courier New";color:#CE54B8">content</span><span style="font-family:"Courier New";color:black">;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">public</span><span style="font-family:"Courier New";color:black">
<b>SelfContainedAttribute</b>(AttributeMapper<SelfContainedAttribute> mapper, </span>
<span style="font-family:"Courier New";color:#336BDD">byte</span><span style="font-family:"Courier New";color:black">[] content) {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">super</span><span style="font-family:"Courier New";color:black">(mapper);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">this</span><span style="font-family:"Courier New";color:black">.</span><span style="font-family:"Courier New";color:#CE54B8">content</span><span style="font-family:"Courier New";color:black"> = content;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black">
</span><span style="font-family:"Courier New";color:#336BDD">return</span><span style="font-family:"Courier New";color:black">
<i>selfContainedCustomAttribute</i>(attributeName, SelfContainedAttribute::</span><span style="font-family:"Courier New";color:#336BDD">new</span><span style="font-family:"Courier New";color:black">, a -> a.</span><span style="font-family:"Courier New";color:#CE54B8">content</span><span style="font-family:"Courier New";color:black">);<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">For category #2 there might be more options:</span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo6"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">A factory producing mapper which throws on write when CP is not shared</span><o:p></o:p></li></ul>
<p class="MsoNormal"><span lang="EN-US">This is default behavior of unknown attributes, so there is no user action needed.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo6"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Or a factory producing mapper simplifying CP entries clone and re-mapping on write when CP is not shared:</span><o:p></o:p></li></ul>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">static</span></span><span style="color:black"> <T </span><span class="literal"><span style="color:#336BDD">extends</span></span><span style="color:black"> CustomAttribute<T>><o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> AttributeMapper<T> <span class="st0"><b><i>singleConstantPoolEntryCustomAttribute</i></b></span>(String attributeName,<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> BiFunction<AttributeMapper<T>, PoolEntry, T> attributeFactory,<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> Function<T, PoolEntry> entryAccessor) {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">return</span></span><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">new</span></span><span style="color:black"> AttributeMapper<T>() {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> @Override<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">public</span></span><span style="color:black"> String <span class="st1"><b>name</b></span>() {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">return</span></span><span style="color:black"> attributeName;<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> @Override<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">public</span></span><span style="color:black"> T <span class="st1"><b>readAttribute</b></span>(AttributedElement enclosing, ClassReader cf, </span><span class="literal"><span style="color:#336BDD">int</span></span><span style="color:black"> pos) {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">return</span></span><span style="color:black"> attributeFactory.apply(</span><span class="literal"><span style="color:#336BDD">this</span></span><span style="color:black">, cf.readEntryOrNull(pos));<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> @Override<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">public</span></span><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">void</span></span><span style="color:black"> <span class="st1"><b>writeAttribute</b></span>(BufWriter buf, T attr) {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> buf.writeIndexOrZero(entryAccessor.apply(attr));<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> };<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">static</span></span><span style="color:black"> AttributeMapper<? </span><span class="literal"><span style="color:#336BDD">extends</span></span><span style="color:black"> CustomAttribute> <span class="st0"><b><i>singleConstantPoolEntryCustomAttribute</i></b></span>(String attributeName) {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">class</span></span><span style="color:black"> <span class="st1"><b>SingleEntryAttribute</b></span> </span><span class="literal"><span style="color:#336BDD">extends</span></span><span style="color:black"> CustomAttribute<SingleEntryAttribute> {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">final</span></span><span style="color:black"> PoolEntry </span><span class="st2"><span style="color:#CE54B8">entry</span></span><span style="color:black">;<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">public</span></span><span style="color:black"> <span class="st1"><b>SingleEntryAttribute</b></span>(AttributeMapper<SingleEntryAttribute> mapper, PoolEntry entry) {<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">super</span></span><span style="color:black">(mapper);<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">this</span></span><span style="color:black">.</span><span class="st2"><span style="color:#CE54B8">entry</span></span><span style="color:black"> = entry;<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> </span><span class="literal"><span style="color:#336BDD">return</span></span><span style="color:black"> <span class="st3"><i>singleConstantPoolEntryCustomAttribute</i></span>(attributeName, SingleEntryAttribute::</span><span class="literal"><span style="color:#336BDD">new</span></span><span style="color:black">, a -> a.</span><span class="st2"><span style="color:#CE54B8">entry</span></span><span style="color:black">);<o:p></o:p></span></pre>
<pre style="margin-left:18.0pt;background:white"><span style="color:black"> }<o:p></o:p></span></pre>
<div id="mail-editor-reference-message-container">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>