Browse Source

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

pull/335/head
Greenwood 7 years ago
parent
commit
07f49c4f17
  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){
return read(jsonPath);
} else {
jsonPath = compile(path, filters);
cache.put(cacheKey, jsonPath);
jsonPath = compile(path, filters);
cache.put(cacheKey, 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;
/**
* 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 {
/**

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;
import com.jayway.jsonpath.internal.function.Parameter;
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 {
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;
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...
*
* Created by mattg on 3/27/17.
*/
public class PathLateBindingValue implements ILateBindingValue {
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) {
for (Parameter param : parameters) {
if (param.getValue() != null) {
result.append(param.getValue().toString());
Object value = param.getValue();
if (value != null) {
result.append(value.toString());
}
}
}

Loading…
Cancel
Save