1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | package Torello.Java.JSON; import Torello.Java.Function.IntIntTConsumer; import java.util.function.Consumer; import java.util.function.Function; class SETTINGS_REC_BUILDER { // ******************************************************************************************** // ******************************************************************************************** // All RJArr Classes producing **STREAM** styled SettingsRec instances // ******************************************************************************************** // ******************************************************************************************** static <T, U> SettingsRec<T, U> createForStreams( // Passed by the user in the initial method invocation final T defaultValue, final int FLAGS, final Function<String, T> userParser, // computed configurations, determined by the requested type final BASIC_TYPES<T> bt, final STREAM_BUILDER<T, U> sb ) { return new SettingsRec<>( // The Basics defaultValue, FLAGS, userParser, bt, // For Streams, a new stream needs to be built each time sb.acceptor, sb.constructNewBuilder, sb.runBuilderDotBuild, // acceptor2: The "IntIntTConsumer" variant of an acceptor null, // Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed) null ); } // ******************************************************************************************** // ******************************************************************************************** // RJArr Classes that produce **CONSUMER** styled SettingsRec instances // ******************************************************************************************** // ******************************************************************************************** // This Static-Builder will accept a Consumer<T>. This one does not allow for accepting the // "Two Integer", JsonArray-Index & Java Object-Count. The Consumer that is provided here // is deisnged to **ONLY** accept the User-Specified Type 'T' (It is a simple Consumer<T>) static <T, U> SettingsRec<T, U> createForConsumers( // Passed by the user in the initial method invocation final T defaultValue, final int FLAGS, final Function<String, T> userParser, final Consumer<T> acceptor, // computed configurations, determined by the requested type final BASIC_TYPES<T> bt ) { return new SettingsRec<>( // The Basics defaultValue, FLAGS, userParser, bt, acceptor, // The User-Provided Consumer (in this constructor) () -> { }, // UNUSED: A NO-OP, final Runnable constructNewBuilder; () -> null, // UNUSED: final Supplier<U> runBuilderDotBuild; // acceptor2: The "IntIntTConsumer" variant of an acceptor null, // Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed) null ); } // This consumer works with the IntIntTConsumer<T> kind of User-Provided Consumer. static <T, U> SettingsRec<T, U> createForIIConsumers( // Passed by the user in the initial method invocation final T defaultValue, final int FLAGS, final Function<String, T> userParser, final IntIntTConsumer<T> acceptor2, // computed configurations, determined by the requested type final BASIC_TYPES<T> bt ) { return new SettingsRec<>( // The Basics defaultValue, FLAGS, userParser, bt, null, // The User-Provided Consumer (in this constructor) () -> { }, // UNUSED: A NO-OP, final Runnable constructNewBuilder; () -> null, // UNUSED: final Supplier<U> runBuilderDotBuild; // acceptor2: The "IntIntTConsumer" variant of an acceptor acceptor2, // Not-Applicable: Only used for building Multi-Dimensional Array's (rarely needed) null ); } // ******************************************************************************************** // ******************************************************************************************** // RJArr Classes that produce **ARRAYS** styled SettingsRec instances // ******************************************************************************************** // ******************************************************************************************** static <T, U> SettingsRec<T, U> createForDimNArrays( // Passed by the user in the initial method invocation final T defaultValue, final int FLAGS, final Function<String, T> userParser, // computed configurations, determined by the requested type final BASIC_TYPES<T> bt, final STREAM_BUILDER<T, U> sb, // Specialized Constructor used by the Multi-Dimensional Array-Builder Class final boolean arrayGen1DRefOrPrimitive ) { return new SettingsRec<>( // The Basics defaultValue, FLAGS, userParser, bt, // For Streams, a new stream needs to be built each time sb.acceptor, sb.constructNewBuilder, sb.runBuilderDotBuild, // acceptor2: The "IntIntTConsumer" variant of an acceptor null, // This constructor is used by the Multi-Dimensional Array Class arrayGen1DRefOrPrimitive ); } } |