本文整理汇总了Java中com.fasterxml.jackson.core.JsonStreamContext.inRoot方法的典型用法代码示例。如果您正苦于以下问题:Java JsonStreamContext.inRoot方法的具体用法?Java JsonStreamContext.inRoot怎么用?Java JsonStreamContext.inRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonStreamContext
的用法示例。
在下文中一共展示了JsonStreamContext.inRoot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
@Override
public void close() throws IOException {
if (generator.isClosed()) {
return;
}
JsonStreamContext context = generator.getOutputContext();
if ((context != null) && (context.inRoot() == false)) {
throw new IOException("Unclosed object or array found");
}
if (writeLineFeedAtEnd) {
flush();
// Bypass generator to always write the line feed
getLowLevelGenerator().writeRaw(LF);
}
generator.close();
}
示例2: matchesSafely
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
@Override
protected boolean matchesSafely(JsonStreamContext context, Description mismatch) {
if (context.inArray()) {
mismatch.appendText("was of type ARRAY");
return false;
}
if (context.inRoot()) {
mismatch.appendText("was of type ROOT");
return false;
}
if (!context.inObject()) {
mismatch.appendText("was not of type OBJECT");
return false;
}
return true;
}
示例3: matchesSafely
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
@Override
protected boolean matchesSafely(JsonStreamContext context, Description mismatch) {
if (context.inRoot()) {
mismatch.appendText("was of type ROOT");
return false;
}
if (context.inObject()) {
mismatch.appendText("was of type OBJECT");
return false;
}
if (!context.inArray()) {
mismatch.appendText("was not of type ARRAY");
return false;
}
return true;
}
示例4: matchesSafely
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
@Override
protected boolean matchesSafely(JsonStreamContext context, Description mismatch) {
if (context.inObject()) {
mismatch.appendText("was of type OBJECT");
return false;
}
if (context.inArray()) {
mismatch.appendText("was of type ARRAY");
return false;
}
if (!context.inRoot()) {
mismatch.appendText("was not of type ROOT");
return false;
}
return true;
}
示例5: inRoot
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
protected boolean inRoot() {
if (isFiltered()) {
JsonStreamContext context = filter.getFilterContext();
return ((context != null) && (context.inRoot() && context.getCurrentName() == null));
}
return false;
}
示例6: getPathProperties
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
/**
* only first call return FetchPath
* <p>
* and then call is bean sub-path (property)
*
* @return fetch path or null
*/
private FetchPath getPathProperties(JsonGenerator jsonGenerator) {
FetchPath fetchPath = EbeanUtils.getRequestFetchPath();
if (fetchPath != null) {
JsonStreamContext context = jsonGenerator.getOutputContext();
JsonStreamContext parent = context.getParent();
if (parent == null) {
return fetchPath;
}
StringBuilder path = new StringBuilder();
while (parent != null && !parent.inRoot()) {
if (parent != context.getParent()) {
path.insert(0, '.');
}
path.insert(0, parent.getCurrentName());
parent = parent.getParent();
}
String fp = path.toString();
PathProperties fetch = new PathProperties();
EbeanPathProps src = (EbeanPathProps) fetchPath;
String cp = fp + ".";
for (BeanPathProperties.Props prop : src.getPathProps()) {
String pp = prop.getPath();
if (pp.equals(fp)) {
addToFetchPath(fetch, null, prop);
} else if (pp.startsWith(cp)) {
addToFetchPath(fetch, pp.substring(cp.length()), prop);
}
}
return fetch;
}
return null;
}
示例7: inRoot
import com.fasterxml.jackson.core.JsonStreamContext; //导入方法依赖的package包/类
private boolean inRoot() {
JsonStreamContext context = generator.getOutputContext();
return ((context != null) && (context.inRoot() && context.getCurrentName() == null));
}