@ -1296,11 +1296,11 @@ following listing shows both ways to use the assignment operator:
@@ -1296,11 +1296,11 @@ following listing shows both ways to use the assignment operator:
@ -1308,11 +1308,11 @@ following listing shows both ways to use the assignment operator:
@@ -1308,11 +1308,11 @@ following listing shows both ways to use the assignment operator:
val inventor = Inventor()
val context = SimpleEvaluationContext.forReadWriteDataBinding().build()
expression = "isMember(#queryName)? #queryName + ' is a member of the ' " + "+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'"
@ -1704,11 +1704,11 @@ The following listing shows a more complex example:
@@ -1704,11 +1704,11 @@ The following listing shows a more complex example:
@ -1718,11 +1718,11 @@ The following listing shows a more complex example:
@@ -1718,11 +1718,11 @@ The following listing shows a more complex example:
val context = SimpleEvaluationContext.forReadOnlyDataBinding().build()
val tesla = Inventor("Nikola Tesla", "Serbian")
var name = parser.parseExpression("Name?:'Elvis Presley'").getValue(context, tesla, String::class.java)
var name = parser.parseExpression("name?:'Elvis Presley'").getValue(context, tesla, String::class.java)
println(name) // Nikola Tesla
tesla.setName(null)
name = parser.parseExpression("Name?:'Elvis Presley'").getValue(context, tesla, String::class.java)
name = parser.parseExpression("name?:'Elvis Presley'").getValue(context, tesla, String::class.java)
println(name) // Elvis Presley
----
@ -1759,11 +1759,11 @@ example shows how to use the safe navigation operator:
@@ -1759,11 +1759,11 @@ example shows how to use the safe navigation operator:
Inventor tesla = new Inventor("Nikola Tesla", "Serbian");
@ -1775,11 +1775,11 @@ example shows how to use the safe navigation operator:
@@ -1775,11 +1775,11 @@ example shows how to use the safe navigation operator:
val tesla = Inventor("Nikola Tesla", "Serbian")
tesla.setPlaceOfBirth(PlaceOfBirth("Smiljan"))
var city = parser.parseExpression("PlaceOfBirth?.City").getValue(context, tesla, String::class.java)
var city = parser.parseExpression("placeOfBirth?.city").getValue(context, tesla, String::class.java)
println(city) // Smiljan
tesla.setPlaceOfBirth(null)
city = parser.parseExpression("PlaceOfBirth?.City").getValue(context, tesla, String::class.java)
city = parser.parseExpression("placeOfBirth?.city").getValue(context, tesla, String::class.java)
println(city) // null - does not throw NullPointerException!!!
----
@ -1799,13 +1799,13 @@ selection lets us easily get a list of Serbian inventors, as the following examp
@@ -1799,13 +1799,13 @@ selection lets us easily get a list of Serbian inventors, as the following examp
.Java
----
List<Inventor> list = (List<Inventor>) parser.parseExpression(
"Members.?[Nationality == 'Serbian']").getValue(societyContext) as List<Inventor>
"members.?[nationality == 'Serbian']").getValue(societyContext) as List<Inventor>
----
Selection is possible upon both lists and maps. For a list, the selection
@ -1849,13 +1849,13 @@ every entry in the inventor list. The following example uses projection to do so
@@ -1849,13 +1849,13 @@ every entry in the inventor list. The following example uses projection to do so
.Java
----
// returns ['Smiljan', 'Idvor' ]
List placesOfBirth = (List)parser.parseExpression("Members.![placeOfBirth.city]");
List placesOfBirth = (List)parser.parseExpression("members.![placeOfBirth.city]");