public class ConstructorParamSearchTerm extends SimpleParamSigSearchTerm
For matching one or more ConstructorSimpleParamSig.
ConstructorParamSearchTerm: Example import com.github.aliteralmind.codelet.simplesig.AllSimpleParamSignatures;
import com.github.aliteralmind.codelet.simplesig.ConstructorParamSearchTerm;
import com.github.aliteralmind.codelet.simplesig.ConstructorSimpleParamSig;
import com.github.aliteralmind.codelet.simplesig.CrashIfMoreThanOne;
import com.github.aliteralmind.codelet.simplesig.CrashIfZero;
import com.github.xbn.lang.reflect.Declared;
import java.util.List;
public class ConstructorParamSearchTermXmpl {
public static final String LINE_SEP = System.getProperty("line.separator", "\r\n");
public static final void main(String[] ignored) {
AllSimpleParamSignatures allInClass = new AllSimpleParamSignatures(
ConstructorParamSearchTermXmpl.class, Declared.NO);
test(allInClass, "()");
test(allInClass, "(*)");
test(allInClass, "(boolean)");
}
private static void test(AllSimpleParamSignatures all_inClass, String param_searchTerm) {
ConstructorParamSearchTerm searchTerm = new ConstructorParamSearchTerm(param_searchTerm, null, null);
System.out.println("Searching for: \"" + param_searchTerm + "\"");
if(searchTerm.doesMatchAny(all_inClass.getConstructorList())) {
ConstructorSimpleParamSig first = searchTerm.getFirstMatch(
all_inClass.getConstructorList(), CrashIfZero.NO, CrashIfMoreThanOne.NO);
List<ConstructorSimpleParamSig> allMatches = searchTerm.getAllMatches(
all_inClass.getConstructorList(), CrashIfZero.NO);
System.out.println(" - First match: " + first);
System.out.println(" - All matches:" + LINE_SEP +
AllSimpleParamSignatures.toStringForAllListsInList(" - ", allMatches, LINE_SEP));
} else {
System.out.println(" Not found.");
}
System.out.println();
}
public ConstructorParamSearchTermXmpl(int i) {
}
public ConstructorParamSearchTermXmpl(boolean b) {
}
}
Output:
Searching for: "()"
Not found.
Searching for: "(*)"
- First match: (boolean)
- All matches:
- (boolean)
- (int)
Searching for: "(boolean)"
- First match: (boolean)
- All matches:
- (boolean)
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. http://codelet.aliteralmind.com, https://github.com/aliteralmind/codelet| Constructor and Description |
|---|
ConstructorParamSearchTerm(String param_searchTerm,
Appendable debugBasics_ifNonNull,
Appendable dbgDoesMatch_ifNonNull)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
doesMatchAny(List<ConstructorSimpleParamSig> to_searchList)
Does any constructor match?.
|
List<ConstructorSimpleParamSig> |
getAllMatches(List<ConstructorSimpleParamSig> to_searchList,
CrashIfZero crashIf_zero)
Get a new list of all matches.
|
static Constructor<?> |
getConstructorFromAllSigsAndSearchTerm(AllSimpleParamSignatures all_sigs,
String param_searchTerm,
Appendable debugBasics_ifNonNull,
Appendable dbgDoesMatch_ifNonNull)
Get the single matching constructor from an all-signature object.
|
ConstructorSimpleParamSig |
getFirstMatch(List<ConstructorSimpleParamSig> to_searchList,
CrashIfZero crashIf_zero,
CrashIfMoreThanOne crashIf_moreThanOne)
Get the first match.
|
ConstructorSimpleParamSig |
getOnlyMatch(List<ConstructorSimpleParamSig> to_searchList)
Get the first and only match.
|
appendToString, doesMatch, doesMatchAnyProt, doesMatchOnlyOneProt, getAllMatchesProt, getDebugAptrBasics, getDebugAptrDoesMatch, getFirstMatchProt, getMethodName, getNoParams, getOnlyMatchProt, getTermList, getWithParams, hasAStar, indexOfStar, lastIndexOfStar, setDebug, toStringpublic ConstructorParamSearchTerm(String param_searchTerm, Appendable debugBasics_ifNonNull, Appendable dbgDoesMatch_ifNonNull)
Create a new instance.
()
A constructor with exactly zero parameters.
(*)
One or more parameters of any type.
(String, *)
A java.lang.String, followed by one or more parameters of any type.
(String, *, int[])
A java.lang.String and int array, with one or more parameters of any type between.
This first calls
super(param_searchTerm)
param_searchTerm - There may not be any text before the open parenthesis ('(').public boolean doesMatchAny(List<ConstructorSimpleParamSig> to_searchList)
Does any constructor match?.
doesMatchAnyProt(to_searchList)*getFirstMatch(List, CrashIfZero, CrashIfMoreThanOne)public List<ConstructorSimpleParamSig> getAllMatches(List<ConstructorSimpleParamSig> to_searchList, CrashIfZero crashIf_zero)
Get a new list of all matches.
getAllMatchesProt(to_searchList, crashIf_zero)*getFirstMatch(List, CrashIfZero, CrashIfMoreThanOne)public ConstructorSimpleParamSig getOnlyMatch(List<ConstructorSimpleParamSig> to_searchList)
Get the first and only match.
(ConstructorSimpleParamSig)getOnlyMatchProt(to_searchList)doesMatchOnlyOneProt*,
getFirstMatch,
getAllMatchespublic ConstructorSimpleParamSig getFirstMatch(List<ConstructorSimpleParamSig> to_searchList, CrashIfZero crashIf_zero, CrashIfMoreThanOne crashIf_moreThanOne)
Get the first match.
(ConstructorSimpleParamSig)getFirstMatchProt(to_searchList, crashIf_zero, crashIf_moreThanOne)doesMatchAny(List),
getAllMatches(List, CrashIfZero),
getFirstMatch(List, CrashIfZero, CrashIfMoreThanOne)public static final Constructor<?> getConstructorFromAllSigsAndSearchTerm(AllSimpleParamSignatures all_sigs, String param_searchTerm, Appendable debugBasics_ifNonNull, Appendable dbgDoesMatch_ifNonNull)
Get the single matching constructor from an all-signature object.
(new ConstructorParamSearchTerm(param_searchTerm, debugBasics_ifNonNull, dbgDoesMatch_ifNonNull)).
getOnlyMatch(all_sigs.getConstructorList).getConstructor()Copyright 2014, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
https://github.com/aliteralmind/codelet