com.iofairy.pattern.mapping.StringMatcherMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functional Show documentation
Show all versions of functional Show documentation
Functional Programming for Java 8+ and compatible with the modular system of Java 9+.
/*
* Copyright (C) 2021 iofairy,
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.iofairy.pattern.mapping;
import com.iofairy.lambda.*;
import com.iofairy.pattern.PatternIn;
import com.iofairy.pattern.matcher.StringRMatcher;
import com.iofairy.pattern.matcher.StringVMatcher;
import com.iofairy.pattern.type.PatternString;
/**
* String Matcher Mapping
* @since 0.0.1
*/
public class StringMatcherMapping extends PatternMatcherMapping {
private PatternString patternString;
public StringMatcherMapping(String value, PatternString patternString) {
this(value);
this.patternString = patternString;
}
public StringMatcherMapping(String value) {
super(value);
}
public StringVMatcher when(String matchValue, V1 super String> action) {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.when(matchValue, action);
}
public StringVMatcher whenNext(String matchValue, V1 super String> action) {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.whenNext(matchValue, action);
}
public StringRMatcher when(String matchValue, R1 super String, ? extends R> action) {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.when(matchValue, action);
}
public StringRMatcher whenNext(String matchValue, R1 super String, ? extends R> action) {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.whenNext(matchValue, action);
}
public StringVMatcher when(PatternIn matchValues, V1 super String> action) {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.when(matchValues, action);
}
public StringVMatcher whenNext(PatternIn matchValues, V1 super String> action) {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.whenNext(matchValues, action);
}
public StringRMatcher when(PatternIn matchValues, R1 super String, ? extends R> action) {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.when(matchValues, action);
}
public StringRMatcher whenNext(PatternIn matchValues, R1 super String, ? extends R> action) {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.whenNext(matchValues, action);
}
public StringVMatcher when(boolean matchValue, V1 super String> action) {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.when(matchValue, action);
}
public StringVMatcher whenNext(boolean matchValue, V1 super String> action) {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.whenNext(matchValue, action);
}
public StringRMatcher when(boolean matchValue, R1 super String, ? extends R> action) {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.when(matchValue, action);
}
public StringRMatcher whenNext(boolean matchValue, R1 super String, ? extends R> action) {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.whenNext(matchValue, action);
}
/*
* ######################################################
* ******************************************************
* ##### MatcherMapping with throwing exception #####
* ******************************************************
* ######################################################
*/
public StringVMatcher with(String matchValue, VT1 super String, E> action) throws E {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.with(matchValue, action);
}
public StringVMatcher withNext(String matchValue, VT1 super String, E> action) throws E {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.withNext(matchValue, action);
}
public StringRMatcher with(String matchValue, RT1 super String, ? extends R, E> action) throws E {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.with(matchValue, action);
}
public StringRMatcher withNext(String matchValue, RT1 super String, ? extends R, E> action) throws E {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.withNext(matchValue, action);
}
public StringVMatcher with(PatternIn matchValues, VT1 super String, E> action) throws E {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.with(matchValues, action);
}
public StringVMatcher withNext(PatternIn matchValues, VT1 super String, E> action) throws E {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.withNext(matchValues, action);
}
public StringRMatcher with(PatternIn matchValues, RT1 super String, ? extends R, E> action) throws E {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.with(matchValues, action);
}
public StringRMatcher withNext(PatternIn matchValues, RT1 super String, ? extends R, E> action) throws E {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.withNext(matchValues, action);
}
public StringVMatcher with(boolean matchValue, VT1 super String, E> action) throws E {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.with(matchValue, action);
}
public StringVMatcher withNext(boolean matchValue, VT1 super String, E> action) throws E {
StringVMatcher stringVMatcher = new StringVMatcher(value, patternString);
return stringVMatcher.withNext(matchValue, action);
}
public StringRMatcher with(boolean matchValue, RT1 super String, ? extends R, E> action) throws E {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.with(matchValue, action);
}
public StringRMatcher withNext(boolean matchValue, RT1 super String, ? extends R, E> action) throws E {
StringRMatcher stringRMatcher = new StringRMatcher<>(value, patternString);
return stringRMatcher.withNext(matchValue, action);
}
}