001package org.andromda.cartridges.spring.metafacades; 002 003import org.andromda.utils.StringUtilsHelper; 004import org.apache.commons.lang.StringUtils; 005 006/** 007 * MetafacadeLogic implementation for org.andromda.cartridges.spring.metafacades.SpringTopic. 008 * 009 * @see org.andromda.cartridges.spring.metafacades.SpringTopic 010 */ 011public class SpringTopicLogicImpl 012 extends SpringTopicLogic 013{ 014 private static final long serialVersionUID = 34L; 015 /** 016 * Public constructor for SpringTopicLogicImpl 017 * @param metaObject 018 * @param context 019 * @see org.andromda.cartridges.spring.metafacades.SpringTopic 020 */ 021 public SpringTopicLogicImpl (Object metaObject, String context) 022 { 023 super (metaObject, context); 024 } 025 026 /** 027 * @return lowerCamelCaseName(this.getName()) 028 * @see org.andromda.cartridges.spring.metafacades.SpringTopic#getBeanName() 029 */ 030 protected String handleGetBeanName() 031 { 032 return StringUtilsHelper.lowerCamelCaseName(this.getName()); 033 } 034 035 /** 036 * @return lowerCamelCaseName(this.getTemplatePattern().replaceAll("\\{0\\}", getName())) 037 * @see org.andromda.cartridges.spring.metafacades.SpringTopic#getTemplateBeanName() 038 */ 039 protected String handleGetTemplateBeanName() 040 { 041 return StringUtilsHelper.lowerCamelCaseName(this.getTemplatePattern().replaceAll( 042 "\\{0\\}", 043 this.getName())); 044 } 045 046 /** 047 * @return "get" + StringUtilsHelper.capitalize(this.getTemplateBeanName()) 048 * @see org.andromda.cartridges.spring.metafacades.SpringTopic#getTemplateGetterName() 049 */ 050 protected String handleGetTemplateGetterName() 051 { 052 return "get" + StringUtils.capitalize(this.getTemplateBeanName()); 053 } 054 055 /** 056 * @return "set" + StringUtilsHelper.capitalize(this.getTemplateBeanName()) 057 * @see org.andromda.cartridges.spring.metafacades.SpringTopic#getTemplateSetterName() 058 */ 059 protected String handleGetTemplateSetterName() 060 { 061 return "set" + StringUtils.capitalize(this.getTemplateBeanName()); 062 } 063 064 /** 065 * Gets the value of the {@link SpringGlobals#JMS_DESTINATION_TEMPLATE_PATTERN} 066 * 067 * @return the template name pattern. 068 */ 069 private String getTemplatePattern() 070 { 071 return String.valueOf(this.getConfiguredProperty(SpringGlobals.JMS_DESTINATION_TEMPLATE_PATTERN)); 072 } 073 074}