Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 42660200B59 for ; Mon, 8 Aug 2016 15:17:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 41162160AB9; Mon, 8 Aug 2016 13:17:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B7312160A91 for ; Mon, 8 Aug 2016 15:17:16 +0200 (CEST) Received: (qmail 43525 invoked by uid 500); 8 Aug 2016 13:17:16 -0000 Mailing-List: contact commits-help@juneau.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@juneau.incubator.apache.org Delivered-To: mailing list commits@juneau.incubator.apache.org Received: (qmail 43516 invoked by uid 99); 8 Aug 2016 13:17:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2016 13:17:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5F211C8583 for ; Mon, 8 Aug 2016 13:17:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.474 X-Spam-Level: X-Spam-Status: No, score=-4.474 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.454] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ZzsYAJp4rG5Q for ; Mon, 8 Aug 2016 13:17:08 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 9D80D60E66 for ; Mon, 8 Aug 2016 13:16:52 +0000 (UTC) Received: (qmail 41581 invoked by uid 99); 8 Aug 2016 13:16:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2016 13:16:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0B5FFE1021; Mon, 8 Aug 2016 13:16:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jamesbognar@apache.org To: commits@juneau.incubator.apache.org Date: Mon, 08 Aug 2016 13:17:22 -0000 Message-Id: <42364e6f6659432da28c92adef1f1ea7@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [33/51] [partial] incubator-juneau-website git commit: Website updates. archived-at: Mon, 08 Aug 2016 13:17:19 -0000 http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/b49380eb/content/api-documentation/org/apache/juneau/ObjectMap.html ---------------------------------------------------------------------- diff --git a/content/api-documentation/org/apache/juneau/ObjectMap.html b/content/api-documentation/org/apache/juneau/ObjectMap.html deleted file mode 100644 index 6c0f288..0000000 --- a/content/api-documentation/org/apache/juneau/ObjectMap.html +++ /dev/null @@ -1,2409 +0,0 @@ - - - - - -ObjectMap (Juneau) - - - - - - - - - - - -
-
org.apache.juneau
-

Class ObjectMap

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, Cloneable, Map<String,Object>
    -
    -
    -
    Direct Known Subclasses:
    -
    Args, ManifestFile
    -
    -
    -
    -
    public class ObjectMap
    -extends LinkedHashMap<String,Object>
    -
    Java implementation of a JSON object. -

    - An extension of LinkedHashMap, so all methods available in that class are also available - to this class. -

    - Note that the use of this class is optional. The serializers will accept any objects that implement - the Map interface. But this class provides some useful additional functionality - when working with JSON models constructed from Java Collections Framework objects. For example, a - constructor is provided for converting a JSON object string directly into a Map. It also contains - accessor methods for to avoid common typecasting when accessing elements in a list. - -

    Examples
    -

    - // Construct an empty Map - Map m = new ObjectMap(); - - // Construct a Map from JSON - String json = "{a:'A',b:{c:'C',d:123}}"; - m = new ObjectMap(json); - - // Construct a Map using the append method - m = new ObjectMap().append("foo","x").append("bar",123).append("baz",true); - - // Construct a Map from XML generated by XmlSerializer - String xml = "<object><a type='string'>A</a><b type='object'><c type='string'>C</c><d type='number'>123</d></b></object>"; - m = new ObjectMap(xml, DataFormat.XML); - m = (Map)XmlParser.DEFAULT.parse(xml); // Equivalent - m = (Map)XmlParser.DEFAULT.parse(Object.class, xml); // Equivalent - m = XmlParser.DEFAULT.parse(Map.class, xml); // Equivalent - m = XmlParser.DEFAULT.parse(ObjectMap.class, xml); // Equivalent - - // Construct a Map from a URL GET parameter string generated by UrlEncodingParser - String urlParams = "?a='A'&b={c:'C',d:123}"; - m = new ObjectMap(urlParams, DataFormat.URLPARAM); - m = (Map)UrlEncodingParser.DEFAULT.parse(Object.class, xml); // Equivalent - m = UrlEncodingParser.DEFAULT.parse(Map.class, xml); // Equivalent - m = UrlEncodingParser.DEFAULT.parse(ObjectMap.class, xml); // Equivalent - - // Construct JSON from ObjectMap - m = new ObjectMap("{foo:'bar'},{baz:[123,true]}"); - json = m.toString(); // Produces "{foo:'bar'},{baz:[123,true]}" - json = m.toString(JsonSerializer.DEFAULT_CONDENSED); // Equivalent - json = JsonSerializer.DEFAULT_CONDENSED.serialize(m); // Equivalent - - // Get a map entry as an Integer - m = new ObjectMap("{foo:123}"); - Integer i = m.getInt("foo"); - i = m.get(Integer.class, "foo"); // Equivalent - - // Get a map entry as a Float - m = new ObjectMap("{foo:123}"); - Float f = m.getFloat("foo"); - f = m.get(Float.class, "foo"); // Equivalent - - // Same as above, except converted to a String - m = new ObjectMap("{foo:123}"); - String s = m.getString("foo"); // Returns "123" - s = m.get(String.class, "foo"); // Equivalent - - // Get one of the entries in the list as a bean (converted to a bean if it isn't already one) - m = new ObjectMap("{person:{name:'John Smith',age:45}}"); - Person p = m.get(Person.class, "person"); - - // Add an inner map - ObjectMap m1 = new ObjectMap("{a:1}"); - ObjectMap m2 = new ObjectMap("{b:2}").setInner(m1); - int a = m2.getInt("a"); // a == 1 -

    -

    - This class is not thread safe. -

    -
    -
    Author:
    -
    James Bognar (james.bognar@salesforce.com)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ObjectMap

        -
        public ObjectMap(CharSequence s,
        -                 Parser p)
        -          throws ParseException
        -
        Construct an ObjectMap directly from a string using the specified parser.
        -
        -
        Parameters:
        -
        s - The string being parsed.
        -
        p - The parser to use to parse the input.
        -
        Throws:
        -
        ParseException - If the input contains a syntax error or is malformed.
        -
        -
      • -
      - - - -
        -
      • -

        ObjectMap

        -
        public ObjectMap(CharSequence s)
        -          throws ParseException
        -
        Shortcut for new ObjectMap(string,JsonParser.DEFAULT);
        -
        -
        Parameters:
        -
        s - The JSON text to parse.
        -
        Throws:
        -
        ParseException - If the input contains a syntax error or is malformed.
        -
        -
      • -
      - - - -
        -
      • -

        ObjectMap

        -
        public ObjectMap(Reader r,
        -                 Parser p)
        -          throws ParseException,
        -                 IOException
        -
        Construct an ObjectMap directly from a reader using the specified parser.
        -
        -
        Parameters:
        -
        r - The reader to read from. The reader will be wrapped in a BufferedReader if it isn't already.
        -
        p - The parser to use to parse the input.
        -
        Throws:
        -
        ParseException - If the input contains a syntax error or is malformed.
        -
        IOException - If a problem occurred trying to read from the reader.
        -
        -
      • -
      - - - -
        -
      • -

        ObjectMap

        -
        public ObjectMap(Reader r)
        -          throws ParseException,
        -                 IOException
        -
        Shortcut for new ObjectMap(reader, JsonParser.DEFAULT).
        -
        -
        Parameters:
        -
        r - The reader to read from. The reader will be wrapped in a BufferedReader if it isn't already.
        -
        Throws:
        -
        ParseException - If the input contains a syntax error or is malformed.
        -
        IOException - If a problem occurred trying to read from the reader.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        ObjectMap

        -
        public ObjectMap(BeanContext beanContext)
        -
        Construct an empty JSON object (i.e. an empty LinkedHashMap) with the specified bean context.
        -
        -
        Parameters:
        -
        beanContext - The bean context to use for creating beans.
        -
        -
      • -
      - - - -
        -
      • -

        ObjectMap

        -
        public ObjectMap(Map<?,?> m)
        -
        Construct a JSON object and fill it with the contents from the specified Map.
        -
        -
        Parameters:
        -
        m - The map whose entries will be copied into this map.
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setInner

        -
        public ObjectMap setInner(ObjectMap inner)
        -
        Set an inner map in this map to allow for chained get calls. -

        - If get(Object) returns null, then get(Object) will be called on the inner map. -

        - In addition to providing the ability to chain maps, this method also provides the ability - to wrap an existing map inside another map so that you can add entries to the outer - map without affecting the values on the inner map. -

        - ObjectMap m1 = new ObjectMap("{foo:1}"); - ObjectMap m2 = new ObjectMap().setInner(m1); - m2.put("foo", 2); // Overwrite the entry - int foo1 = m1.getInt("foo"); // foo1 == 1 - int foo2 = m2.getInt("foo"); // foo2 == 2 -

        -
        -
        Parameters:
        -
        inner - The inner map. - Can be null to remove the inner map from an existing map.
        -
        Returns:
        -
        This object (for method chaining).
        -
        -
      • -
      - - - -
        -
      • -

        findKeyIgnoreCase

        -
        public String findKeyIgnoreCase(String key)
        -
        Searches for the specified key in this map ignoring case.
        -
        -
        Parameters:
        -
        key - The key to search for. For performance reasons, it's preferrable that the key be all lowercase.
        -
        Returns:
        -
        The key, or null if map does not contain this key.
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setBeanContext

        -
        public