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.examples.simplesig; 016 import com.github.aliteralmind.codelet.simplesig.AllSimpleParamSignatures; 017 import com.github.aliteralmind.codelet.simplesig.ConstructorParamSearchTerm; 018 import com.github.aliteralmind.codelet.simplesig.ConstructorSimpleParamSig; 019 import com.github.aliteralmind.codelet.simplesig.CrashIfMoreThanOne; 020 import com.github.aliteralmind.codelet.simplesig.CrashIfZero; 021 import com.github.xbn.lang.reflect.Declared; 022 import java.util.List; 023/** 024 <p>Demonstration of {@link com.github.aliteralmind.codelet.simplesig.ConstructorParamSearchTerm}.</p> 025 026 <p>{@code java com.github.aliteralmind.codelet.examples.simplesig.ConstructorParamSearchTermXmpl}</p> 027 028 * @since 0.1.0 029 * @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> 030 **/ 031 032public class ConstructorParamSearchTermXmpl { 033 public static final String LINE_SEP = System.getProperty("line.separator", "\r\n"); 034 public static final void main(String[] ignored) { 035 036 AllSimpleParamSignatures allInClass = new AllSimpleParamSignatures( 037 ConstructorParamSearchTermXmpl.class, Declared.NO); 038 039 test(allInClass, "()"); 040 test(allInClass, "(*)"); 041 test(allInClass, "(boolean)"); 042 } 043 private static void test(AllSimpleParamSignatures all_inClass, String param_searchTerm) { 044 ConstructorParamSearchTerm searchTerm = new ConstructorParamSearchTerm(param_searchTerm, null, null); 045 046 System.out.println("Searching for: \"" + param_searchTerm + "\""); 047 048 if(searchTerm.doesMatchAny(all_inClass.getConstructorList())) { 049 050 ConstructorSimpleParamSig first = searchTerm.getFirstMatch( 051 all_inClass.getConstructorList(), CrashIfZero.NO, CrashIfMoreThanOne.NO); 052 053 List<ConstructorSimpleParamSig> allMatches = searchTerm.getAllMatches( 054 all_inClass.getConstructorList(), CrashIfZero.NO); 055 056 System.out.println(" - First match: " + first); 057 System.out.println(" - All matches:" + LINE_SEP + 058 AllSimpleParamSignatures.toStringForAllListsInList(" - ", allMatches, LINE_SEP)); 059 060 } else { 061 System.out.println(" Not found."); 062 } 063 064 System.out.println(); 065 } 066 public ConstructorParamSearchTermXmpl(int i) { 067 } 068 public ConstructorParamSearchTermXmpl(boolean b) { 069 } 070}