From owner-freebsd-questions@FreeBSD.ORG Fri Dec 26 14:39:55 2008 Return-Path: Delivered-To: questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37EF81065677 for ; Fri, 26 Dec 2008 14:39:55 +0000 (UTC) (envelope-from frankstaals@gmx.net) Received: from edu-smtp-01.edutel.nl (edu-smtp-01.edutel.nl [88.159.1.221]) by mx1.freebsd.org (Postfix) with ESMTP id 01F7C8FC16 for ; Fri, 26 Dec 2008 14:39:49 +0000 (UTC) (envelope-from frankstaals@gmx.net) Received: from Rena.FStaals.net (unknown [88.159.208.104]) by edu-smtp-01.edutel.nl (Postfix) with ESMTP id 7B0C26808A for ; Fri, 26 Dec 2008 15:20:57 +0100 (CET) Message-ID: <4954E849.6020000@gmx.net> Date: Fri, 26 Dec 2008 15:20:57 +0100 From: Frank Staals User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: questions@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Off-topic: Java Reflection/Generics/Collections question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Dec 2008 14:39:55 -0000 Not realy a FreeBSD-specific question but I was not sure where I could find what I was looking for elseware (Googling did not manage to dig up much info): The problem: I want to set the type of objects some Collection object holds on runtime. In other wors I have an object C with: C extends AbstractCollection, I have the Class object T specifying what type of objects C should hold and I have a method M which takes a C as an argument. I made a generic version of C (without the type) and now I have to set it so it can only carry objects of type T. Does anyone know how to do this ? Information in programming style: C extends AbstractCollection myCollection; Class itemType; public void myMethod(C myCollectionArgument) How do I convert myCollection from being a C to a C on runtime so I can call myMethod(myCollection) ? I hope the explanation of my problem makes sense and someone can help me. Regards, -- - Frank