View Javadoc

1   /*
2    * Copyright 2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  package org.apache.commons.betwixt.io.read;
17  
18  import org.apache.commons.betwixt.expression.Updater;
19  import org.xml.sax.Attributes;
20  
21  /*** 
22    * Action binds a simple type.
23    * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
24    * @version $Revision: 1.2 $
25    */
26  public class SimpleTypeBindAction extends MappingAction.Base {
27  
28      public static final SimpleTypeBindAction INSTANCE = new SimpleTypeBindAction();
29  
30      
31  
32      public void body(String text, ReadContext context) throws Exception {
33          // add dyna-bean support!
34          // probably refactoring needed
35          Updater updater = context.getCurrentUpdater();
36          if (updater != null)
37          {
38              updater.update(context, text);
39          } else {
40              if (context.getLog().isDebugEnabled())
41              {
42                  context.getLog().debug("No updater for simple type '" + context.getCurrentElement() + "'");
43              }
44          }
45      }
46      
47      public MappingAction next(
48          String namespace,
49          String name,
50          Attributes attributes,
51          ReadContext context)
52          throws Exception {
53          return MappingAction.IGNORE;
54      }
55  
56  }