View Javadoc
1 /*
2 * PointcutCfgImpl.java
3 * Created on September 4, 2003
4 *
5 * The Blues Framework - A lightweight application framework
6 * Copyright (C) 2003 Lonnie Pryor
7 * http://blues.lonniepryor.com
8 *
9 * This library is free software; you can redistribute it and/or modify it under the
10 * terms of the GNU Lesser General Public License as published by the Free Software
11 * Foundation; either version 2.1 of the License, or (at your option) any later
12 * version.
13 *
14 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
16 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License along
19 * with this library; if not, write to:
20 *
21 * The Free Software Foundation, Inc.
22 * 59 Temple Place, Suite 330
23 * Boston, MA 02111-1307 USA
24 *
25 */
26 package com.lonniepryor.blues.cfg;
27
28 import com.lonniepryor.blues.aop.Pointcut;
29
30 /***
31 * Generic implementation of {@link PointcutCfg}.
32 *
33 * @author Lonnie Pryor
34 * @version $Revision: 1.1 $
35 */
36 public class PointcutCfgImpl implements PointcutCfg, TextContainer, Verifiable {
37 /*** The name of this pointcut. */
38 private String name = null;
39 /*** The parsed specification object. */
40 private Pointcut specification = null;
41 /*** The text of the pointcut pattern expression. */
42 private StringBuffer definition = new StringBuffer();
43
44 /***
45 * Creates a new PointcutCfgImpl object.
46 */
47 public PointcutCfgImpl () {
48 }
49
50 /***
51 * Sets the name of this pointcut.
52 *
53 * @param name The name of this pointcut.
54 */
55 public void setName (String name) {
56 this.name = name;
57 }
58
59 /* (non-Javadoc)
60 * @see com.lonniepryor.blues.cfg.TextContainer#appendText(char[], int, int)
61 */
62 public void appendText (char[] characters, int startIndex, int textLength) {
63 definition.append(characters, startIndex, textLength);
64 }
65
66 /* (non-Javadoc)
67 * @see com.lonniepryor.blues.cfg.Verifiable#verify()
68 */
69 public void verify () {
70 if (name == null)
71 throw new IllegalStateException("Null name");
72 if (name.length() == 0)
73 throw new IllegalStateException("Empty name");
74 specification = Pointcut.parseExpression(definition.toString());
75 }
76
77 /* (non-Javadoc)
78 * @see com.lonniepryor.blues.cfg.PointcutCfg#getName()
79 */
80 public String getName () {
81 return name;
82 }
83
84 /* (non-Javadoc)
85 * @see com.lonniepryor.blues.cfg.PointcutCfg#getPointcut()
86 */
87 public Pointcut getPointcut () {
88 return specification;
89 }
90 }
This page was automatically generated by Maven