001/*license*\
002   Codelet: Copyright (C) 2014, Jeff Epstein (aliteralmind __DASH__ github __AT__ yahoo __DOT__ com)
003
004   This software is dual-licensed under the:
005   - Lesser General Public License (LGPL) version 3.0 or, at your option, any later version;
006   - Apache Software License (ASL) version 2.0.
007
008   Either license may be applied at your discretion. More information may be found at
009   - http://en.wikipedia.org/wiki/Multi-licensing.
010
011   The text of both licenses is available in the root directory of this project, under the names "LICENSE_lgpl-3.0.txt" and "LICENSE_asl-2.0.txt". The latest copies may be downloaded at:
012   - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
013   - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
014\*license*/
015package  com.github.aliteralmind.codelet.alter;
016   import  com.github.xbn.analyze.alter.AlterationRequired;
017   import  com.github.aliteralmind.codelet.CodeletInstance;
018   import  com.github.xbn.linefilter.AdaptRegexReplacerTo;
019   import  com.github.xbn.linefilter.alter.TextLineAlterAdapter;
020   import  com.github.aliteralmind.codelet.simplesig.AllSimpleParamSignatures;
021   import  com.github.aliteralmind.codelet.simplesig.ConstructorParamSearchTerm;
022   import  com.github.aliteralmind.codelet.simplesig.MethodSigSearchTerm;
023   import  com.github.xbn.analyze.validate.NewValidResultFilterFor;
024   import  com.github.xbn.analyze.validate.ValidResultFilter;
025   import  com.github.xbn.lang.CrashIfObject;
026   import  com.github.xbn.lang.reflect.Declared;
027   import  com.github.xbn.lang.reflect.ReflectRtxUtil;
028   import  com.github.xbn.regexutil.RegexReplacer;
029   import  com.github.xbn.regexutil.StringReplacer;
030   import  com.github.xbn.text.CrashIfString;
031   import  java.lang.reflect.Constructor;
032   import  java.lang.reflect.Field;
033   import  java.lang.reflect.Method;
034   import  java.util.HashMap;
035   import  java.util.Map;
036   import  static com.github.aliteralmind.codelet.CodeletBaseConfig.*;
037/**
038   <p>Convenience functions for creating new line alterers that replace a <i>single occurance</i> of a function (or class, constructor, or field) name with a clickable JavaDoc link.</p>
039
040   <h4>Known issues</h4>
041
042   <p>While it is verified that the link's target exists, it is not known whether the target is made viewable by JavaDoc. For example, if you link to a protected class, but configure JavaDoc to only display <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#public">public classes</a>, the link will be created, but clicking on it will result in going to the class itself (assuming the class is also viewable).</p>
043
044   @see  com.github.xbn.linefilter.alter.NewTextLineAltererFor
045 * @since  0.1.0
046 * @author  Copyright (C) 2014, Jeff Epstein ({@code aliteralmind __DASH__ github __AT__ yahoo __DOT__ com}), dual-licensed under the LGPL (version 3.0 or later) or the ASL (version 2.0). See source code for details. <a href="http://codelet.aliteralmind.com">{@code http://codelet.aliteralmind.com}</a>, <a href="https://github.com/aliteralmind/codelet">{@code https://github.com/aliteralmind/codelet}</a>
047 **/
048public class NewJDLinkForWordOccuranceNum  {
049   /**
050      <p>Replaces a single occurance of a constructor name with a JavaDoc link.</p>
051
052    * @param  lineOccurance_num  Which &quot;line&quot; occurance should be linked? This is the <i>n-th line</i> in which the function name is found in the source code. If it exists in three lines (regardless how many occurances exist within those lines), and you want the second to have the link, set this to two. When there are multiple occurances of a constructor call in a line, the first is always the one linked. Must be one or greater.
053    * @return  <code>{@link com.github.xbn.linefilter.AdaptRegexReplacerTo AdaptRegexReplacerTo}.{@link com.github.xbn.linefilter.AdaptRegexReplacerTo#lineReplacer(AlterationRequired, RegexReplacer, ValidResultFilter) lineReplacer}({@link com.github.xbn.analyze.alter.AlterationRequired}.{@link com.github.xbn.analyze.alter.AlterationRequired#YES YES}, rr, filterAllBut)</code>
054      <br/>Where<ul>
055         <li>{@code rr} is a
056         <br/> &nbsp; &nbsp; <code>{@link NewJavaDocLinkReplacerFor NewJavaDocLinkReplacerFor}.{@link NewJavaDocLinkReplacerFor#constructor(CodeletInstance, Constructor, Appendable) constructor}(instance, target, dbgRplcr_ifNonNull)</code></li>
057         <li>{@code target} is
058         <br/> &nbsp; &nbsp; <code>{@link com.github.aliteralmind.codelet.simplesig.ConstructorParamSearchTerm}.
059         <br/> &nbsp; &nbsp; {@link com.github.aliteralmind.codelet.simplesig.ConstructorParamSearchTerm#getConstructorFromAllSigsAndSearchTerm(AllSimpleParamSignatures, String, Appendable, Appendable) getConstructorFromAllSigsAndSearchTerm}(
060         <br/> &nbsp; &nbsp;  &nbsp; &nbsp; {@link #getAllParamSigsForLinkTarget(Class) getAllParamSigsForLinkTarget}(target_class),
061         <br/> &nbsp; &nbsp;  &nbsp; &nbsp; param_shortcut, dbgSearchTerm_ifNonNull, dbgSearchTermDoesMatch_ifNonNull)</code></li>
062         <li>{@code filterAllBut} is a &quot;{@linkplain com.github.xbn.analyze.validate.ValidResultFilter result filter}&quot; that only accepts a {@linkplain com.github.xbn.analyze.validate.NewValidResultFilterFor#exactly(int, String, Appendable) single occurance}.</li>
063      </ul>
064    */
065   public static final TextLineAlterAdapter<StringReplacer> constructor(CodeletInstance instance, int lineOccurance_num, Class<?> target_class, String param_shortcut, Appendable dbgRplcr_ifNonNull, Appendable dbgResultFilter_ifNonNull, Appendable dbgSearchTerm_ifNonNull, Appendable dbgSearchTermDoesMatch_ifNonNull)  {
066      Constructor<?> target = ConstructorParamSearchTerm.
067         getConstructorFromAllSigsAndSearchTerm(
068            getAllParamSigsForLinkTarget(target_class),
069            param_shortcut, dbgSearchTerm_ifNonNull, dbgSearchTermDoesMatch_ifNonNull);
070      RegexReplacer rr = NewJavaDocLinkReplacerFor.constructor(instance, target, dbgRplcr_ifNonNull);
071      return  newReplacerAlterer(rr, lineOccurance_num, "lineOccurance_num", dbgResultFilter_ifNonNull, target_class, param_shortcut);
072   }
073   /**
074      <p>Create a constructor link replacer with named debuggers.</p>
075
076      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #constructor(CodeletInstance, int, Class, String, Appendable, Appendable, Appendable, Appendable) constructor} parameters:<ul>
077         <li><code><i>[debug_prefix]</i>.link.<i>[dbgPreCnstrNm_ifNonNull]</i></code>: {@code dbgRplcr_ifNonNull}<ul>
078            <li>{@code .validfilter}: {@code dbgResultFilter_ifNonNull}</li>
079            <li>{@code .searchterm}: {@code dbgSearchTerm_ifNonNull}<ul>
080               <li>{@code .doesMatch}: {@code dbgSearchTermDoesMatch_ifNonNull}</LI
081            </ul></li>
082         </ul></li>
083      </ul>Both of which must be added to the named-debug-level configuration file:</p>
084
085<blockquote><pre>PREFIX.link.DBGPRECNSTRNM_IFNONNULL.=-1
086PREFIX.link.DBGPRECNSTRNM_IFNONNULL.validfilter=-1
087PREFIX.link.DBGPRECNSTRNM_IFNONNULL.searchterm=-1
088PREFIX.link.DBGPRECNSTRNM_IFNONNULL.searchterm.doesMatch=-1</pre></blockquote>
089
090    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
091    * @param  debug_prefix  Prepended to all named debuggers. May not be {@code null} or empty.
092    * @param  dbgPreCnstrNm_ifNonNull  If non-{@code null}, this is the name of the class used in the debug-level name. If {@code null}, {@code "constructor"} is used.
093    */
094   public static final TextLineAlterAdapter<StringReplacer> constructor(CodeletInstance instance, String debug_prefix, String dbgPreCnstrNm_ifNonNull, int lineOccurance_num, Class<?> target_class, String param_shortcut)  {
095      CrashIfString.nullEmpty(debug_prefix, "debug_prefix", null);
096      debug_prefix += ".link." + ((dbgPreCnstrNm_ifNonNull != null)
097         ?  dbgPreCnstrNm_ifNonNull : "constructor");
098      Appendable dbgLinkRplcr = getDebugApblIfOn(instance,
099         debug_prefix);
100      Appendable dbgLinkValidFilter = getDebugApblIfOn(instance,
101         debug_prefix + ".validfilter");
102      Appendable dbgLinkSearchTerm = getDebugApblIfOn(instance,
103         debug_prefix + ".searchterm");
104      Appendable dbgLinkSearchTermDM = getDebugApblIfOn(instance,
105         debug_prefix + ".searchterm.doesmatch");
106
107      return  constructor(instance, lineOccurance_num,
108         target_class, param_shortcut,
109            dbgLinkRplcr,
110            dbgLinkValidFilter,
111            dbgLinkSearchTerm,
112            dbgLinkSearchTermDM);
113   }
114      private static final TextLineAlterAdapter<StringReplacer> newReplacerAlterer(RegexReplacer replacer, int line_occuranceNum, String occurNum_varName, Appendable dbgResultFilter_ifNonNull, Class<?> target_class, String shortcut)  {
115         try  {
116            return  AdaptRegexReplacerTo.lineReplacer(AlterationRequired.YES,
117               replacer, NewValidResultFilterFor.exactly(
118                  line_occuranceNum, occurNum_varName, dbgResultFilter_ifNonNull));
119         }  catch(RuntimeException rx)  {
120            throw  new RuntimeException("Attempting to create JavaDoc link replacer for target_class=" + target_class.getName() + ", shortcut/field-name=" + shortcut, rx);
121         }
122      }
123   /**
124      <p>Replaces a single occurance of a function name with a JavaDoc link.</p>
125
126    * @param  line_occuranceNum  Which occurance should be linked? This is the <i>n-th <b>line</b></i> in which the function name is found in the source code. If it exists in three lines (regardless how many occurances exist within those lines), and you want the second to have the link, set this to two. When there are multiple occurances of a function call in that line, the first is always the one linked. Must be one or greater.
127    * @return  <code>{@link com.github.xbn.linefilter.AdaptRegexReplacerTo AdaptRegexReplacerTo}.{@link com.github.xbn.linefilter.AdaptRegexReplacerTo#lineReplacer(AlterationRequired, RegexReplacer, ValidResultFilter) lineReplacer}({@link com.github.xbn.analyze.alter.AlterationRequired}.{@link com.github.xbn.analyze.alter.AlterationRequired#YES YES}, rr, filterAllBut)</code>
128      <br/>Where<ul>
129         <li>{@code rr} is a
130         <br/> &nbsp; &nbsp; <code>{@link NewJavaDocLinkReplacerFor NewJavaDocLinkReplacerFor}.{@link NewJavaDocLinkReplacerFor#method(CodeletInstance, Method, Appendable) method}(instance, target, dbgRplcr_ifNonNull)</code></li>
131         <li>{@code target} is
132         <br/> &nbsp; &nbsp; <code>{@link com.github.aliteralmind.codelet.simplesig.MethodSigSearchTerm}.
133         <br/> &nbsp; &nbsp; {@link com.github.aliteralmind.codelet.simplesig.MethodSigSearchTerm#getMethodFromAllSigsAndSearchTerm(AllSimpleParamSignatures, String, Appendable, Appendable) getConstructorFromAllSigsAndSearchTerm}(
134         <br/> &nbsp; &nbsp;  &nbsp; &nbsp; {@link #getAllParamSigsForLinkTarget(Class) getAllParamSigsForLinkTarget}(target_class),
135         <br/> &nbsp; &nbsp;  &nbsp; &nbsp; name_paramShortcut, dbgSearchTerm_ifNonNull, dbgSearchTermDoesMatch_ifNonNull)</code></li>
136         <li>{@code filterAllBut} is a &quot;{@linkplain com.github.xbn.analyze.validate.ValidResultFilter result filter}&quot; that only accepts a {@linkplain com.github.xbn.analyze.validate.NewValidResultFilterFor#exactly(int, String, Appendable) single occurance}.</li>
137      </ul>
138    */
139   public static final TextLineAlterAdapter<StringReplacer> method(CodeletInstance instance, int line_occuranceNum, Class<?> target_class, String name_paramShortcut, Appendable dbgRplcr_ifNonNull, Appendable dbgResultFilter_ifNonNull, Appendable dbgSearchTerm_ifNonNull, Appendable dbgSearchTermDoesMatch_ifNonNull)  {
140      Method target = MethodSigSearchTerm.getMethodFromAllSigsAndSearchTerm(
141         getAllParamSigsForLinkTarget(target_class), name_paramShortcut, dbgSearchTerm_ifNonNull, dbgSearchTermDoesMatch_ifNonNull);
142      return  method(instance, line_occuranceNum, target, dbgRplcr_ifNonNull, dbgResultFilter_ifNonNull);
143   }
144      private static final TextLineAlterAdapter<StringReplacer> method(CodeletInstance instance, int line_occuranceNum, Method target, Appendable dbgRplcr_ifNonNull, Appendable dbgResultFilter_ifNonNull)  {
145         RegexReplacer rr = NewJavaDocLinkReplacerFor.method(instance, target, dbgRplcr_ifNonNull);
146         return  newReplacerAlterer(rr, line_occuranceNum, "line_occuranceNum", dbgResultFilter_ifNonNull, target.getDeclaringClass(), target.getName());
147      }
148   /**
149      <p>Create a function link replacer with named debuggers.</p>
150
151      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #method(CodeletInstance, int, Class, String, Appendable, Appendable, Appendable, Appendable) method} parameters:<ul>
152         <li><code><i>[debug_prefix]</i>.link.<i>[dbgPreMethodNm_ifNonNull]</i></code>: {@code dbgRplcr_ifNonNull}<ul>
153            <li>{@code .validfilter}: {@code dbgResultFilter_ifNonNull}</li>
154            <li>{@code .searchterm}: {@code dbgSearchTerm_ifNonNull}<ul>
155               <li>{@code .doesMatch}: {@code dbgSearchTermDoesMatch_ifNonNull}</LI
156            </ul></li>
157         </ul></li>
158      </ul>Both of which must be added to the named-debug-level configuration file:</p>
159
160<blockquote><pre>PREFIX.link.DBGPREMETHODNM_IFNONNULL.=-1
161PREFIX.link.DBGPREMETHODNM_IFNONNULL.validfilter=-1
162PREFIX.link.DBGPREMETHODNM_IFNONNULL.searchterm=-1
163PREFIX.link.DBGPREMETHODNM_IFNONNULL.searchterm.doesMatch=-1</pre></blockquote>
164
165    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
166    * @param  debug_prefix  Prepended to all named debuggers. May not be {@code null} or empty.
167    * @param  dbgPreMethodNm_ifNonNull  If non-{@code null}, this is the name of the method (with potentially a class-dot prefix) used in the debug-level name. If {@code null}, the method's name is used.
168    */
169   public static final TextLineAlterAdapter<StringReplacer> method(CodeletInstance instance, String debug_prefix, String dbgPreMethodNm_ifNonNull, int line_occuranceNum, Class<?> target_class, String name_paramShortcut)  {
170      CrashIfString.nullEmpty(debug_prefix, "debug_prefix", null);
171      debug_prefix += ".link.";
172
173      MethodSigSearchTerm searchTerm = new MethodSigSearchTerm(name_paramShortcut, null, null);
174
175      if(dbgPreMethodNm_ifNonNull == null)  {
176         debug_prefix += searchTerm.getMethodName();
177      }
178
179      Appendable dbgLinkSearchTerm = getDebugApblIfOn(instance,
180         debug_prefix + ".searchterm");
181      Appendable dbgLinkSearchTermDM = getDebugApblIfOn(instance,
182         debug_prefix + ".searchterm.doesmatch");
183
184      searchTerm.setDebug(dbgLinkSearchTerm, dbgLinkSearchTermDM);
185
186      Method target = searchTerm.getOnlyMatch(
187            getAllParamSigsForLinkTarget(target_class)).
188         getMethod();
189
190      Appendable dbgLinkRplcr = getDebugApblIfOn(instance,
191         debug_prefix);
192      Appendable dbgLinkValidFilter = getDebugApblIfOn(instance,
193         debug_prefix + ".validfilter");
194
195      return  method(instance, line_occuranceNum, target,
196         dbgLinkRplcr,
197         dbgLinkValidFilter);
198   }
199   /**
200      <p>Replaces a single occurance of a field name (an object contained in another object) with a JavaDoc link.</p>
201
202    * @param  line_occuranceNum  Which occurance should be linked?  This is the <i>n-th <b>line</b></i> in which the obect name is found in the source code. If it exists in three lines (regardless how many occurances exist within those lines), and you want the second to have the link, set this to two. When there are multiple occurances of a field name in a line, the first is always the one linked. Must be one or greater.
203    * @return  <code>{@link com.github.xbn.linefilter.AdaptRegexReplacerTo AdaptRegexReplacerTo}.{@link com.github.xbn.linefilter.AdaptRegexReplacerTo#lineReplacer(AlterationRequired, RegexReplacer, ValidResultFilter) lineReplacer}({@link com.github.xbn.analyze.alter.AlterationRequired}.{@link com.github.xbn.analyze.alter.AlterationRequired#YES YES}, rr, filterAllBut)</code>
204      <br/>Where {@code rr} is a
205      <br/> &nbsp; &nbsp; <code>{@link NewJavaDocLinkReplacerFor NewJavaDocLinkReplacerFor}.{@link NewJavaDocLinkReplacerFor#field(CodeletInstance, Field, Appendable) field}(instance, target, dbgRplcr_ifNonNull)</code>
206      <br/>and {@code filterAllBut} is a &quot;{@linkplain com.github.xbn.analyze.validate.ValidResultFilter result filter}&quot; that only accepts a {@linkplain com.github.xbn.analyze.validate.NewValidResultFilterFor#exactly(int, String, Appendable) single occurance}.
207    */
208   public static final TextLineAlterAdapter<StringReplacer> field(CodeletInstance instance, int line_occuranceNum, Class<?> containing_class, String field_name, Appendable dbgRplcr_ifNonNull, Appendable dbgResultFilter_ifNonNull)  {
209      Field target = ReflectRtxUtil.getField(containing_class, field_name, Declared.YES, null);
210      return  field(instance, line_occuranceNum, target, dbgRplcr_ifNonNull, dbgResultFilter_ifNonNull);
211   }
212   public static final TextLineAlterAdapter<StringReplacer> field(CodeletInstance instance, int line_occuranceNum, Field target, Appendable dbgRplcr_ifNonNull, Appendable dbgResultFilter_ifNonNull)  {
213      RegexReplacer rr = NewJavaDocLinkReplacerFor.field(instance, target,
214         dbgRplcr_ifNonNull);
215      return  newReplacerAlterer(rr, line_occuranceNum, "line_occuranceNum",
216         dbgResultFilter_ifNonNull, target.getDeclaringClass(),
217         target.getName());
218   }
219   /**
220      <p>Create a field link replacer with named debuggers.</p>
221
222      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #field(CodeletInstance, int, Class, String, Appendable, Appendable) field} parameters:<ul>
223         <li><code><i>[debug_prefix]</i>.link.<i>[dbgPreFieldNm_ifNonNull]</i></code>: {@code dbgRplcr_ifNonNull}<ul>
224            <li>{@code .validfilter}: {@code dbgResultFilter_ifNonNull}</li>
225         </ul></li>
226      </ul>Both of which must be added to the named-debug-level configuration file:</p>
227
228<blockquote><pre>PREFIX.link.DBGPREFIELDNM_IFNONNULL.=-1
229PREFIX.link.DBGPREFIELDNM_IFNONNULL.validfilter=-1</pre></blockquote>
230
231    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
232    * @param  debug_prefix  Prepended to all named debuggers. May not be {@code null} or empty.
233    * @param  dbgPreFieldNm_ifNonNull  If non-{@code null}, this is the name of the field (with potentially a class-dot prefix) used in the debug-level name. If {@code null}, the field's name is used.
234    */
235   public static final TextLineAlterAdapter<StringReplacer> field(CodeletInstance instance, String debug_prefix, String dbgPreFieldNm_ifNonNull, int line_occuranceNum, Class<?> containing_class, String field_name)  {
236      CrashIfString.nullEmpty(debug_prefix, "debug_prefix", null);
237      debug_prefix += ".link.";
238
239      Field target = ReflectRtxUtil.getField(containing_class, field_name, Declared.YES, null);
240
241      if(dbgPreFieldNm_ifNonNull == null)  {
242         debug_prefix += target.getName();
243      }
244
245      Appendable dbgLinkRplcr = getDebugApblIfOn(instance,
246         debug_prefix);
247      Appendable dbgLinkValidFilter = getDebugApblIfOn(instance,
248         debug_prefix + ".validfilter");
249
250      return  field(instance, line_occuranceNum, target,
251         dbgLinkRplcr,
252         dbgLinkValidFilter);
253   }
254   /**
255      <p>Replaces a single occurance of a class name with a JavaDoc link.</p>
256
257    * @param  line_occuranceNum  Which occurance should be linked?  This is the <i>n-th <b>line</b></i> in which the class name is found in the source code. If it exists in three lines (regardless how many occurances exist within those lines), and you want the second to have the link, set this to two. When there are multiple occurances of a class name in a line, the first is always the one linked. Must be one or greater.
258    * @return  <code>{@link com.github.xbn.linefilter.AdaptRegexReplacerTo AdaptRegexReplacerTo}.{@link com.github.xbn.linefilter.AdaptRegexReplacerTo#lineReplacer(AlterationRequired, RegexReplacer, ValidResultFilter) lineReplacer}({@link com.github.xbn.analyze.alter.AlterationRequired}.{@link com.github.xbn.analyze.alter.AlterationRequired#YES YES}, rr, filterAllBut)</code>
259      <br/>Where {@code rr} is a
260      <br/> &nbsp; &nbsp; <code>{@link NewJavaDocLinkReplacerFor}.{@link NewJavaDocLinkReplacerFor#cclass(CodeletInstance, Class, Appendable) cclass}(urlToExampleClassPkgWSlash_fromTagletFile, class_name, dbgRplcr_ifNonNull)</code>
261      <br/>and {@code filterAllBut} is a &quot;{@linkplain com.github.xbn.analyze.validate.ValidResultFilter result filter}&quot; that only accepts a {@linkplain com.github.xbn.analyze.validate.NewValidResultFilterFor#exactly(int, String, Appendable) single occurance}.
262    */
263   public static final TextLineAlterAdapter<StringReplacer> cclass(CodeletInstance instance, int line_occuranceNum, Class<?> target, Appendable dbgRplcr_ifNonNull, Appendable dbgResultFilter_ifNonNull)  {
264      RegexReplacer rr = NewJavaDocLinkReplacerFor.cclass(instance, target, dbgRplcr_ifNonNull);
265      return  newReplacerAlterer(rr, line_occuranceNum, "line_occuranceNum", dbgResultFilter_ifNonNull, target, null);
266   }
267   /**
268      <p>Create a class link replacer with named debuggers.</p>
269
270      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #cclass(CodeletInstance, int, Class, Appendable, Appendable) cclass} parameters:<ul>
271         <li><code><i>[debug_prefix]</i>.link.<i>[dbgPreClassNm_ifNonNull]</i></code>: {@code dbgRplcr_ifNonNull}<ul>
272            <li>{@code .validfilter}: {@code dbgResultFilter_ifNonNull}</li>
273         </ul></li>
274      </ul>Both of which must be added to the named-debug-level configuration file:</p>
275
276<blockquote><pre>PREFIX.link.DBGPRECLASSNM_IFNONNULL.=-1
277PREFIX.link.DBGPRECLASSNM_IFNONNULL.validfilter=-1</pre></blockquote>
278
279    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
280    * @param  debug_prefix  Prepended to all named debuggers. May not be {@code null} or empty.
281    * @param  dbgPreClassNm_ifNonNull  If non-{@code null}, this is the name of the class used in the debug-level name. If {@code null}, <code>target.{@link java.lang.Class#getSimpleName() getSimpleName}()</code> is used.
282    */
283   public static final TextLineAlterAdapter<StringReplacer> cclass(CodeletInstance instance, String debug_prefix, String dbgPreClassNm_ifNonNull, int line_occuranceNum, Class<?> target)  {
284      CrashIfString.nullEmpty(debug_prefix, "debug_prefix", null);
285      debug_prefix += ".link.";
286      try  {
287         debug_prefix += ((dbgPreClassNm_ifNonNull != null) ? dbgPreClassNm_ifNonNull
288            :  target.getSimpleName());
289      }  catch(RuntimeException rx)  {
290         throw  CrashIfObject.nullOrReturnCause(dbgPreClassNm_ifNonNull, "dbgPreClassNm_ifNonNull", null, rx);
291      }
292      Appendable dbgLinkRplcr = getDebugApblIfOn(instance,
293         debug_prefix);
294      Appendable dbgLinkValidFilter = getDebugApblIfOn(instance,
295         debug_prefix + ".validfilter");
296
297      return  cclass(instance, line_occuranceNum, target,
298         dbgLinkRplcr,
299         dbgLinkValidFilter);
300   }
301      private static final ValidResultFilter exactly(int line_occuranceNum, Appendable dbgResultFilter_ifNonNull)  {
302         return  NewValidResultFilterFor.
303            exactly(line_occuranceNum, "line_occuranceNum", dbgResultFilter_ifNonNull);
304      }
305   /**
306      <p>Get the object that translates function and constructor shortcut signatures to the method or constructor object they represent. These objects are only created once.</p>
307
308      <p>The map holding these class objects is given an initial capacity as in the configuration variable &quot;{@link com.github.aliteralmind.codelet.CodeletBaseConfig#UNIQUE_JD_CLASS_TARGET_INIT_CAPACITY unique_jd_class_target_init_capacity}&quot;.</p>
309
310    * @param  target  May not be {@code null}.
311    */
312   public static final AllSimpleParamSignatures getAllParamSigsForLinkTarget(Class<?> target)  {
313      if(!classAllSigsMap.containsKey(target))  {
314         synchronized(classAllSigsMap)  {
315            if(!classAllSigsMap.containsKey(target))  {
316               try  {
317                  classAllSigsMap.put(target, new AllSimpleParamSignatures(target, Declared.YES));
318               }  catch(RuntimeException rx)  {
319                  throw  CrashIfObject.nullOrReturnCause(target, "target", null, rx);
320               }
321            }
322         }
323      }
324      return  classAllSigsMap.get(target);
325   }
326   private static Map<Class<?>,AllSimpleParamSignatures> classAllSigsMap = new HashMap<Class<?>,AllSimpleParamSignatures>(getTargetClassMapInitCapacity());
327   private NewJDLinkForWordOccuranceNum()  {
328      throw  new IllegalStateException("Do not instantiate");
329   }
330}