KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > generator > types > Base64BinarySG


1 /*
2  * Copyright 2003, 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  */

17 package org.apache.ws.jaxme.generator.types;
18
19 import org.apache.ws.jaxme.generator.sg.SGFactory;
20 import org.apache.ws.jaxme.generator.sg.SGlet;
21 import org.apache.ws.jaxme.generator.sg.SchemaSG;
22 import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
23 import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
24 import org.apache.ws.jaxme.js.JavaMethod;
25 import org.apache.ws.jaxme.js.JavaQName;
26 import org.apache.ws.jaxme.js.JavaQNameImpl;
27 import org.apache.ws.jaxme.js.LocalJavaField;
28 import org.apache.ws.jaxme.js.TypedValue;
29 import org.apache.ws.jaxme.js.impl.TypedValueImpl;
30 import org.apache.ws.jaxme.xs.XSType;
31 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
32 import org.xml.sax.SAXException JavaDoc;
33
34
35 /**
36  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
37  */

38 public class Base64BinarySG extends AtomicTypeSGImpl {
39   public static final JavaQName BYTE_ARRAY_TYPE = JavaQNameImpl.getInstance(byte[].class);
40
41   /** <p>Creates a new instance of Base64BinarySG.</p>
42    */

43   public Base64BinarySG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
44     super(pFactory, pSchema, pType);
45   }
46
47   public JavaQName getRuntimeType(SimpleTypeSG pController) { return BYTE_ARRAY_TYPE; }
48   protected String JavaDoc getDatatypeName() { return "Base64Binary"; }
49   protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
50
51   public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object JavaDoc pValue, SGlet pSGlet) throws SAXException {
52     LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
53     f.addLine(pValue);
54     pMethod.addIf(f, " != null");
55     pSGlet.generate(pMethod, pValue);
56     pMethod.addEndIf();
57   }
58
59   public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object JavaDoc pValue, SGlet pSGlet) throws SAXException {
60     pSGlet.generate(pMethod, pValue);
61   }
62 }
63
Popular Tags