Saturday, August 10, 2013

using generic types in response entities with jersey 2.0 client

a special type for a special case

Java Generics are great, but they can truly be a beast to deal with once you start dealing with Class references that can't carry a generic type with them. In the case of using Jersey 2.0's client API, you may come into a situation where a resource returns a generified type, such as List<Message>. You can't map the entity to List<Message>.class, but thankfully Jersey has a very easy way to handle this case:

That's it! Just binding it to GenericType<List<Message>>(){} takes care of it!

Source: http://jersey.576304.n2.nabble.com/How-can-I-parse-a-java-util-List-lt-gt-Is-it-supported-by-the-Jersey-client-td2300852.html

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. an excellent first teddy choice for your baby is Blanket teddy bear. Blanket teddy bears are small fleece blankets that have a teddy bear attached from the arms up. Famous teddy bears

    ReplyDelete
  3. All about the inner bear - what materials are used to make our favourite cuddly friends? This article takes a look at both today's teddies and those of bygone days. Famous teddy bears

    ReplyDelete
  4. The original undergarment blended the camisole and knickers in one piece.Teddyway Deutschland

    ReplyDelete
  5. optical network unit price
    Optical network generally refers to a wide area network (WAN), a metropolitan area network (WAN) or a newly built large area network (LAN) that uses optical fibers as the main transmission medium. Optical network is usually said to be optical fiber network, its transmission medium is optical fiber. The network cable we usually use is twisted-pair. In this kind of network, the data signal is carried by electricity, and the 0 and 1 are distinguished by the voltage. In an optical network, the data is carried by a laser, which emits different intensities of light to distinguish zeros from ones.

    ReplyDelete