Return-Path: X-Original-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B2AB89840 for ; Wed, 9 May 2012 12:16:38 +0000 (UTC) Received: (qmail 44836 invoked by uid 500); 9 May 2012 12:16:38 -0000 Delivered-To: apmail-jackrabbit-oak-commits-archive@jackrabbit.apache.org Received: (qmail 44812 invoked by uid 500); 9 May 2012 12:16:38 -0000 Mailing-List: contact oak-commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-commits@jackrabbit.apache.org Delivered-To: mailing list oak-commits@jackrabbit.apache.org Received: (qmail 44801 invoked by uid 99); 9 May 2012 12:16:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 12:16:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 12:16:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CEC3F238896F; Wed, 9 May 2012 12:16:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1336126 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueMapper.java Date: Wed, 09 May 2012 12:16:16 -0000 To: oak-commits@jackrabbit.apache.org From: angela@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120509121616.CEC3F238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 TYPE2HINT = new HashMap(); private static final Map HINT2TYPE = new HashMap(); - 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) == ':'; }