From kato-spec-return-250-apmail-incubator-kato-spec-archive=incubator.apache.org@incubator.apache.org Tue Oct 13 20:42:16 2009 Return-Path: Delivered-To: apmail-incubator-kato-spec-archive@minotaur.apache.org Received: (qmail 55740 invoked from network); 13 Oct 2009 20:42:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Oct 2009 20:42:16 -0000 Received: (qmail 56959 invoked by uid 500); 13 Oct 2009 20:42:16 -0000 Delivered-To: apmail-incubator-kato-spec-archive@incubator.apache.org Received: (qmail 56923 invoked by uid 500); 13 Oct 2009 20:42:16 -0000 Mailing-List: contact kato-spec-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: kato-spec@incubator.apache.org Delivered-To: mailing list kato-spec@incubator.apache.org Received: (qmail 56913 invoked by uid 99); 13 Oct 2009 20:42:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2009 20:42:16 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [212.227.17.10] (HELO moutng.kundenserver.de) (212.227.17.10) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2009 20:42:05 +0000 Received: from [192.168.0.14] (87.115.58.96.plusnet.pcl-ag01.dyn.plus.net [87.115.58.96]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MFiib-1N1MZZ22c9-00FBkf; Tue, 13 Oct 2009 22:41:44 +0200 Message-ID: <4AD4E608.9000108@stoo.me.uk> Date: Tue, 13 Oct 2009 21:41:44 +0100 From: Stuart Monteith User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090825 SeaMonkey/1.1.18 MIME-Version: 1.0 To: kato-spec@incubator.apache.org Subject: Inner classes, Enums Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX18AXMzuFNpc7fwZs2BOpEPuPU2BXnGCtlkPxs8 IhTfyV7KxpOBQn9rCO9+ImwVlkM7hB+UZYL66H01mfyP0lLkF3 N8lS1fgYbmaZCjbtEXI+KwpBf9Rez/a X-Virus-Checked: Checked by ClamAV on apache.org Hi, I've noticed that we don't really have support for inner classes or enums in the API or any query languages that have been suggested. For enums we'd want to do comparisons where a field is compared against an enum type. An enum just now will appear as a class subclassing java.lang.Enum with a modifier including "0x4000" - this, incidentally, doesn't appear in "java.lang.reflect.Modifier", which the API depends on. For example, "SELECT x FROM instances WHERE x.class=com.example.diy.Paint AND x.colour = RED" Where public com.example.diy.Paint { Colour colour; } public enum Colour { RED, GREEN, FUSCHIA, MAGNOLIA, WHITE } In the Java application API, it might be worth having: public interface JavaEnum extends JavaClass { EnumConstant[] getConstants(); EnumConstant getConstant(String name); } public interface EnumConstant extends JavaObject { public String getName(); public int getOrdinal(); public JavaEnum getType(); } These would correspond with Enums and their types, extending JavaClass and JavaObject, and would still allow more sophisticated, non-standard enums to be queried like other classes and objects. So you could do: EnumType terry=xxxx; if ( ((JavaObject)character).equals(terry.getConstant("June")) ) // Do something interesting. } Now, inner classes.. The relationship between classes and their inner classes isn't exposed by the API. I'm not sure how to judge how important that is, but it might be important for field value retrieval and querying. java.lang.Class provides the following methods: Class getDeclaringClass() Class getEnclosingClass() Class getEnclosingMethod() boolean isAnonymousClass() boolean isLocalClass() boolean isMemberClass() Which could be conceivably be duplicated within JavaClass. For querying, say: public class A { int aNumber = 2; public class B { int anotherNumber = 5; public class C { String inDepth = 18; } } } Given an instance of A$B$C, should we allow querying to allow: WHERE x.anotherNumber = 5 when x is A$B$C ? Regards, Stuart Regards, Stuart -- Stuart Monteith http://blog.stoo.me.uk/