com.moengage.operator.StringOperation Maven / Gradle / Ivy
package com.moengage.operator;
import com.moengage.datatype.MOEDataType;
public class StringOperation & MOEDataType> extends BaseOperation {
public StringOperation() {
super();
}
public boolean contains(T filterObject, T conditionObject){
String filterValue = filterObject.cast();
String attributeValue = conditionObject.getValue();
return filterValue.contains(attributeValue);
}
public boolean startsWith(T filterObject, T conditionObject){
String filterValue = filterObject.cast();
String attributeValue = conditionObject.getValue();
return filterValue.startsWith(attributeValue);
}
public boolean endsWith(T filterObject, T conditionObject){
String filterValue = filterObject.cast();
String attributeValue = conditionObject.getValue();
return filterValue.endsWith(attributeValue);
}
public boolean empty(T filterObject){
String filterValue = filterObject.cast();
return filterValue == null || filterValue.trim().isEmpty();
}
}