001: /*
002: * Copyright 2004-2005 Fouad HAMDI.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.csvbeans.specs;
018:
019: import org.csvbeans.beans.Bean1;
020: import org.csvbeans.beans.Bean2;
021: import org.csvbeans.beans.Bean3;
022: import org.csvbeans.beans.Bean4;
023:
024: /**
025: * @author Fouad Hamdi
026: */
027: public class ObjectFactory {
028: public static RecordSpecificationImpl creeEnregistrement6() {
029: RecordSpecificationImpl enregistrement = new RecordSpecificationImpl();
030: enregistrement.setClassName(Bean1.class.getName());
031:
032: BeanSpecificationImpl bean2 = new BeanSpecificationImpl();
033: bean2.setClassName(Bean2.class.getName());
034: bean2.setName(Bean1.BEAN2);
035: FieldSpecificationImpl champ = new FieldSpecificationImpl(
036: Bean2.FIELD1);
037: champ.setMaximumLength(10);
038: bean2.addField(champ);
039: enregistrement.addField(bean2);
040:
041: BeanSpecificationImpl bean3 = new BeanSpecificationImpl();
042: bean3.setClassName(Bean3.class.getName());
043: bean3.setName(Bean2.BEAN3);
044: champ = new FieldSpecificationImpl(Bean3.FIELD1);
045: champ.setMaximumLength(10);
046: bean3.addField(champ);
047: bean2.addField(bean3);
048:
049: return enregistrement;
050: }
051:
052: public static RecordSpecificationImpl creeEnregistrement7() {
053: RecordSpecificationImpl enregistrement = new RecordSpecificationImpl();
054: enregistrement.setClassName(Bean3.class.getName());
055: BeanSpecificationImpl bean4 = new BeanSpecificationImpl();
056: bean4.setClassName(Bean4.class.getName());
057: bean4.setName(Bean3.LIST);
058: bean4.setListElement(true);
059: bean4.setListSize(2);
060: FieldSpecificationImpl champ = new FieldSpecificationImpl(
061: Bean4.INTEGER);
062: champ.setMaximumLength(2);
063: bean4.addField(champ);
064: enregistrement.addField(bean4);
065:
066: return enregistrement;
067: }
068:
069: public static RecordSpecificationImpl creeEnregistrement8() {
070: RecordSpecificationImpl enregistrement = new RecordSpecificationImpl();
071: enregistrement.setClassName(Bean3.class.getName());
072:
073: BeanSpecificationImpl bean4 = new BeanSpecificationImpl();
074: bean4.setClassName(Bean4.class.getName());
075: bean4.setName(Bean3.LIST);
076: bean4.setListElement(true);
077: bean4.setListSize(3);
078: FieldSpecificationImpl champ = new FieldSpecificationImpl(
079: Bean4.INTEGER);
080: champ.setMaximumLength(2);
081: bean4.addField(champ);
082: enregistrement.addField(bean4);
083:
084: return enregistrement;
085: }
086:
087: public static RecordSpecificationImpl creeEnregistrement9() {
088: RecordSpecificationImpl enregistrement = new RecordSpecificationImpl();
089: enregistrement.setClassName(Bean1.class.getName());
090: FieldSpecificationImpl field = new FieldSpecificationImpl(
091: "elements");
092: field.setMaximumLength(10);
093: field.setListElement(true);
094: field.setListSize(1);
095: enregistrement.addField(field);
096: return enregistrement;
097: }
098:
099: public static RecordSpecificationImpl creeEnregistrement11() {
100: RecordSpecificationImpl enregistrement = new RecordSpecificationImpl();
101: enregistrement.setClassName(Bean1.class.getName());
102: FieldSpecificationImpl field = new FieldSpecificationImpl(
103: Bean1.FIELD1);
104: field.setMaximumLength(10);
105: enregistrement.addField(field);
106: FieldSpecificationImpl constante = new FieldSpecificationImpl(
107: Bean1.FIELD3);
108: constante.setValue("22");
109: constante.setConstant(true);
110: enregistrement.addConstant(constante);
111: return enregistrement;
112: }
113: }
|