From 98a4f046ee5f4eb1418c9431aa0c50f8e48a9a5d Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Sat, 1 Aug 2015 22:21:08 +1200 Subject: [PATCH] No effective change - format only --- .../ebeaninternal/server/el/CharMatch.java | 92 ++-- .../ebeaninternal/server/el/ElComparator.java | 16 +- .../server/el/ElComparatorCompound.java | 60 +-- .../server/el/ElComparatorProperty.java | 72 +-- .../ebeaninternal/server/el/ElFilter.java | 400 +++++++------- .../server/el/ElMatchBuilder.java | 500 +++++++++--------- .../ebeaninternal/server/el/ElMatcher.java | 8 +- .../server/el/ElPropertyChain.java | 452 ++++++++-------- .../server/el/ElPropertyChainBuilder.java | 78 +-- .../server/el/ElPropertyValue.java | 172 +++--- 10 files changed, 923 insertions(+), 927 deletions(-) diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/CharMatch.java b/src/main/java/com/avaje/ebeaninternal/server/el/CharMatch.java index 0fb7a43da..d90a70206 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/CharMatch.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/CharMatch.java @@ -8,52 +8,52 @@ package com.avaje.ebeaninternal.server.el; */ public final class CharMatch { - private final char[] upperChars; - - private final int maxLength; - - public CharMatch(String s) { - this.upperChars = s.toUpperCase().toCharArray(); - this.maxLength = upperChars.length; - } + private final char[] upperChars; - public boolean startsWith(String other) { - - if (other == null || other.length() < maxLength){ - return false; - } - - char ta[] = other.toCharArray(); - - int pos = -1; - while (++pos < maxLength) { - char c1 = upperChars[pos]; - char c2 = Character.toUpperCase(ta[pos]); - if (c1 != c2) { - return false; - } - } - return true; - } - - public boolean endsWith(String other) { - - if (other == null || other.length() < maxLength){ - return false; - } - - char ta[] = other.toCharArray(); - - int offset = ta.length - maxLength; - int pos = maxLength; - while (--pos >= 0) { - char c1 = upperChars[pos]; - char c2 = Character.toUpperCase(ta[offset+pos]); - if (c1 != c2) { - return false; - } - } - return true; - } + private final int maxLength; + + public CharMatch(String s) { + this.upperChars = s.toUpperCase().toCharArray(); + this.maxLength = upperChars.length; + } + + public boolean startsWith(String other) { + + if (other == null || other.length() < maxLength) { + return false; + } + + char ta[] = other.toCharArray(); + + int pos = -1; + while (++pos < maxLength) { + char c1 = upperChars[pos]; + char c2 = Character.toUpperCase(ta[pos]); + if (c1 != c2) { + return false; + } + } + return true; + } + + public boolean endsWith(String other) { + + if (other == null || other.length() < maxLength) { + return false; + } + + char ta[] = other.toCharArray(); + + int offset = ta.length - maxLength; + int pos = maxLength; + while (--pos >= 0) { + char c1 = upperChars[pos]; + char c2 = Character.toUpperCase(ta[offset + pos]); + if (c1 != c2) { + return false; + } + } + return true; + } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElComparator.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElComparator.java index f27779bd8..1bc28365e 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElComparator.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElComparator.java @@ -7,14 +7,14 @@ import java.util.Comparator; */ public interface ElComparator extends Comparator { - /** - * Compare given 2 beans. - */ - int compare(T o1, T o2); + /** + * Compare given 2 beans. + */ + int compare(T o1, T o2); - /** - * Compare with a fixed value to a given bean. - */ - int compareValue(Object value, T o2); + /** + * Compare with a fixed value to a given bean. + */ + int compareValue(Object value, T o2); } \ No newline at end of file diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorCompound.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorCompound.java index 3dbcc1524..663a92043 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorCompound.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorCompound.java @@ -10,39 +10,35 @@ import java.util.Comparator; */ public final class ElComparatorCompound implements Comparator, ElComparator { - private final ElComparator[] array; - - public ElComparatorCompound(ElComparator[] array) { - this.array = array; - } - - public int compare(T o1, T o2) { - - for (int i = 0; i < array.length; i++) { - int ret = array[i].compare(o1, o2); - if (ret != 0){ - return ret; - } - } - - return 0; - } + private final ElComparator[] array; - public int compareValue(Object value, T o2) { - - for (int i = 0; i < array.length; i++) { - int ret = array[i].compareValue(value, o2); - if (ret != 0){ - return ret; - } - } - - return 0; - } + public ElComparatorCompound(ElComparator[] array) { + this.array = array; + } + + public int compare(T o1, T o2) { + + for (int i = 0; i < array.length; i++) { + int ret = array[i].compare(o1, o2); + if (ret != 0) { + return ret; + } + } + + return 0; + } + + public int compareValue(Object value, T o2) { + + for (int i = 0; i < array.length; i++) { + int ret = array[i].compareValue(value, o2); + if (ret != 0) { + return ret; + } + } + + return 0; + } - - - - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorProperty.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorProperty.java index 48edafffb..6348fd5cc 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorProperty.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElComparatorProperty.java @@ -9,45 +9,45 @@ import com.avaje.ebean.bean.EntityBean; */ public final class ElComparatorProperty implements Comparator, ElComparator { - private final ElPropertyValue elGetValue; - - private final int nullOrder; - - private final int asc; - - public ElComparatorProperty(ElPropertyValue elGetValue, boolean ascending, boolean nullsHigh) { - this.elGetValue = elGetValue; - this.asc = ascending ? 1 : -1; - this.nullOrder = asc * (nullsHigh ? 1 : -1); - } + private final ElPropertyValue elGetValue; - public int compare(T o1, T o2) { - - Object val1 = elGetValue.elGetValue((EntityBean)o1); - Object val2 = elGetValue.elGetValue((EntityBean)o2); + private final int nullOrder; - return compareValues(val1, val2); - } + private final int asc; - public int compareValue(Object value, T o2) { - - Object val2 = elGetValue.elGetValue((EntityBean)o2); + public ElComparatorProperty(ElPropertyValue elGetValue, boolean ascending, boolean nullsHigh) { + this.elGetValue = elGetValue; + this.asc = ascending ? 1 : -1; + this.nullOrder = asc * (nullsHigh ? 1 : -1); + } + + public int compare(T o1, T o2) { + + Object val1 = elGetValue.elGetValue((EntityBean) o1); + Object val2 = elGetValue.elGetValue((EntityBean) o2); + + return compareValues(val1, val2); + } + + public int compareValue(Object value, T o2) { + + Object val2 = elGetValue.elGetValue((EntityBean) o2); + + return compareValues(value, val2); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public int compareValues(Object val1, Object val2) { + + if (val1 == null) { + return val2 == null ? 0 : nullOrder; + } + if (val2 == null) { + return -1 * nullOrder; + } + Comparable c = (Comparable) val1; + return asc * c.compareTo(val2); + } - return compareValues(value, val2); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public int compareValues(Object val1, Object val2){ - - if (val1 == null){ - return val2 == null ? 0 : nullOrder; - } - if (val2 == null){ - return -1 * nullOrder; - } - Comparable c = (Comparable)val1; - return asc * c.compareTo(val2); - } - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElFilter.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElFilter.java index 35065862a..d65fe8eb4 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElFilter.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElFilter.java @@ -11,241 +11,241 @@ import com.avaje.ebeaninternal.server.deploy.BeanDescriptor; /** * Default implementation of the Filter interface. */ -public final class ElFilter implements Filter { +public final class ElFilter implements Filter { - private final BeanDescriptor beanDescriptor; - - private final ArrayList> matches = new ArrayList>(); + private final BeanDescriptor beanDescriptor; - private int maxRows; - - private String sortByClause; - - public ElFilter(BeanDescriptor beanDescriptor) { - this.beanDescriptor = beanDescriptor; - } + private final ArrayList> matches = new ArrayList>(); - private Object convertValue(String propertyName, Object value) { - // convert type of value to match expected type - ElPropertyValue elGetValue = beanDescriptor.getElGetValue(propertyName); - return elGetValue.elConvertType(value); - } - - private ElComparator getElComparator(String propertyName) { - - return beanDescriptor.getElComparator(propertyName); - } - - private ElPropertyValue getElGetValue(String propertyName) { - - return beanDescriptor.getElGetValue(propertyName); - } - - public Filter sort(String sortByClause) { - this.sortByClause = sortByClause; - return this; - } - - protected boolean isMatch(T bean) { - for (int i = 0; i < matches.size(); i++) { - ElMatcher matcher = matches.get(i); - if (!matcher.isMatch(bean)){ - return false; - } - } - return true; - } - + private int maxRows; - public Filter in(String propertyName, Set matchingValues) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.InSet(matchingValues, elGetValue)); - return this; - } + private String sortByClause; - public Filter eq(String propertyName, Object value) { - - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); + public ElFilter(BeanDescriptor beanDescriptor) { + this.beanDescriptor = beanDescriptor; + } - matches.add(new ElMatchBuilder.Eq(value, comparator)); - return this; - } - + private Object convertValue(String propertyName, Object value) { + // convert type of value to match expected type + ElPropertyValue elGetValue = beanDescriptor.getElGetValue(propertyName); + return elGetValue.elConvertType(value); + } - public Filter ne(String propertyName, Object value) { + private ElComparator getElComparator(String propertyName) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Ne(value, comparator)); - return this; - } - - public Filter between(String propertyName, Object min, Object max) { + return beanDescriptor.getElComparator(propertyName); + } - ElPropertyValue elGetValue = getElGetValue(propertyName); - min = elGetValue.elConvertType(min); - max = elGetValue.elConvertType(max); - - ElComparator elComparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Between(min, max, elComparator)); - return this; - } + private ElPropertyValue getElGetValue(String propertyName) { + + return beanDescriptor.getElGetValue(propertyName); + } + + public Filter sort(String sortByClause) { + this.sortByClause = sortByClause; + return this; + } + + protected boolean isMatch(T bean) { + for (int i = 0; i < matches.size(); i++) { + ElMatcher matcher = matches.get(i); + if (!matcher.isMatch(bean)) { + return false; + } + } + return true; + } - public Filter gt(String propertyName, Object value) { - - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Gt(value, comparator)); - return this; - } - - public Filter ge(String propertyName, Object value) { - - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Ge(value, comparator)); - return this; - } + public Filter in(String propertyName, Set matchingValues) { - public Filter ieq(String propertyName, String value) { + ElPropertyValue elGetValue = getElGetValue(propertyName); - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.Ieq(elGetValue, value)); - return this; - } + matches.add(new ElMatchBuilder.InSet(matchingValues, elGetValue)); + return this; + } + + public Filter eq(String propertyName, Object value) { + + value = convertValue(propertyName, value); + ElComparator comparator = getElComparator(propertyName); + + matches.add(new ElMatchBuilder.Eq(value, comparator)); + return this; + } - public Filter isNotNull(String propertyName) { + public Filter ne(String propertyName, Object value) { - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.IsNotNull(elGetValue)); - return this; - } + value = convertValue(propertyName, value); + ElComparator comparator = getElComparator(propertyName); + + matches.add(new ElMatchBuilder.Ne(value, comparator)); + return this; + } + + public Filter between(String propertyName, Object min, Object max) { + + ElPropertyValue elGetValue = getElGetValue(propertyName); + min = elGetValue.elConvertType(min); + max = elGetValue.elConvertType(max); + + ElComparator elComparator = getElComparator(propertyName); + + matches.add(new ElMatchBuilder.Between(min, max, elComparator)); + return this; + } - public Filter isNull(String propertyName) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.IsNull(elGetValue)); - return this; - } + public Filter gt(String propertyName, Object value) { - - public Filter le(String propertyName, Object value) { + value = convertValue(propertyName, value); + ElComparator comparator = getElComparator(propertyName); - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Le(value, comparator)); - return this; - } + matches.add(new ElMatchBuilder.Gt(value, comparator)); + return this; + } - - public Filter lt(String propertyName, Object value) { + public Filter ge(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Lt(value, comparator)); - return this; - } + value = convertValue(propertyName, value); + ElComparator comparator = getElComparator(propertyName); - public Filter regex(String propertyName, String regEx) { - return regex(propertyName, regEx, 0); - } + matches.add(new ElMatchBuilder.Ge(value, comparator)); + return this; + } - public Filter regex(String propertyName, String regEx, int options) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.RegularExpr(elGetValue, regEx, options)); - return this; - } + public Filter ieq(String propertyName, String value) { - public Filter contains(String propertyName, String value) { - - String quote = ".*"+Pattern.quote(value)+".*"; - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.RegularExpr(elGetValue, quote, 0)); - return this; - } + ElPropertyValue elGetValue = getElGetValue(propertyName); - public Filter icontains(String propertyName, String value) { - - String quote = ".*"+Pattern.quote(value)+".*"; - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.RegularExpr(elGetValue, quote, Pattern.CASE_INSENSITIVE)); - return this; - } + matches.add(new ElMatchBuilder.Ieq(elGetValue, value)); + return this; + } - - public Filter endsWith(String propertyName, String value) { - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.EndsWith(elGetValue, value)); - return this; - } + public Filter isNotNull(String propertyName) { - public Filter startsWith(String propertyName, String value) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.StartsWith(elGetValue, value)); - return this; - } - - public Filter iendsWith(String propertyName, String value) { + ElPropertyValue elGetValue = getElGetValue(propertyName); - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.IEndsWith(elGetValue, value)); - return this; - } + matches.add(new ElMatchBuilder.IsNotNull(elGetValue)); + return this; + } - public Filter istartsWith(String propertyName, String value) { - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.IStartsWith(elGetValue, value)); - return this; - } + public Filter isNull(String propertyName) { - public Filter maxRows(int maxRows) { - this.maxRows = maxRows; - return this; - } + ElPropertyValue elGetValue = getElGetValue(propertyName); - public List filter(List list) { + matches.add(new ElMatchBuilder.IsNull(elGetValue)); + return this; + } - if (sortByClause != null){ - // create shallow copy and sort - list = new ArrayList(list); - beanDescriptor.sort(list, sortByClause); - } - - ArrayList filterList = new ArrayList(); - for (int i = 0; i < list.size(); i++) { - T t = list.get(i); - if (isMatch(t)) { - filterList.add(t); - if (maxRows > 0 && filterList.size() >= maxRows){ - break; - } - } - } + public Filter le(String propertyName, Object value) { + + value = convertValue(propertyName, value); + ElComparator comparator = getElComparator(propertyName); + + matches.add(new ElMatchBuilder.Le(value, comparator)); + return this; + } + + + public Filter lt(String propertyName, Object value) { + + value = convertValue(propertyName, value); + ElComparator comparator = getElComparator(propertyName); + + matches.add(new ElMatchBuilder.Lt(value, comparator)); + return this; + } + + public Filter regex(String propertyName, String regEx) { + return regex(propertyName, regEx, 0); + } + + public Filter regex(String propertyName, String regEx, int options) { + + ElPropertyValue elGetValue = getElGetValue(propertyName); + + matches.add(new ElMatchBuilder.RegularExpr(elGetValue, regEx, options)); + return this; + } + + public Filter contains(String propertyName, String value) { + + String quote = ".*" + Pattern.quote(value) + ".*"; + + ElPropertyValue elGetValue = getElGetValue(propertyName); + matches.add(new ElMatchBuilder.RegularExpr(elGetValue, quote, 0)); + return this; + } + + public Filter icontains(String propertyName, String value) { + + String quote = ".*" + Pattern.quote(value) + ".*"; + + ElPropertyValue elGetValue = getElGetValue(propertyName); + matches.add(new ElMatchBuilder.RegularExpr(elGetValue, quote, Pattern.CASE_INSENSITIVE)); + return this; + } + + + public Filter endsWith(String propertyName, String value) { + + ElPropertyValue elGetValue = getElGetValue(propertyName); + matches.add(new ElMatchBuilder.EndsWith(elGetValue, value)); + return this; + } + + public Filter startsWith(String propertyName, String value) { + + ElPropertyValue elGetValue = getElGetValue(propertyName); + matches.add(new ElMatchBuilder.StartsWith(elGetValue, value)); + return this; + } + + public Filter iendsWith(String propertyName, String value) { + + ElPropertyValue elGetValue = getElGetValue(propertyName); + matches.add(new ElMatchBuilder.IEndsWith(elGetValue, value)); + return this; + } + + public Filter istartsWith(String propertyName, String value) { + + ElPropertyValue elGetValue = getElGetValue(propertyName); + matches.add(new ElMatchBuilder.IStartsWith(elGetValue, value)); + return this; + } + + public Filter maxRows(int maxRows) { + this.maxRows = maxRows; + return this; + } + + public List filter(List list) { + + if (sortByClause != null) { + // create shallow copy and sort + list = new ArrayList(list); + beanDescriptor.sort(list, sortByClause); + } + + ArrayList filterList = new ArrayList(); + + for (int i = 0; i < list.size(); i++) { + T t = list.get(i); + if (isMatch(t)) { + filterList.add(t); + if (maxRows > 0 && filterList.size() >= maxRows) { + break; + } + } + } + + return filterList; + } - return filterList; - } - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElMatchBuilder.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElMatchBuilder.java index b0b7ffb51..4b0892196 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElMatchBuilder.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElMatchBuilder.java @@ -12,273 +12,273 @@ import com.avaje.ebean.bean.EntityBean; */ class ElMatchBuilder { - /** - * Case insensitive equals. - */ - static class RegularExpr implements ElMatcher { - - final ElPropertyValue elGetValue; - final String value; - final Pattern pattern; - - RegularExpr(ElPropertyValue elGetValue, String value, int options){ - this.elGetValue = elGetValue; - this.value = value; - this.pattern = Pattern.compile(value, options); - } - - public boolean isMatch(T bean) { - String v = (String)elGetValue.elGetValue((EntityBean)bean); - return pattern.matcher(v).matches(); - } - } - - /** - * Case insensitive equals. - */ - static abstract class BaseString implements ElMatcher { - - final ElPropertyValue elGetValue; - final String value; - - public BaseString(ElPropertyValue elGetValue, String value){ - this.elGetValue = elGetValue; - this.value = value; - } - - public abstract boolean isMatch(T bean); - } - - static class Ieq extends BaseString { - Ieq(ElPropertyValue elGetValue, String value) { - super(elGetValue, value); - } + /** + * Case insensitive equals. + */ + static class RegularExpr implements ElMatcher { - public boolean isMatch(T bean) { - String v = (String)elGetValue.elGetValue((EntityBean)bean); - return value.equalsIgnoreCase(v); - } - } + final ElPropertyValue elGetValue; + final String value; + final Pattern pattern; - /** - * Case insensitive starts with matcher. - */ - static class IStartsWith implements ElMatcher { + RegularExpr(ElPropertyValue elGetValue, String value, int options) { + this.elGetValue = elGetValue; + this.value = value; + this.pattern = Pattern.compile(value, options); + } - final ElPropertyValue elGetValue; - final CharMatch charMatch; - - IStartsWith(ElPropertyValue elGetValue, String value) { - this.elGetValue = elGetValue; - this.charMatch = new CharMatch(value); - } - - public boolean isMatch(T bean) { - - String v = (String)elGetValue.elGetValue((EntityBean)bean); - return charMatch.startsWith(v); - } - } + public boolean isMatch(T bean) { + String v = (String) elGetValue.elGetValue((EntityBean) bean); + return pattern.matcher(v).matches(); + } + } - /** - * Case insensitive ends with matcher. - */ - static class IEndsWith implements ElMatcher { + /** + * Case insensitive equals. + */ + static abstract class BaseString implements ElMatcher { - final ElPropertyValue elGetValue; - final CharMatch charMatch; - - IEndsWith(ElPropertyValue elGetValue, String value) { - this.elGetValue = elGetValue; - this.charMatch = new CharMatch(value); - } - - public boolean isMatch(T bean) { - - String v = (String)elGetValue.elGetValue((EntityBean)bean); - return charMatch.endsWith(v); - } - } + final ElPropertyValue elGetValue; + final String value; - static class StartsWith extends BaseString { - StartsWith(ElPropertyValue elGetValue, String value) { - super(elGetValue, value); - } + public BaseString(ElPropertyValue elGetValue, String value) { + this.elGetValue = elGetValue; + this.value = value; + } - public boolean isMatch(T bean) { - String v = (String)elGetValue.elGetValue((EntityBean)bean); - return value.startsWith(v); - } - } - - static class EndsWith extends BaseString { - EndsWith(ElPropertyValue elGetValue, String value) { - super(elGetValue, value); - } + public abstract boolean isMatch(T bean); + } - public boolean isMatch(T bean) { - String v = (String)elGetValue.elGetValue((EntityBean)bean); - return value.endsWith(v); - } - } - - static class IsNull implements ElMatcher { - - final ElPropertyValue elGetValue; - - public IsNull(ElPropertyValue elGetValue){ - this.elGetValue = elGetValue; - } - - public boolean isMatch(T bean) { - return (null == elGetValue.elGetValue((EntityBean)bean)); - } - } + static class Ieq extends BaseString { + Ieq(ElPropertyValue elGetValue, String value) { + super(elGetValue, value); + } - static class IsNotNull implements ElMatcher { - - final ElPropertyValue elGetValue; - - public IsNotNull(ElPropertyValue elGetValue){ - this.elGetValue = elGetValue; - } - - public boolean isMatch(T bean) { - return (null != elGetValue.elGetValue((EntityBean)bean)); - } - } + public boolean isMatch(T bean) { + String v = (String) elGetValue.elGetValue((EntityBean) bean); + return value.equalsIgnoreCase(v); + } + } - static abstract class Base implements ElMatcher { - - final Object filterValue; - - final ElComparator comparator; - - public Base(Object filterValue, ElComparator comparator){ - this.filterValue = filterValue; - this.comparator = comparator; - } - - public abstract boolean isMatch(T value); - } + /** + * Case insensitive starts with matcher. + */ + static class IStartsWith implements ElMatcher { - static class InSet implements ElMatcher { + final ElPropertyValue elGetValue; + final CharMatch charMatch; - final Set set; - final ElPropertyValue elGetValue; - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public InSet(Set set, ElPropertyValue elGetValue){ - this.set = new HashSet(set); - this.elGetValue = elGetValue; - } + IStartsWith(ElPropertyValue elGetValue, String value) { + this.elGetValue = elGetValue; + this.charMatch = new CharMatch(value); + } - public boolean isMatch(T bean) { + public boolean isMatch(T bean) { + + String v = (String) elGetValue.elGetValue((EntityBean) bean); + return charMatch.startsWith(v); + } + } + + /** + * Case insensitive ends with matcher. + */ + static class IEndsWith implements ElMatcher { + + final ElPropertyValue elGetValue; + final CharMatch charMatch; + + IEndsWith(ElPropertyValue elGetValue, String value) { + this.elGetValue = elGetValue; + this.charMatch = new CharMatch(value); + } + + public boolean isMatch(T bean) { + + String v = (String) elGetValue.elGetValue((EntityBean) bean); + return charMatch.endsWith(v); + } + } + + static class StartsWith extends BaseString { + StartsWith(ElPropertyValue elGetValue, String value) { + super(elGetValue, value); + } + + public boolean isMatch(T bean) { + String v = (String) elGetValue.elGetValue((EntityBean) bean); + return value.startsWith(v); + } + } + + static class EndsWith extends BaseString { + EndsWith(ElPropertyValue elGetValue, String value) { + super(elGetValue, value); + } + + public boolean isMatch(T bean) { + String v = (String) elGetValue.elGetValue((EntityBean) bean); + return value.endsWith(v); + } + } + + static class IsNull implements ElMatcher { + + final ElPropertyValue elGetValue; + + public IsNull(ElPropertyValue elGetValue) { + this.elGetValue = elGetValue; + } + + public boolean isMatch(T bean) { + return (null == elGetValue.elGetValue((EntityBean) bean)); + } + } + + static class IsNotNull implements ElMatcher { + + final ElPropertyValue elGetValue; + + public IsNotNull(ElPropertyValue elGetValue) { + this.elGetValue = elGetValue; + } + + public boolean isMatch(T bean) { + return (null != elGetValue.elGetValue((EntityBean) bean)); + } + } + + static abstract class Base implements ElMatcher { + + final Object filterValue; + + final ElComparator comparator; + + public Base(Object filterValue, ElComparator comparator) { + this.filterValue = filterValue; + this.comparator = comparator; + } + + public abstract boolean isMatch(T value); + } + + static class InSet implements ElMatcher { + + final Set set; + final ElPropertyValue elGetValue; + + @SuppressWarnings({"unchecked", "rawtypes"}) + public InSet(Set set, ElPropertyValue elGetValue) { + this.set = new HashSet(set); + this.elGetValue = elGetValue; + } + + public boolean isMatch(T bean) { Object value = elGetValue.elGetValue((EntityBean) bean); return value != null && set.contains(value); } - } + } - /** - * Equal To. - */ - static class Eq extends Base { - - public Eq(Object filterValue, ElComparator comparator){ - super(filterValue, comparator); - } - - public boolean isMatch(T value) { - return comparator.compareValue(filterValue, value) == 0; - } - } - - /** - * Not Equal To. - */ - static class Ne extends Base { - - public Ne(Object filterValue, ElComparator comparator){ - super(filterValue, comparator); - } - - public boolean isMatch(T value) { - return comparator.compareValue(filterValue, value) != 0; - } - } - - /** - * Between. - */ - static class Between implements ElMatcher { - - final Object min; - final Object max; - final ElComparator comparator; - - Between(Object min, Object max, ElComparator comparator){ - this.min = min; - this.max = max; - this.comparator = comparator; - } - - public boolean isMatch(T value) { + /** + * Equal To. + */ + static class Eq extends Base { - return (comparator.compareValue(min, value) <= 0 - && comparator.compareValue(max, value) >= 0); - } - } - - /** - * Greater Than. - */ - static class Gt extends Base { - Gt(Object filterValue, ElComparator comparator){ - super(filterValue, comparator); - } - - public boolean isMatch(T value) { - return comparator.compareValue(filterValue, value) == -1; - } - } - - /** - * Greater Than or Equal To. - */ - static class Ge extends Base { - Ge(Object filterValue, ElComparator comparator){ - super(filterValue, comparator); - } - - public boolean isMatch(T value) { - return comparator.compareValue(filterValue, value) >= 0; - } - } - - /** - * Less Than or Equal To. - */ - static class Le extends Base { - Le(Object filterValue, ElComparator comparator){ - super(filterValue, comparator); - } - - public boolean isMatch(T value) { - return comparator.compareValue(filterValue, value) <= 0; - } - } - - /** - * Less Than. - */ - static class Lt extends Base { - Lt(Object filterValue, ElComparator comparator){ - super(filterValue, comparator); - } - - public boolean isMatch(T value) { - return comparator.compareValue(filterValue, value) == 1; - } - } + public Eq(Object filterValue, ElComparator comparator) { + super(filterValue, comparator); + } + + public boolean isMatch(T value) { + return comparator.compareValue(filterValue, value) == 0; + } + } + + /** + * Not Equal To. + */ + static class Ne extends Base { + + public Ne(Object filterValue, ElComparator comparator) { + super(filterValue, comparator); + } + + public boolean isMatch(T value) { + return comparator.compareValue(filterValue, value) != 0; + } + } + + /** + * Between. + */ + static class Between implements ElMatcher { + + final Object min; + final Object max; + final ElComparator comparator; + + Between(Object min, Object max, ElComparator comparator) { + this.min = min; + this.max = max; + this.comparator = comparator; + } + + public boolean isMatch(T value) { + + return (comparator.compareValue(min, value) <= 0 + && comparator.compareValue(max, value) >= 0); + } + } + + /** + * Greater Than. + */ + static class Gt extends Base { + Gt(Object filterValue, ElComparator comparator) { + super(filterValue, comparator); + } + + public boolean isMatch(T value) { + return comparator.compareValue(filterValue, value) == -1; + } + } + + /** + * Greater Than or Equal To. + */ + static class Ge extends Base { + Ge(Object filterValue, ElComparator comparator) { + super(filterValue, comparator); + } + + public boolean isMatch(T value) { + return comparator.compareValue(filterValue, value) >= 0; + } + } + + /** + * Less Than or Equal To. + */ + static class Le extends Base { + Le(Object filterValue, ElComparator comparator) { + super(filterValue, comparator); + } + + public boolean isMatch(T value) { + return comparator.compareValue(filterValue, value) <= 0; + } + } + + /** + * Less Than. + */ + static class Lt extends Base { + Lt(Object filterValue, ElComparator comparator) { + super(filterValue, comparator); + } + + public boolean isMatch(T value) { + return comparator.compareValue(filterValue, value) == 1; + } + } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElMatcher.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElMatcher.java index 2c6ebc8ac..5a37fc031 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElMatcher.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElMatcher.java @@ -5,8 +5,8 @@ package com.avaje.ebeaninternal.server.el; */ public interface ElMatcher { - /** - * Return true if the bean matches the expression. - */ - boolean isMatch(T bean); + /** + * Return true if the bean matches the expression. + */ + boolean isMatch(T bean); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChain.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChain.java index 404e75096..c447bc9cb 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChain.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChain.java @@ -24,103 +24,103 @@ import java.util.Arrays; */ public class ElPropertyChain implements ElPropertyValue { - private final String prefix; + private final String prefix; - private final String placeHolder; - private final String placeHolderEncrypted; - - private final String name; - - private final String expression; + private final String placeHolder; + private final String placeHolderEncrypted; - private final boolean containsMany; - - private final ElPropertyValue[] chain; + private final String name; - private final boolean assocId; - private final int last; - private final BeanProperty lastBeanProperty; - private final ScalarType scalarType; - - private final ElPropertyValue lastElPropertyValue; + private final String expression; - public ElPropertyChain(boolean containsMany, boolean embedded, String expression, ElPropertyValue[] chain) { + private final boolean containsMany; - this.containsMany = containsMany; - this.chain = chain; - this.expression = expression; - int dotPos = expression.lastIndexOf('.'); - if (dotPos > -1){ - this.name = expression.substring(dotPos+1); - if (embedded){ - int embPos = expression.lastIndexOf('.',dotPos-1); - this.prefix = embPos == -1 ? null : expression.substring(0, embPos); + private final ElPropertyValue[] chain; - } else { - this.prefix = expression.substring(0, dotPos); - } - } else { - this.prefix = null; - this.name = expression; - } + private final boolean assocId; + private final int last; + private final BeanProperty lastBeanProperty; + private final ScalarType scalarType; - this.assocId = chain[chain.length-1].isAssocId(); + private final ElPropertyValue lastElPropertyValue; - this.last = chain.length-1; - this.lastBeanProperty = chain[chain.length-1].getBeanProperty(); - if (lastBeanProperty != null){ - this.scalarType = lastBeanProperty.getScalarType(); - } else { - // case for nested compound type (non-scalar) - this.scalarType = null; - } - this.lastElPropertyValue = chain[chain.length-1]; - this.placeHolder = getElPlaceHolder(prefix, lastElPropertyValue, false); - this.placeHolderEncrypted = getElPlaceHolder(prefix, lastElPropertyValue, true); - } + public ElPropertyChain(boolean containsMany, boolean embedded, String expression, ElPropertyValue[] chain) { - public String toString() { - return "expr:"+expression+" chain:"+ Arrays.toString(chain); - } + this.containsMany = containsMany; + this.chain = chain; + this.expression = expression; + int dotPos = expression.lastIndexOf('.'); + if (dotPos > -1) { + this.name = expression.substring(dotPos + 1); + if (embedded) { + int embPos = expression.lastIndexOf('.', dotPos - 1); + this.prefix = embPos == -1 ? null : expression.substring(0, embPos); - private String getElPlaceHolder(String prefix, ElPropertyValue lastElPropertyValue, boolean encrypted) { - if (prefix == null){ - return lastElPropertyValue.getElPlaceholder(encrypted); - } - - String el = lastElPropertyValue.getElPlaceholder(encrypted); - - if (!el.contains("${}")){ - // typically a secondary table property - return StringHelper.replaceString(el, "${", "${"+prefix+"."); - } else { - return StringHelper.replaceString(el, ROOT_ELPREFIX, "${"+prefix+"}"); - } - } - - /** - * Return true if there is a many property from sinceProperty to - * the end of this chain. - */ - public boolean containsManySince(String sinceProperty) { - if (sinceProperty == null){ - return containsMany; - } - if (!expression.startsWith(sinceProperty)){ - return containsMany; - } - - int i = 1 + SplitName.count(sinceProperty); - - for (; i < chain.length; i++) { - if (chain[i].getBeanProperty().containsMany()) { - return true; - } - } - - return false; + } else { + this.prefix = expression.substring(0, dotPos); + } + } else { + this.prefix = null; + this.name = expression; } + this.assocId = chain[chain.length - 1].isAssocId(); + + this.last = chain.length - 1; + this.lastBeanProperty = chain[chain.length - 1].getBeanProperty(); + if (lastBeanProperty != null) { + this.scalarType = lastBeanProperty.getScalarType(); + } else { + // case for nested compound type (non-scalar) + this.scalarType = null; + } + this.lastElPropertyValue = chain[chain.length - 1]; + this.placeHolder = getElPlaceHolder(prefix, lastElPropertyValue, false); + this.placeHolderEncrypted = getElPlaceHolder(prefix, lastElPropertyValue, true); + } + + public String toString() { + return "expr:" + expression + " chain:" + Arrays.toString(chain); + } + + private String getElPlaceHolder(String prefix, ElPropertyValue lastElPropertyValue, boolean encrypted) { + if (prefix == null) { + return lastElPropertyValue.getElPlaceholder(encrypted); + } + + String el = lastElPropertyValue.getElPlaceholder(encrypted); + + if (!el.contains("${}")) { + // typically a secondary table property + return StringHelper.replaceString(el, "${", "${" + prefix + "."); + } else { + return StringHelper.replaceString(el, ROOT_ELPREFIX, "${" + prefix + "}"); + } + } + + /** + * Return true if there is a many property from sinceProperty to + * the end of this chain. + */ + public boolean containsManySince(String sinceProperty) { + if (sinceProperty == null) { + return containsMany; + } + if (!expression.startsWith(sinceProperty)) { + return containsMany; + } + + int i = 1 + SplitName.count(sinceProperty); + + for (; i < chain.length; i++) { + if (chain[i].getBeanProperty().containsMany()) { + return true; + } + } + + return false; + } + @Override public boolean containsFormulaWithJoin() { // Not cascading the check at this stage @@ -128,159 +128,159 @@ public class ElPropertyChain implements ElPropertyValue { } public boolean containsMany() { - return containsMany; - } + return containsMany; + } - public String getElPrefix() { - return prefix; - } + public String getElPrefix() { + return prefix; + } - public String getName() { - return name; - } - - public String getElName() { - return expression; + public String getName() { + return name; + } + + public String getElName() { + return expression; + } + + public String getElPlaceholder(boolean encrypted) { + return encrypted ? placeHolderEncrypted : placeHolder; + } + + public boolean isDbEncrypted() { + return lastElPropertyValue.isDbEncrypted(); + } + + public boolean isLocalEncrypted() { + return lastElPropertyValue.isLocalEncrypted(); + } + + public Object[] getAssocOneIdValues(EntityBean bean) { + // Don't navigate the object graph as bean + // is assumed to be the appropriate type + return lastElPropertyValue.getAssocOneIdValues(bean); + } + + public String getAssocOneIdExpr(String prefix, String operator) { + return lastElPropertyValue.getAssocOneIdExpr(expression, operator); + } + + public String getAssocIdInExpr(String prefix) { + return lastElPropertyValue.getAssocIdInExpr(prefix); + } + + public String getAssocIdInValueExpr(int size) { + return lastElPropertyValue.getAssocIdInValueExpr(size); + } + + public int getDeployOrder() { + int i = lastBeanProperty.getDeployOrder(); + int max = chain.length - 1; + for (int j = 0; j < max; j++) { + int xtra = ((max - j) * 1000) * chain[j].getDeployOrder(); + i += xtra; + } + return i; + } + + public boolean isAssocId() { + return assocId; + } + + public boolean isAssocProperty() { + for (int i = 0; i < chain.length; i++) { + if (chain[i].isAssocProperty()) { + return true; + } + } + return false; + } + + public String getDbColumn() { + return lastElPropertyValue.getDbColumn(); + } + + public BeanProperty getBeanProperty() { + return lastBeanProperty; + } + + + public boolean isDateTimeCapable() { + return scalarType != null && scalarType.isDateTimeCapable(); + } + + public int getJdbcType() { + return scalarType == null ? 0 : scalarType.getJdbcType(); + } + + public Object parseDateTime(long systemTimeMillis) { + return scalarType.convertFromMillis(systemTimeMillis); + } + + public StringParser getStringParser() { + return scalarType; + } + + public StringFormatter getStringFormatter() { + return scalarType; + } + + public Object elConvertType(Object value) { + // just convert using the last one in the chain + return lastElPropertyValue.elConvertType(value); + } + + public Object elGetValue(EntityBean bean) { + + for (int i = 0; i < chain.length; i++) { + bean = (EntityBean) chain[i].elGetValue(bean); + if (bean == null) { + return null; + } } - public String getElPlaceholder(boolean encrypted) { - return encrypted ? placeHolderEncrypted : placeHolder; - } - - public boolean isDbEncrypted() { - return lastElPropertyValue.isDbEncrypted(); - } - - public boolean isLocalEncrypted() { - return lastElPropertyValue.isLocalEncrypted(); - } + return bean; + } - public Object[] getAssocOneIdValues(EntityBean bean) { - // Don't navigate the object graph as bean - // is assumed to be the appropriate type - return lastElPropertyValue.getAssocOneIdValues(bean); - } + public Object elGetReference(EntityBean bean) { - public String getAssocOneIdExpr(String prefix, String operator) { - return lastElPropertyValue.getAssocOneIdExpr(expression, operator); - } - - public String getAssocIdInExpr(String prefix) { - return lastElPropertyValue.getAssocIdInExpr(prefix); + EntityBean prevBean = bean; + for (int i = 0; i < last; i++) { + // always return non null prevBean + prevBean = (EntityBean) chain[i].elGetReference(prevBean); } + // try the last step in the chain + return chain[last].elGetValue(prevBean); + } - public String getAssocIdInValueExpr(int size) { - return lastElPropertyValue.getAssocIdInValueExpr(size); - } - - public int getDeployOrder() { - int i = lastBeanProperty.getDeployOrder(); - int max = chain.length-1; - for (int j = 0; j < max; j++) { - int xtra = ((max-j)*1000) * chain[j].getDeployOrder(); - i += xtra; + public void elSetValue(EntityBean bean, Object value, boolean populate) { + + EntityBean prevBean = bean; + if (populate) { + for (int i = 0; i < last; i++) { + // always return non null prevBean + prevBean = (EntityBean) chain[i].elGetReference(prevBean); + } + } else { + for (int i = 0; i < last; i++) { + // always return non null prevBean + prevBean = (EntityBean) chain[i].elGetValue(prevBean); + if (prevBean == null) { + break; } - return i; + } } + if (prevBean != null) { + if (lastBeanProperty != null) { + // last chain element maps to a real scalar property + lastBeanProperty.setValueIntercept(prevBean, value); - public boolean isAssocId() { - return assocId; - } - - public boolean isAssocProperty() { - for (int i = 0; i < chain.length; i++) { - if (chain[i].isAssocProperty()){ - return true; - } - } - return false; + } else { + // a non-scalar property of a Compound value object + lastElPropertyValue.elSetValue(prevBean, value, populate); + } } + } - public String getDbColumn() { - return lastElPropertyValue.getDbColumn(); - } - - public BeanProperty getBeanProperty() { - return lastBeanProperty; - } - - public boolean isDateTimeCapable() { - return scalarType != null && scalarType.isDateTimeCapable(); - } - - public int getJdbcType() { - return scalarType == null ? 0 : scalarType.getJdbcType(); - } - - public Object parseDateTime(long systemTimeMillis) { - return scalarType.convertFromMillis(systemTimeMillis); - } - - public StringParser getStringParser() { - return scalarType; - } - - public StringFormatter getStringFormatter() { - return scalarType; - } - - public Object elConvertType(Object value){ - // just convert using the last one in the chain - return lastElPropertyValue.elConvertType(value); - } - - public Object elGetValue(EntityBean bean) { - - for (int i = 0; i < chain.length; i++) { - bean = (EntityBean)chain[i].elGetValue(bean); - if (bean == null) { - return null; - } - } - - return bean; - } - - public Object elGetReference(EntityBean bean) { - - EntityBean prevBean = bean; - for (int i = 0; i < last; i++) { - // always return non null prevBean - prevBean = (EntityBean)chain[i].elGetReference(prevBean); - } - // try the last step in the chain - return chain[last].elGetValue(prevBean); - } - - public void elSetValue(EntityBean bean, Object value, boolean populate) { - - EntityBean prevBean = bean; - if (populate){ - for (int i = 0; i < last; i++) { - // always return non null prevBean - prevBean = (EntityBean)chain[i].elGetReference(prevBean); - } - } else { - for (int i = 0; i < last; i++) { - // always return non null prevBean - prevBean = (EntityBean)chain[i].elGetValue(prevBean); - if (prevBean == null){ - break; - } - } - } - if (prevBean != null){ - if (lastBeanProperty != null){ - // last chain element maps to a real scalar property - lastBeanProperty.setValueIntercept(prevBean, value); - - } else { - // a non-scalar property of a Compound value object - lastElPropertyValue.elSetValue(prevBean, value, populate); - } - } - } - - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChainBuilder.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChainBuilder.java index 60e5e252c..71d75d366 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChainBuilder.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyChainBuilder.java @@ -15,50 +15,50 @@ import java.util.List; */ public class ElPropertyChainBuilder { - private final String expression; + private final String expression; - private final List chain = new ArrayList(); + private final List chain = new ArrayList(); - private final boolean embedded; - - private boolean containsMany; - - /** - * Create with the original expression. - */ - public ElPropertyChainBuilder(boolean embedded, String expression) { - this.embedded = embedded; - this.expression = expression; - } - - public boolean isContainsMany() { - return containsMany; - } + private final boolean embedded; - public void setContainsMany(boolean containsMany) { - this.containsMany = containsMany; - } + private boolean containsMany; - public String getExpression() { - return expression; - } + /** + * Create with the original expression. + */ + public ElPropertyChainBuilder(boolean embedded, String expression) { + this.embedded = embedded; + this.expression = expression; + } - /** - * Add a ElGetValue element to the chain. - */ - public ElPropertyChainBuilder add(ElPropertyValue element) { - if (element == null){ - throw new NullPointerException("element null in expression "+expression); - } - chain.add(element); - return this; - } + public boolean isContainsMany() { + return containsMany; + } - /** - * Build the immutable ElGetChain from the build information. - */ - public ElPropertyChain build() { - return new ElPropertyChain(containsMany, embedded, expression, chain.toArray(new ElPropertyValue[chain.size()])); - } + public void setContainsMany(boolean containsMany) { + this.containsMany = containsMany; + } + + public String getExpression() { + return expression; + } + + /** + * Add a ElGetValue element to the chain. + */ + public ElPropertyChainBuilder add(ElPropertyValue element) { + if (element == null) { + throw new NullPointerException("element null in expression " + expression); + } + chain.add(element); + return this; + } + + /** + * Build the immutable ElGetChain from the build information. + */ + public ElPropertyChain build() { + return new ElPropertyChain(containsMany, embedded, expression, chain.toArray(new ElPropertyValue[chain.size()])); + } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyValue.java b/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyValue.java index 00114959f..8cfd30604 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyValue.java +++ b/src/main/java/com/avaje/ebeaninternal/server/el/ElPropertyValue.java @@ -11,101 +11,101 @@ import com.avaje.ebean.text.StringParser; */ public interface ElPropertyValue extends ElPropertyDeploy { - /** - * Return the Id values for the given bean value. - */ - Object[] getAssocOneIdValues(EntityBean bean); + /** + * Return the Id values for the given bean value. + */ + Object[] getAssocOneIdValues(EntityBean bean); - /** - * Return the Id expression string. - *

- * Typically used to produce id = ? expression strings. - *

- */ - String getAssocOneIdExpr(String prefix, String operator); + /** + * Return the Id expression string. + *

+ * Typically used to produce id = ? expression strings. + *

+ */ + String getAssocOneIdExpr(String prefix, String operator); - /** - * Return the logical id value expression taking into account embedded id's. - */ - String getAssocIdInValueExpr(int size); - - /** - * Return the logical id in expression taking into account embedded id's. - */ - String getAssocIdInExpr(String prefix); - - /** - * Return true if this is an ManyToOne or OneToOne associated bean property. - */ - boolean isAssocId(); + /** + * Return the logical id value expression taking into account embedded id's. + */ + String getAssocIdInValueExpr(int size); - /** - * Return true if any path of this path contains a Associated One or Many. - */ - boolean isAssocProperty(); + /** + * Return the logical id in expression taking into account embedded id's. + */ + String getAssocIdInExpr(String prefix); - /** - * Return true if the property is encrypted via Java. - */ - boolean isLocalEncrypted(); - - /** - * Return true if the property is encrypted in the DB. - */ - boolean isDbEncrypted(); + /** + * Return true if this is an ManyToOne or OneToOne associated bean property. + */ + boolean isAssocId(); - /** - * Return the deploy order for the property. - */ - int getDeployOrder(); - - /** - * Return the default StringParser for the scalar property. - */ - StringParser getStringParser(); + /** + * Return true if any path of this path contains a Associated One or Many. + */ + boolean isAssocProperty(); - /** - * Return true if the last type is "DateTime capable" - can support - * {@link #parseDateTime(long)}. - */ - boolean isDateTimeCapable(); + /** + * Return true if the property is encrypted via Java. + */ + boolean isLocalEncrypted(); - /** - * Return the underlying JDBC type or 0 if this is not a scalar type. - */ - int getJdbcType(); - - /** - * For DateTime capable scalar types convert the long systemTimeMillis into - * an appropriate java time (Date,Timestamp,Time,Calendar, JODA type etc). - */ - Object parseDateTime(long systemTimeMillis); + /** + * Return true if the property is encrypted in the DB. + */ + boolean isDbEncrypted(); - /** - * Return the value from a given entity bean. - */ - Object elGetValue(EntityBean bean); + /** + * Return the deploy order for the property. + */ + int getDeployOrder(); - /** - * Return the value ensuring objects prior to the top scalar property are - * automatically populated. - */ - Object elGetReference(EntityBean bean); + /** + * Return the default StringParser for the scalar property. + */ + StringParser getStringParser(); - /** - * Set a value given a root level bean. - *

- * If populate then - *

- */ - void elSetValue(EntityBean bean, Object value, boolean populate); + /** + * Return true if the last type is "DateTime capable" - can support + * {@link #parseDateTime(long)}. + */ + boolean isDateTimeCapable(); - /** - * Convert the value to the expected type. - *

- * Typically useful for converting strings to the appropriate number type - * etc. - *

- */ - Object elConvertType(Object value); + /** + * Return the underlying JDBC type or 0 if this is not a scalar type. + */ + int getJdbcType(); + + /** + * For DateTime capable scalar types convert the long systemTimeMillis into + * an appropriate java time (Date,Timestamp,Time,Calendar, JODA type etc). + */ + Object parseDateTime(long systemTimeMillis); + + /** + * Return the value from a given entity bean. + */ + Object elGetValue(EntityBean bean); + + /** + * Return the value ensuring objects prior to the top scalar property are + * automatically populated. + */ + Object elGetReference(EntityBean bean); + + /** + * Set a value given a root level bean. + *

+ * If populate then + *

+ */ + void elSetValue(EntityBean bean, Object value, boolean populate); + + /** + * Convert the value to the expected type. + *

+ * Typically useful for converting strings to the appropriate number type + * etc. + *

+ */ + Object elConvertType(Object value); }