[Major] moved StringMatchMode to ch.eitchnet.utils

This commit is contained in:
Robert von Burg 2014-08-25 22:52:18 +02:00
parent c2fc8474f6
commit e9fc3d7ac8
7 changed files with 25 additions and 91 deletions

View File

@ -15,7 +15,7 @@
*/ */
package li.strolch.model.audit; package li.strolch.model.audit;
import li.strolch.model.query.StringMatchMode; import ch.eitchnet.utils.StringMatchMode;
import li.strolch.model.query.StringSelection; import li.strolch.model.query.StringSelection;
/** /**

View File

@ -15,7 +15,7 @@
*/ */
package li.strolch.model.audit; package li.strolch.model.audit;
import li.strolch.model.query.StringMatchMode; import ch.eitchnet.utils.StringMatchMode;
import li.strolch.model.query.StringSelection; import li.strolch.model.query.StringSelection;
/** /**

View File

@ -15,7 +15,7 @@
*/ */
package li.strolch.model.audit; package li.strolch.model.audit;
import li.strolch.model.query.StringMatchMode; import ch.eitchnet.utils.StringMatchMode;
import li.strolch.model.query.StringSelection; import li.strolch.model.query.StringSelection;
/** /**

View File

@ -15,20 +15,23 @@
*/ */
package li.strolch.model.query; package li.strolch.model.query;
import ch.eitchnet.utils.StringMatchMode;
/** /**
* @author Robert von Burg <eitch@eitchnet.ch> * @author Robert von Burg <eitch@eitchnet.ch>
*/ */
public class NameSelection extends StrolchElementSelection { public class NameSelection extends StrolchElementSelection {
private StringMatchMode matchMode;
private String name; private String name;
private boolean contains;
private boolean caseInsensitive;
/** /**
* @param name * @param name
* @param matchMode
*/ */
public NameSelection(String name) { public NameSelection(String name, StringMatchMode matchMode) {
this.name = name; this.name = name;
this.matchMode = matchMode;
} }
/** /**
@ -38,22 +41,11 @@ public class NameSelection extends StrolchElementSelection {
return this.name; return this.name;
} }
public boolean isContains() { /**
return this.contains; * @return the matchMode
} */
public StringMatchMode getMatchMode() {
public boolean isCaseInsensitive() { return this.matchMode;
return this.caseInsensitive;
}
public NameSelection contains(boolean contains) {
this.contains = contains;
return this;
}
public NameSelection caseInsensitive(boolean caseInsensitive) {
this.caseInsensitive = true;
return this;
} }
@Override @Override

View File

@ -18,6 +18,7 @@ package li.strolch.model.query;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import ch.eitchnet.utils.StringMatchMode;
import ch.eitchnet.utils.dbc.DBC; import ch.eitchnet.utils.dbc.DBC;
/** /**
@ -71,8 +72,9 @@ public abstract class ParameterSelection implements Selection {
public abstract void accept(ParameterSelectionVisitor visitor); public abstract void accept(ParameterSelectionVisitor visitor);
public static StringParameterSelection stringSelection(String bagKey, String paramKey, String value) { public static StringParameterSelection stringSelection(String bagKey, String paramKey, String value,
return new StringParameterSelection(bagKey, paramKey, value); StringMatchMode matchMode) {
return new StringParameterSelection(bagKey, paramKey, value, matchMode);
} }
public static IntegerParameterSelection integerSelection(String bagKey, String paramKey, int value) { public static IntegerParameterSelection integerSelection(String bagKey, String paramKey, int value) {
@ -105,35 +107,21 @@ public abstract class ParameterSelection implements Selection {
public static class StringParameterSelection extends ParameterSelection { public static class StringParameterSelection extends ParameterSelection {
private StringMatchMode matchMode;
private String value; private String value;
private boolean contains;
private boolean caseInsensitive;
public StringParameterSelection(String bagKey, String paramKey, String value) { public StringParameterSelection(String bagKey, String paramKey, String value, StringMatchMode matchMode) {
super(bagKey, paramKey); super(bagKey, paramKey);
this.value = value; this.value = value;
this.matchMode = matchMode;
} }
public String getValue() { public String getValue() {
return this.value; return this.value;
} }
public boolean isContains() { public StringMatchMode getMatchMode() {
return this.contains; return this.matchMode;
}
public boolean isCaseInsensitive() {
return this.caseInsensitive;
}
public StringParameterSelection contains(boolean contains) {
this.contains = contains;
return this;
}
public StringParameterSelection caseInsensitive(boolean caseInsensitive) {
this.caseInsensitive = true;
return this;
} }
@Override @Override

View File

@ -1,48 +0,0 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* 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 li.strolch.model.query;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public enum StringMatchMode {
EQUALS_CASE_SENSITIVE(true, true),
EQUALS_CASE_INSENSITIVE(true, false),
CONTAINS_CASE_SENSITIVE(false, true),
CONTAINS_CASE_INSENSITIVE(false, false);
private final boolean equals;
private final boolean caseSensitve;
private StringMatchMode(boolean equals, boolean caseSensitive) {
this.equals = equals;
this.caseSensitve = caseSensitive;
}
/**
* @return the caseSensitve
*/
public boolean isCaseSensitve() {
return this.caseSensitve;
}
/**
* @return the equals
*/
public boolean isEquals() {
return this.equals;
}
}

View File

@ -15,6 +15,8 @@
*/ */
package li.strolch.model.query; package li.strolch.model.query;
import ch.eitchnet.utils.StringMatchMode;
/** /**
* @author Robert von Burg <eitch@eitchnet.ch> * @author Robert von Burg <eitch@eitchnet.ch>
*/ */