001
014
015 package com.liferay.portal.spring.aop;
016
017
020 public class ServiceBeanMatcher implements BeanMatcher {
021
022 public ServiceBeanMatcher() {
023 this(false);
024 }
025
026 public ServiceBeanMatcher(boolean counterMatcher) {
027 _counterMatcher = counterMatcher;
028 }
029
030 @Override
031 public boolean match(Class<?> beanClass, String beanName) {
032 if (_counterMatcher) {
033 return beanName.equals(_COUNTER_SERVICE_BEAN_NAME);
034 }
035 else if (!beanName.equals(_COUNTER_SERVICE_BEAN_NAME) &&
036 beanName.endsWith(_SERVICE_SUFFIX)) {
037
038 return true;
039 }
040
041 return false;
042 }
043
044 private static final String _COUNTER_SERVICE_BEAN_NAME =
045 "com.liferay.counter.service.CounterLocalService";
046
047 private static final String _SERVICE_SUFFIX = "Service";
048
049 private boolean _counterMatcher;
050
051 }