1 /*
2 * Copyright (C) 2002 Carsten Krebs (Team-Konzept GmbH & Co.KG)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 package com.teamkonzept.dom4jb.beans;
19
20 import java.beans.PropertyDescriptor;
21 import java.lang.reflect.InvocationTargetException;
22
23 import com.teamkonzept.dom4jb.DOM4JBException;
24 import com.teamkonzept.dom4jb.schema.DataDescriptor;
25
26 public abstract class SimpleProperty extends Property {
27
28 protected SimpleProperty() {
29 /* NOP */
30 }
31
32 public SimpleProperty(final PropertyDescriptor property) {
33 super(property);
34 }
35
36 public final String getValue(final Object bean) {
37 try {
38 final Object obj = getObject(bean);
39 return getDescriptor(obj).getValue(obj);
40 } catch (IllegalAccessException e) {
41 throw new DOM4JBException(e);
42 } catch (InvocationTargetException e) {
43 throw new DOM4JBException(e);
44 }
45 }
46
47 /***
48 * Liefert den Gruppendeskriptor, welcher die Property beschreibt.
49 */
50 protected DataDescriptor getDescriptor(final Object obj) {
51 return DataDescriptor.STRING;
52 }
53 }
This page was automatically generated by Maven