You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2012/05/09 14:16:16 UTC
svn commit: r1336126 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java
Author: angela
Date: Wed May 9 12:16:16 2012
New Revision: 1336126
URL: http://svn.apache.org/viewvc?rev=1336126&view=rev
Log:
javadoc
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java?rev=1336126&r1=1336125&r2=1336126&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java Wed May 9 12:16:16 2012
@@ -37,9 +37,6 @@ class CoreValueMapper {
private static final Map<Integer, String> TYPE2HINT = new HashMap<Integer, String>();
private static final Map<String, Integer> HINT2TYPE = new HashMap<String, Integer>();
- private CoreValueMapper() {
- }
-
static {
for (int type = PropertyType.UNDEFINED; type <= PropertyType.DECIMAL; type++) {
String hint = PropertyType.nameFromValue(type).substring(0,3).toLowerCase();
@@ -49,6 +46,12 @@ class CoreValueMapper {
}
/**
+ * Avoid instantiation.
+ */
+ private CoreValueMapper() {
+ }
+
+ /**
* Returns the internal JSON representation of the specified {@code value}
* that is stored in the MicroKernel. All property types that are not
* reflected as JSON types are converted to strings and get a type prefix.
@@ -87,7 +90,7 @@ class CoreValueMapper {
* Returns an JSON array containing the JSON representation of the
* specified values.
*
- * @param values
+ * @param values The values to be converted to a JSON array.
* @return JSON array containing the JSON representation of the specified
* values.
* @see #toJsonValue(org.apache.jackrabbit.oak.api.CoreValue)
@@ -154,6 +157,16 @@ class CoreValueMapper {
return values;
}
+ //--------------------------------------------------------------------------
+ /**
+ * Build the JSON representation of the specified value consisting of
+ * a leading type hint, followed by ':" and the String conversion of this
+ * value.
+ *
+ * @param value The value to be serialized.
+ * @return The string representation of the specified value including a
+ * leading type hint.
+ */
private static String buildJsonStringWithHint(CoreValue value) {
StringBuilder sb = new StringBuilder();
sb.append(TYPE2HINT.get(value.getType()));
@@ -162,6 +175,15 @@ class CoreValueMapper {
return JsonBuilder.encode(sb.toString());
}
+ /**
+ * Returns {@code true} if the specified JSON String represents a value
+ * serialization that includes a leading type hint.
+ *
+ * @param jsonString The JSON String representation of a {@code CoreValue}
+ * @return {@code true} if the {@code jsonString} starts with a type
+ * hint; {@code false} otherwise.
+ * @see #buildJsonStringWithHint(org.apache.jackrabbit.oak.api.CoreValue)
+ */
private static boolean startsWithHint(String jsonString) {
return jsonString.length() >= 4 && jsonString.charAt(3) == ':';
}