Package com.cedarsoftware.io
Class JsonValue
java.lang.Object
com.cedarsoftware.io.JsonValue
- Direct Known Subclasses:
JsonObject
This class is the parent class for all parsed JSON objects, arrays, or primitive values.
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
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
License
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
static final String
protected long
static final String
protected boolean
static final String
static final String
protected int
static final String
protected Long
static final String
static final String
static final String
static final String
static final String
protected Object
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clears the type resolution cache.int
getCol()
long
getId()
Class<?>
Deprecated.This method will be removed in a future version.int
getLine()
static int
Gets the current maximum size of the type resolution cache.Class<?>
getType()
static int
Gets the current number of entries in the type resolution cache.boolean
hasId()
A JsonObject starts off with an id of -1.abstract boolean
isArray()
boolean
boolean
void
setFinishedTarget
(Object o, boolean isFinished) void
setId
(long id) void
setJavaType
(Class<?> type) Deprecated.This method will be removed in a future version.static void
setMaxTypeResolutionCacheSize
(int cacheSize) Sets the maximum size of the type resolution cache.void
setReferenceId
(Long id) void
Sets the type on this JsonValue.
-
Field Details
-
KEYS
- See Also:
-
ITEMS
- See Also:
-
ID
- See Also:
-
REF
- See Also:
-
TYPE
- See Also:
-
ENUM
- See Also:
-
SHORT_TYPE
- See Also:
-
SHORT_ITEMS
- See Also:
-
SHORT_KEYS
- See Also:
-
SHORT_ID
- See Also:
-
SHORT_REF
- See Also:
-
VALUE
- See Also:
-
target
-
isFinished
protected boolean isFinished -
id
protected long id -
refId
-
line
protected int line -
col
protected int col
-
-
Constructor Details
-
JsonValue
public JsonValue()
-
-
Method Details
-
getLine
public int getLine() -
getCol
public int getCol() -
isReference
public boolean isReference() -
getReferenceId
-
setReferenceId
-
isFinished
public boolean isFinished() -
setFinished
public void setFinished() -
setTarget
-
setFinishedTarget
-
getTarget
-
isArray
public abstract boolean isArray() -
getType
-
setType
Sets the type on this JsonValue. Uses a cache to avoid repeated resolution checks for the same types. -
getRawType
-
getRawTypeName
-
getId
public long getId() -
setId
public void setId(long id) -
hasId
public boolean hasId()A JsonObject starts off with an id of -1. Also, an id of 0 is not considered a valid id. It must be 1 or greater. JsonWriter utilizes this fact. -
setJavaType
Deprecated.This method will be removed in a future version. Use setType() instead.Do not use this method. Call setType() instead. -
getJavaType
Deprecated.This method will be removed in a future version. Use getRawType() instead.Do not use this method. Call getType() or getRawType() instead. -
setMaxTypeResolutionCacheSize
public static void setMaxTypeResolutionCacheSize(int cacheSize) Sets the maximum size of the type resolution cache. This affects all JsonValue instances as the cache is static.- Parameters:
cacheSize
- int maximum number of entries to cache. Must be at least 1.- Throws:
JsonIoException
- if cacheSize is less than 1
-
getMaxTypeResolutionCacheSize
public static int getMaxTypeResolutionCacheSize()Gets the current maximum size of the type resolution cache.- Returns:
- int current maximum cache size
-
getTypeResolutionCacheSize
public static int getTypeResolutionCacheSize()Gets the current number of entries in the type resolution cache.- Returns:
- int current cache size
-
clearTypeResolutionCache
public static void clearTypeResolutionCache()Clears the type resolution cache. This may be useful for memory management in long-running applications.
-