public class Utils extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
ARRAY_ELEMENT_INDEX |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static void |
consumeFully(org.apache.http.HttpEntity entity)
If the passed entity has content, make sure it is fully
read and closed.
|
static Object |
fromJSON(byte[] utf8) |
static Object |
fromJSON(InputStream is) |
static Object |
fromJSONResource(String resourceName) |
static Object |
fromJSONString(String json) |
static Collection |
getDeepCopy(Collection c,
int maxDepth,
boolean mutable) |
static Collection |
getDeepCopy(Collection c,
int maxDepth,
boolean mutable,
boolean sorted) |
static Map |
getDeepCopy(Map map,
int maxDepth) |
static Map |
getDeepCopy(Map map,
int maxDepth,
boolean mutable) |
static Map |
getDeepCopy(Map map,
int maxDepth,
boolean mutable,
boolean sorted) |
static Map<String,Object> |
getJson(SolrZkClient zkClient,
String path,
boolean retryOnConnLoss)
Assumes data in ZooKeeper is a JSON string, deserializes it and returns as a Map
|
static org.noggit.JSONParser |
getJSONParser(Reader reader) |
static Object |
getObjectByPath(Object root,
boolean onlyPrimitive,
List<String> hierarchy) |
static Object |
getObjectByPath(Object root,
boolean onlyPrimitive,
String hierarchy) |
static SpecProvider |
getSpec(String name) |
static Map<String,Object> |
makeMap(boolean skipNulls,
Object... keyVals) |
static Map<String,Object> |
makeMap(Object... keyVals) |
static boolean |
setObjectByPath(Object root,
List<String> hierarchy,
Object value) |
static boolean |
setObjectByPath(Object root,
String hierarchy,
Object value) |
static InputStream |
toJavabin(Object o) |
static byte[] |
toJSON(Object o) |
static String |
toJSONString(Object o) |
static byte[] |
toUTF8(org.noggit.CharArr out) |
public static final Pattern ARRAY_ELEMENT_INDEX
public static InputStream toJavabin(Object o) throws IOException
IOException
public static Collection getDeepCopy(Collection c, int maxDepth, boolean mutable)
public static Collection getDeepCopy(Collection c, int maxDepth, boolean mutable, boolean sorted)
public static byte[] toJSON(Object o)
public static byte[] toUTF8(org.noggit.CharArr out)
public static Object fromJSON(byte[] utf8)
public static Object fromJSON(InputStream is)
public static org.noggit.JSONParser getJSONParser(Reader reader)
public static Object getObjectByPath(Object root, boolean onlyPrimitive, String hierarchy)
public static boolean setObjectByPath(Object root, List<String> hierarchy, Object value)
public static Object getObjectByPath(Object root, boolean onlyPrimitive, List<String> hierarchy)
public static void consumeFully(org.apache.http.HttpEntity entity)
entity
- to consume or nullpublic static Map<String,Object> getJson(SolrZkClient zkClient, String path, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
zkClient
- the zookeeper clientpath
- the path to the znode being readretryOnConnLoss
- whether to retry the operation automatically on connection loss, see ZkCmdExecutor.retryOperation(ZkOperation)
org.apache.zookeeper.KeeperException
InterruptedException
public static SpecProvider getSpec(String name)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.