Package com.alibaba.fastjson2
Class JSONPath
- java.lang.Object
-
- com.alibaba.fastjson2.JSONPath
-
- Direct Known Subclasses:
JSONPathCompilerReflect.SingleNamePathTyped,JSONPathCompilerReflect.TwoNameSegmentTypedPath,JSONPathTypedMultiNamesPrefixIndex1,JSONPathTypedMultiNamesPrefixName1,JSONPathTypedMultiNamesPrefixName2
public abstract class JSONPath extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJSONPath.Feature
-
Constructor Summary
Constructors Modifier Constructor Description protectedJSONPath(String path, long features)protectedJSONPath(String path, JSONPath.Feature... features)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidarrayAdd(Object root, Object... values)static JSONPathcompile(String path)Deprecated.static JSONPathcompile(String strPath, Class objectClass)abstract booleancontains(Object object)static booleancontains(Object rootObject, String path)protected JSONReader.ContextcreateContext()booleanendsWithFilter()abstract Objecteval(Object object)static Objecteval(Object rootObject, String path)static Objecteval(String str, String path)Objectextract(byte[] jsonBytes)Objectextract(byte[] jsonBytes, int off, int len, Charset charset)abstract Objectextract(JSONReader jsonReader)voidextract(JSONReader jsonReader, ValueConsumer consumer)Objectextract(String jsonStr)static Objectextract(String json, String path)static Objectextract(String json, String path, JSONPath.Feature... features)IntegerextractInt32(JSONReader jsonReader)intextractInt32Value(JSONReader jsonReader)LongextractInt64(JSONReader jsonReader)longextractInt64Value(JSONReader jsonReader)abstract StringextractScalar(JSONReader jsonReader)voidextractScalar(JSONReader jsonReader, ValueConsumer consumer)abstract JSONPathgetParent()JSONReader.ContextgetReaderContext()JSONWriter.ContextgetWriterContext()booleanisPrevious()abstract booleanisRef()static JSONPathof(String path)static JSONPathof(String[] paths, Type[] types)create multi-path jsonpathstatic JSONPathof(String[] paths, Type[] types, JSONReader.Feature... features)create multi-path jsonpathstatic JSONPathof(String[] paths, Type[] types, String[] formats, long[] pathFeatures, ZoneId zoneId, JSONReader.Feature... features)create multi-path jsonpathstatic JSONPathof(String path, JSONPath.Feature... features)static JSONPathof(String path, Type type)static JSONPathof(String path, Type type, JSONPath.Feature... features)static Map<String,Object>paths(Object javaObject)abstract booleanremove(Object object)static voidremove(Object rootObject, String path)static Stringremove(String json, String path)abstract voidset(Object object, Object value)abstract voidset(Object object, Object value, JSONReader.Feature... readerFeatures)static Objectset(Object rootObject, String path, Object value)static Stringset(String json, String path, Object value)static ObjectsetCallback(Object rootObject, String path, BiFunction callback)static ObjectsetCallback(Object rootObject, String path, Function callback)abstract voidsetCallback(Object object, BiFunction callback)voidsetCallback(Object object, Function callback)abstract voidsetInt(Object object, int value)abstract voidsetLong(Object object, long value)JSONPathsetReaderContext(JSONReader.Context context)JSONPathsetWriterContext(JSONWriter.Context writerContext)StringtoString()
-
-
-
Constructor Detail
-
JSONPath
protected JSONPath(String path, JSONPath.Feature... features)
-
JSONPath
protected JSONPath(String path, long features)
-
-
Method Detail
-
getParent
public abstract JSONPath getParent()
-
endsWithFilter
public boolean endsWithFilter()
-
isPrevious
public boolean isPrevious()
-
extract
public static Object extract(String json, String path, JSONPath.Feature... features)
-
setCallback
public static Object setCallback(Object rootObject, String path, BiFunction callback)
-
isRef
public abstract boolean isRef()
-
contains
public abstract boolean contains(Object object)
-
createContext
protected JSONReader.Context createContext()
-
extract
public Object extract(byte[] jsonBytes)
-
extract
public abstract Object extract(JSONReader jsonReader)
-
extractScalar
public abstract String extractScalar(JSONReader jsonReader)
-
getReaderContext
public JSONReader.Context getReaderContext()
-
setReaderContext
public JSONPath setReaderContext(JSONReader.Context context)
-
getWriterContext
public JSONWriter.Context getWriterContext()
-
setWriterContext
public JSONPath setWriterContext(JSONWriter.Context writerContext)
-
set
public abstract void set(Object object, Object value, JSONReader.Feature... readerFeatures)
-
setCallback
public abstract void setCallback(Object object, BiFunction callback)
-
setInt
public abstract void setInt(Object object, int value)
-
setLong
public abstract void setLong(Object object, long value)
-
remove
public abstract boolean remove(Object object)
-
extract
public void extract(JSONReader jsonReader, ValueConsumer consumer)
-
extractScalar
public void extractScalar(JSONReader jsonReader, ValueConsumer consumer)
-
extractInt64
public Long extractInt64(JSONReader jsonReader)
-
extractInt64Value
public long extractInt64Value(JSONReader jsonReader)
-
extractInt32
public Integer extractInt32(JSONReader jsonReader)
-
extractInt32Value
public int extractInt32Value(JSONReader jsonReader)
-
compile
@Deprecated public static JSONPath compile(String path)
Deprecated.
-
of
public static JSONPath of(String path, Type type, JSONPath.Feature... features)
-
of
public static JSONPath of(String[] paths, Type[] types)
create multi-path jsonpath- Parameters:
paths- jsonpath arraytypes- item types- Since:
- 2.0.20
-
of
public static JSONPath of(String[] paths, Type[] types, JSONReader.Feature... features)
create multi-path jsonpath- Parameters:
paths- jsonpath arraytypes- item types- Since:
- 2.0.20
-
of
public static JSONPath of(String[] paths, Type[] types, String[] formats, long[] pathFeatures, ZoneId zoneId, JSONReader.Feature... features)
create multi-path jsonpath- Parameters:
paths- jsonpath arraytypes- item typesformats- item formatzoneId- zonedIdfeatures- parse use JSONReader.Features- Since:
- 2.0.20
-
of
public static JSONPath of(String path, JSONPath.Feature... features)
-
-