Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 99523 invoked from network); 2 Feb 2005 11:04:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Feb 2005 11:04:56 -0000 Received: (qmail 45744 invoked by uid 500); 2 Feb 2005 11:04:53 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 45716 invoked by uid 500); 2 Feb 2005 11:04:53 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 45694 invoked by uid 99); 2 Feb 2005 11:04:52 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from ajax-1.apache.org (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 02 Feb 2005 03:04:50 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (8.12.11/8.12.11) with ESMTP id j12B4lDc025140 for ; Wed, 2 Feb 2005 12:04:47 +0100 Received: (from nobody@localhost) by ajax.apache.org (8.12.11/8.12.11/Submit) id j12B4lk8025138; Wed, 2 Feb 2005 12:04:47 +0100 Date: Wed, 2 Feb 2005 12:04:47 +0100 Message-Id: <200502021104.j12B4lk8025138@ajax.apache.org> From: bugzilla@apache.org To: commons-dev@jakarta.apache.org Subject: DO NOT REPLY [Bug 33352] New: - add collection modifiers feature to PropertyUtilsBean. X-Bugzilla-Reason: AssignedTo X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=33352 Summary: add collection modifiers feature to PropertyUtilsBean. Product: Commons Version: unspecified Platform: PC OS/Version: Windows XP Status: NEW Severity: enhancement Priority: P2 Component: Bean Utilities AssignedTo: commons-dev@jakarta.apache.org ReportedBy: marc.dexet@dsi.cnrs.fr There's some java beans who are not lazy ones and who need to modify collection type properties. Ongoing propertyUtilsBean only allows to set indexed property, but not to add or remove items in collection. This is a proposition to add following new features : - propertyUtilsBean.(add | remove )CollectionPropertyValue(Object bean, String name, Object value) Action: (add to | remove from ) bean property name a value. In other words, search a method (add | remove)item(parameterType value) where parameterType.isAssignable(value.class) to add value to item collection, item collection bean property being deduced with a stemmer algo (as in betwixt.DefaultPluralStemmer) from method name and declared by getProperty(bean,name).getClass(); Sample : myPropertyUtilsBean.addCollectionPropertyValue(myBean, "productMap("food").catalog.products", new Product("acmeDogFood", 12)); will use Catalog.addProduct(Product p) to add new Product("acmeDogFood", 12) to inner collection Catalog.products. - PropertyUtilsBean.(add | remove )CollectionPropertyValue(Object bean, String property, String itemName, Object value) Action: (add to | remove from ) bean property name a value. In other words, search a method (add | remove)item(parameterType value) where parameterType.isAssignable(value.class) to add value to item collection, item collection being deduced with a stemmer algo (as in betwixt.DefaultPluralStemmer) from itemName and declared by getProperty(bean,name).getClass(); Sample : myPropertyUtilsBean.addCollectionPropertyValue(myBean, "productMap("food").catalog","product", new Product("acmeDogFood", 12)); will use Catalog.addProduct(Product p) to add new Product("acmeDogFood", 12) to inner Catalog.productList. If there's no Catalog.addProduct(Product p) method, try to invoke Collection.add(Object obj) on Catalog.products. I have yet created in PropertyUtilsBean sub class such feature as demonstrator and unit tests work (for the meantime). Constraints: - Object are to apply java beans specification. - Collection must have readable method ( to be considered as bean property) - adder and remover method have to follow conventions copied from org.apache.commons.betwixt.strategy.DefaultPluralStemmer Matching select in this order for an given itemName or a deduced from method name one: 1. get itemName+"s" :("items") 2. if ( itemName ends with "y" ) 1. get itemName+"es" (no sample, my english is too poor !) 2. get substitute itemName ending with "ies" ("baby" => "babies") 3. get itemName + "List" 4. get itemName + "Set" 5. get itemName + "Collection 6. Browse propertyMap to get a property starting with itemName, as "itemBag". If there's several property matching later, select the longuest property name : "itemBagCollection" instead of "itemBag" - method selection : If two methods match this upper requirements (name (add | remove)Item(ParmType value) and parameterType.isAssignable(value.class)) , first method matching is selected. Methods are ordered following min "distance" metric : - "Distance" metric is the base on public int getDistance(Class c) { Class superclass = c.getSuperclass(); int distance = 0; while ( superclass != null ) { superclass = superclass.getSuperclass(); distance ++; } return distance; } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org