Return-Path: Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: (qmail 44562 invoked from network); 13 Aug 2009 09:49:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Aug 2009 09:49:32 -0000 Received: (qmail 25167 invoked by uid 500); 13 Aug 2009 09:49:38 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 25145 invoked by uid 500); 13 Aug 2009 09:49:38 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 25089 invoked by uid 99); 13 Aug 2009 09:49:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 09:49:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 09:49:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C3A85234C004 for ; Thu, 13 Aug 2009 02:49:14 -0700 (PDT) Message-ID: <974341863.1250156954787.JavaMail.jira@brutus> Date: Thu, 13 Aug 2009 02:49:14 -0700 (PDT) From: "Jeremias Maerki (JIRA)" To: commits@cayenne.apache.org Subject: [jira] Updated: (CAY-1256) [PATCH] Easily subclassable ExtendedEnumType for reusing an existing Enum In-Reply-To: <316595462.1250156714830.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CAY-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jeremias Maerki updated CAY-1256: --------------------------------- Attachment: EasilySubclassableExtendedEnumType.diff > [PATCH] Easily subclassable ExtendedEnumType for reusing an existing Enum > ------------------------------------------------------------------------- > > Key: CAY-1256 > URL: https://issues.apache.org/jira/browse/CAY-1256 > Project: Cayenne > Issue Type: Improvement > Components: Cayenne Core Library > Reporter: Jeremias Maerki > Attachments: EasilySubclassableExtendedEnumType.diff > > > I've had this enum class that has character codes that I use in a CHAR(1) field. > public enum Status { > NEW('N'), PENDING('P'), CANCELLED('X'), CLOSED('C'); > [..] > I didn't want that enum class to introduce a dependency on Cayenne (through the ExtendedEnumeration interface. So I changed ExtendedEnumType a bit so you can support that enum class with just a few lines of code and without using ExtendedEnumeration. > Please see the patch for an example. I've written a test case for this although this just covers the materialization. > In the application code I can now simply do this to register the type: > node.getAdapter().getExtendedTypes().registerType(new StatusExtendedEnumType()); > (my StatusExtendedEnumType is basically the same as the MockEnumWithCodeEnumType in the patch) > I hope you find this useful, too. Patch is against Cayenne Trunk. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.