Browse Source

addressing @jochenberger's code review comments, Created by... is IntelliJ auto-creation -- added Apache license headers

pull/405/head
Greenwood 8 years ago
parent
commit
e8199bd93d
  1. 4
      json-path/src/main/java/com/jayway/jsonpath/internal/JsonContext.java
  2. 15
      json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/ILateBindingValue.java
  3. 17
      json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java
  4. 15
      json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java
  5. 5
      json-path/src/main/java/com/jayway/jsonpath/internal/function/text/Concatenate.java

4
json-path/src/main/java/com/jayway/jsonpath/internal/JsonContext.java

@ -146,8 +146,8 @@ public class JsonContext implements ParseContext, DocumentContext {
if(jsonPath != null){ if(jsonPath != null){
return read(jsonPath); return read(jsonPath);
} else { } else {
jsonPath = compile(path, filters); jsonPath = compile(path, filters);
cache.put(cacheKey, jsonPath); cache.put(cacheKey, jsonPath);
return read(jsonPath); return read(jsonPath);
} }

15
json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/ILateBindingValue.java

@ -1,9 +1,22 @@
/*
* Copyright 2011 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.function.latebinding; package com.jayway.jsonpath.internal.function.latebinding;
/** /**
* Obtain the late binding value at runtime rather than storing the value in the cache thus trashing the cache * Obtain the late binding value at runtime rather than storing the value in the cache thus trashing the cache
* *
* Created by mattg on 3/27/17.
*/ */
public interface ILateBindingValue { public interface ILateBindingValue {
/** /**

17
json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/JsonLateBindingValue.java

@ -1,10 +1,25 @@
/*
* Copyright 2011 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.function.latebinding; package com.jayway.jsonpath.internal.function.latebinding;
import com.jayway.jsonpath.internal.function.Parameter; import com.jayway.jsonpath.internal.function.Parameter;
import com.jayway.jsonpath.spi.json.JsonProvider; import com.jayway.jsonpath.spi.json.JsonProvider;
/** /**
* Created by mattg on 3/27/17. * Defines the JSON document Late binding approach to function arguments.
*
*/ */
public class JsonLateBindingValue implements ILateBindingValue { public class JsonLateBindingValue implements ILateBindingValue {
private final JsonProvider jsonProvider; private final JsonProvider jsonProvider;

15
json-path/src/main/java/com/jayway/jsonpath/internal/function/latebinding/PathLateBindingValue.java

@ -1,3 +1,17 @@
/*
* Copyright 2011 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.jsonpath.internal.function.latebinding; package com.jayway.jsonpath.internal.function.latebinding;
import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.Configuration;
@ -10,7 +24,6 @@ import com.jayway.jsonpath.internal.function.ParamType;
* *
* Acts like a lambda function with references, but since we're supporting JDK 6+, we're left doing this... * Acts like a lambda function with references, but since we're supporting JDK 6+, we're left doing this...
* *
* Created by mattg on 3/27/17.
*/ */
public class PathLateBindingValue implements ILateBindingValue { public class PathLateBindingValue implements ILateBindingValue {
private final Path path; private final Path path;

5
json-path/src/main/java/com/jayway/jsonpath/internal/function/text/Concatenate.java

@ -27,8 +27,9 @@ public class Concatenate implements PathFunction {
} }
if (parameters != null) { if (parameters != null) {
for (Parameter param : parameters) { for (Parameter param : parameters) {
if (param.getValue() != null) { Object value = param.getValue();
result.append(param.getValue().toString()); if (value != null) {
result.append(value.toString());
} }
} }
} }

Loading…
Cancel
Save