Polishing (collapsed if checks, consistent downcasts, refined javadoc)

This commit is contained in:
Juergen Hoeller
2018-03-08 18:11:57 +01:00
parent 0f7485b01d
commit 139dc1d373
50 changed files with 336 additions and 435 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -92,12 +92,12 @@ public class OpModulus extends Operator {
if (!getLeftOperand().isCompilable()) {
return false;
}
if (this.children.length>1) {
if (this.children.length > 1) {
if (!getRightOperand().isCompilable()) {
return false;
}
}
return this.exitTypeDescriptor!=null;
return (this.exitTypeDescriptor != null);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -104,43 +104,9 @@ public class VariableReference extends SpelNodeImpl {
return !(this.name.equals(THIS) || this.name.equals(ROOT));
}
class VariableRef implements ValueRef {
private final String name;
private final TypedValue value;
private final EvaluationContext evaluationContext;
public VariableRef(String name, TypedValue value,
EvaluationContext evaluationContext) {
this.name = name;
this.value = value;
this.evaluationContext = evaluationContext;
}
@Override
public TypedValue getValue() {
return this.value;
}
@Override
public void setValue(@Nullable Object newValue) {
this.evaluationContext.setVariable(this.name, newValue);
}
@Override
public boolean isWritable() {
return true;
}
}
@Override
public boolean isCompilable() {
return this.exitTypeDescriptor!=null;
return (this.exitTypeDescriptor != null);
}
@Override
@@ -158,4 +124,34 @@ public class VariableReference extends SpelNodeImpl {
}
private static class VariableRef implements ValueRef {
private final String name;
private final TypedValue value;
private final EvaluationContext evaluationContext;
public VariableRef(String name, TypedValue value, EvaluationContext evaluationContext) {
this.name = name;
this.value = value;
this.evaluationContext = evaluationContext;
}
@Override
public TypedValue getValue() {
return this.value;
}
@Override
public void setValue(@Nullable Object newValue) {
this.evaluationContext.setVariable(this.name, newValue);
}
@Override
public boolean isWritable() {
return true;
}
}
}