Compare.java
package
com.lnn.spel.compare;
public class Compare {
private boolean equal;
private boolean equalExp;
private boolean lessThanExp;
private boolean greaterThan;
private boolean greaterThanExp;
private boolean lessThanEqualsExp;
private boolean greaterThanEquals;
private boolean greaterThanEqualsExp;
public boolean isEqual() {
return equal;
}
public void setEqual(boolean equal) {
this.equal = equal;
}
public boolean isEqualExp() {
return equalExp;
}
public void setEqualExp(boolean equalExp) {
this.equalExp = equalExp;
}
public boolean isLessThanExp()
{
return lessThanExp;
}
public void setLessThanExp(boolean lessThanExp) {
this.lessThanExp = lessThanExp;
}
public boolean isGreaterThan()
{
return greaterThan;
}
public void setGreaterThan(boolean greaterThan) {
this.greaterThan = greaterThan;
}
public boolean
isGreaterThanExp() {
return greaterThanExp;
}
public void
setGreaterThanExp(boolean greaterThanExp) {
this.greaterThanExp =
greaterThanExp;
}
public boolean
isLessThanEqualsExp() {
return lessThanEqualsExp;
}
public void
setLessThanEqualsExp(boolean lessThanEqualsExp) {
this.lessThanEqualsExp = lessThanEqualsExp;
}
public boolean
isGreaterThanEquals() {
return greaterThanEquals;
}
public void
setGreaterThanEquals(boolean greaterThanEquals) {
this.greaterThanEquals =
greaterThanEquals;
}
public boolean
isGreaterThanEqualsExp() {
return greaterThanEqualsExp;
}
public void
setGreaterThanEqualsExp(boolean greaterThanEqualsExp) {
this.greaterThanEqualsExp =
greaterThanEqualsExp;
}
}
compare.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="compare"
class = "com.lnn.spel.compare.Compare">
<property name="equal"
value="#{3==3}"/>
<property name="equalExp"
value="#{3 eq 3}"/>
<property name="lessThanExp"
value="#{3 lt 4}"/>
<property name="lessThanEqualsExp"
value="#{3 le 4}"/>
<property name="greaterThan"
value="#{4 > 3}"/>
<property name="greaterThanExp"
value="#{4 gt 3}"/>
<property name="greaterThanEquals"
value="#{4 >= 3}"/>
<property name="greaterThanEqualsExp"
value="#{4 ge 3}"/>
</bean>
</beans>
Test.java:
package
com.lnn.spel.compare;
import
org.springframework.context.ApplicationContext;
import
org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test {
public static void main(String[]
args) {
ApplicationContext
context = new ClassPathXmlApplicationContext("compare.xml");
Compare
compare = context.getBean("compare", Compare.class);
System.out.println(compare.isEqual());
System.out.println(compare.isEqualExp());
System.out.println(compare.isGreaterThan());
System.out.println(compare.isGreaterThanExp());
System.out.println(compare.isGreaterThanEquals());
System.out.println(compare.isGreaterThanEqualsExp());
System.out.println(compare.isLessThanExp());
System.out.println(compare.isLessThanEqualsExp());
}
}
No comments:
Post a Comment