001: /*
002: * ============================================================================
003: * GNU Lesser General Public License
004: * ============================================================================
005: *
006: * JasperReports - Free Java report-generating library.
007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * JasperSoft Corporation
024: * 303 Second Street, Suite 450 North
025: * San Francisco, CA 94107
026: * http://www.jaspersoft.com
027: */
028: package net.sf.jasperreports.engine.xml;
029:
030: import java.sql.Connection;
031: import java.util.Comparator;
032: import java.util.Date;
033: import java.util.Map;
034:
035: import net.sf.jasperreports.engine.JRDataSource;
036: import net.sf.jasperreports.engine.design.JRDesignExpression;
037:
038: import org.xml.sax.Attributes;
039:
040: /**
041: * @author Teodor Danciu (teodord@users.sourceforge.net)
042: * @version $Id: JRExpressionFactory.java 1229 2006-04-19 10:27:35Z teodord $
043: */
044: public class JRExpressionFactory {
045:
046: /**
047: *
048: */
049: public static class ObjectExpressionFactory extends JRBaseFactory {
050: public Object createObject(Attributes attrs) {
051: JRDesignExpression expression = new JRDesignExpression();
052: expression.setValueClassName(Object.class.getName());
053: return expression;
054: }
055: }
056:
057: /**
058: *
059: */
060: public static class ConnectionExpressionFactory extends
061: JRBaseFactory {
062: public Object createObject(Attributes attrs) {
063: JRDesignExpression expression = new JRDesignExpression();
064: expression.setValueClassName(Connection.class.getName());
065: return expression;
066: }
067: }
068:
069: /**
070: *
071: */
072: public static class DataSourceExpressionFactory extends
073: JRBaseFactory {
074: public Object createObject(Attributes attrs) {
075: JRDesignExpression expression = new JRDesignExpression();
076: expression.setValueClassName(JRDataSource.class.getName());
077: return expression;
078: }
079: }
080:
081: /**
082: *
083: */
084: public static class StringExpressionFactory extends JRBaseFactory {
085: public Object createObject(Attributes attrs) {
086: JRDesignExpression expression = new JRDesignExpression();
087: expression.setValueClassName(String.class.getName());
088: return expression;
089: }
090: }
091:
092: /**
093: *
094: */
095: public static class DateExpressionFactory extends JRBaseFactory {
096: public Object createObject(Attributes attrs) {
097: JRDesignExpression expression = new JRDesignExpression();
098: expression.setValueClassName(Date.class.getName());
099: return expression;
100: }
101: }
102:
103: /**
104: *
105: */
106: public static class ComparableExpressionFactory extends
107: JRBaseFactory {
108: public Object createObject(Attributes attrs) {
109: JRDesignExpression expression = new JRDesignExpression();
110: expression.setValueClassName(Comparable.class.getName());
111: return expression;
112: }
113: }
114:
115: /**
116: *
117: */
118: public static class IntegerExpressionFactory extends JRBaseFactory {
119: public Object createObject(Attributes attrs) {
120: JRDesignExpression expression = new JRDesignExpression();
121: expression.setValueClassName(Integer.class.getName());
122: return expression;
123: }
124: }
125:
126: /**
127: *
128: */
129: public static class NumberExpressionFactory extends JRBaseFactory {
130: public Object createObject(Attributes attrs) {
131: JRDesignExpression expression = new JRDesignExpression();
132: expression.setValueClassName(Number.class.getName());
133: return expression;
134: }
135: }
136:
137: /**
138: *
139: */
140: public static class BooleanExpressionFactory extends JRBaseFactory {
141: public Object createObject(Attributes attrs) {
142: JRDesignExpression expression = new JRDesignExpression();
143: expression.setValueClassName(Boolean.class.getName());
144: return expression;
145: }
146: }
147:
148: /**
149: *
150: */
151: public static class MapExpressionFactory extends JRBaseFactory {
152: public Object createObject(Attributes attrs) {
153: JRDesignExpression expression = new JRDesignExpression();
154: expression.setValueClassName(Map.class.getName());
155: return expression;
156: }
157: }
158:
159: public static class ComparatorExpressionFactory extends
160: JRBaseFactory {
161: public Object createObject(Attributes attrs) {
162: JRDesignExpression expression = new JRDesignExpression();
163: expression.setValueClassName(Comparator.class.getName());
164: return expression;
165: }
166: }
167:
168: }
|