com.sforce.ws.bind
Class TypeMapper

java.lang.Object
  extended by com.sforce.ws.bind.TypeMapper

public class TypeMapper
extends Object

This class is used at runtime to bind xml document to java object and java objects back to xml.

Since:
1.0 Nov 29, 2005
Version:
1.0
Author:
http://cheenath.com

Nested Class Summary
static class TypeMapper.PartialArrayException
           
 
Field Summary
 boolean writeFieldXsiType
           
 
Constructor Summary
TypeMapper()
           
 
Method Summary
 void consumeEndTag(XmlInputStream in)
           
 void consumeStartTag(XmlInputStream in)
           
 Object deserialize(String value, QName type)
           
 String getJavaClassName(QName xmltype, Types types, boolean nillable)
          returns java class name for the specified xml complex type
 String getPackagePrefix()
           
static String getPrefix(String xsiType)
           
static String getType(String xsiType)
           
 QName getXmlType(String javaType)
           
 QName getXsiType(XmlInputStream in)
           
 boolean isElement(XmlInputStream in, TypeInfo info)
           
 boolean isKeyWord(String token)
           
 boolean isWellKnownType(String namespace, String name)
          is this a well know type.
 double parseDouble(String strValue)
           
 boolean readBoolean(XmlInputStream in, TypeInfo info, Class<?> type)
           
 double readDouble(XmlInputStream in, TypeInfo info, Class<?> type)
           
 float readFloat(XmlInputStream in, TypeInfo info, Class<?> type)
           
 int readInt(XmlInputStream in, TypeInfo info, Class<?> type)
           
 long readLong(XmlInputStream in, TypeInfo info, Class<?> type)
           
 Object readObject(XmlInputStream in, TypeInfo info, Class<?> type)
           
 Object readPartialArray(XmlInputStream in, TypeInfo result__typeInfo, Class<?> type)
           
 String readString(XmlInputStream in, TypeInfo info, Class<?> type)
           
 void setConfig(ConnectorConfig config)
           
 void setPackagePrefix(String packagePrefix)
           
 boolean verifyElement(XmlInputStream in, TypeInfo info)
           
 void verifyTag(String namespace1, String name1, String namespace2, String name2)
           
 void writeBoolean(XmlOutputStream out, TypeInfo info, boolean value, boolean isSet)
           
 String writeDouble(double value)
           
 void writeDouble(XmlOutputStream out, TypeInfo info, double value, boolean isSet)
           
 void writeFieldXsiType(boolean flag)
           
 void writeFloat(XmlOutputStream out, TypeInfo info, float value, boolean isSet)
           
 void writeInt(XmlOutputStream out, TypeInfo info, int value, boolean isSet)
           
 void writeLong(XmlOutputStream out, TypeInfo info, long value, boolean isSet)
           
 void writeObject(XmlOutputStream out, TypeInfo info, Object value, boolean isSet)
           
 void writeString(XmlOutputStream out, TypeInfo info, String value, boolean isSet)
           
 void writeXsiType(XmlOutputStream out, String typeNS, String type)
          write xsi type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writeFieldXsiType

public boolean writeFieldXsiType
Constructor Detail

TypeMapper

public TypeMapper()
Method Detail

writeFieldXsiType

public void writeFieldXsiType(boolean flag)

setPackagePrefix

public void setPackagePrefix(String packagePrefix)

getPackagePrefix

public String getPackagePrefix()

isKeyWord

public boolean isKeyWord(String token)

setConfig

public void setConfig(ConnectorConfig config)

isWellKnownType

public boolean isWellKnownType(String namespace,
                               String name)
is this a well know type. If it is a well known type, then there is no need to generate a class for the type.

Parameters:
namespace - namespace of the type
name - name of the type
Returns:
true if this is a well known type

getJavaClassName

public String getJavaClassName(QName xmltype,
                               Types types,
                               boolean nillable)
returns java class name for the specified xml complex type

Parameters:
xmltype - xml complex type
types - types
nillable - nillable
Returns:
java class name

getXmlType

public QName getXmlType(String javaType)

writeXsiType

public void writeXsiType(XmlOutputStream out,
                         String typeNS,
                         String type)
                  throws IOException
write xsi type. Called if a type has a base class.

Parameters:
out - xml out put stream
typeNS - namespace of the type
type - name of the type
Throws:
IOException - failed to write

writeString

public void writeString(XmlOutputStream out,
                        TypeInfo info,
                        String value,
                        boolean isSet)
                 throws IOException
Throws:
IOException

writeBoolean

public void writeBoolean(XmlOutputStream out,
                         TypeInfo info,
                         boolean value,
                         boolean isSet)
                  throws IOException
Throws:
IOException

writeInt

public void writeInt(XmlOutputStream out,
                     TypeInfo info,
                     int value,
                     boolean isSet)
              throws IOException
Throws:
IOException

writeLong

public void writeLong(XmlOutputStream out,
                      TypeInfo info,
                      long value,
                      boolean isSet)
               throws IOException
Throws:
IOException

writeFloat

public void writeFloat(XmlOutputStream out,
                       TypeInfo info,
                       float value,
                       boolean isSet)
                throws IOException
Throws:
IOException

writeDouble

public void writeDouble(XmlOutputStream out,
                        TypeInfo info,
                        double value,
                        boolean isSet)
                 throws IOException
Throws:
IOException

writeDouble

public String writeDouble(double value)

writeObject

public void writeObject(XmlOutputStream out,
                        TypeInfo info,
                        Object value,
                        boolean isSet)
                 throws IOException
Throws:
IOException

verifyTag

public void verifyTag(String namespace1,
                      String name1,
                      String namespace2,
                      String name2)
               throws ConnectionException
Throws:
ConnectionException

consumeStartTag

public void consumeStartTag(XmlInputStream in)
                     throws IOException,
                            ConnectionException
Throws:
IOException
ConnectionException

consumeEndTag

public void consumeEndTag(XmlInputStream in)
                   throws IOException,
                          ConnectionException
Throws:
IOException
ConnectionException

verifyElement

public boolean verifyElement(XmlInputStream in,
                             TypeInfo info)
                      throws ConnectionException
Throws:
ConnectionException

isElement

public boolean isElement(XmlInputStream in,
                         TypeInfo info)
                  throws ConnectionException
Throws:
ConnectionException

readString

public String readString(XmlInputStream in,
                         TypeInfo info,
                         Class<?> type)
                  throws IOException,
                         ConnectionException
Throws:
IOException
ConnectionException

readInt

public int readInt(XmlInputStream in,
                   TypeInfo info,
                   Class<?> type)
            throws IOException,
                   ConnectionException
Throws:
IOException
ConnectionException

readLong

public long readLong(XmlInputStream in,
                     TypeInfo info,
                     Class<?> type)
              throws IOException,
                     ConnectionException
Throws:
IOException
ConnectionException

readFloat

public float readFloat(XmlInputStream in,
                       TypeInfo info,
                       Class<?> type)
                throws IOException,
                       ConnectionException
Throws:
IOException
ConnectionException

readBoolean

public boolean readBoolean(XmlInputStream in,
                           TypeInfo info,
                           Class<?> type)
                    throws IOException,
                           ConnectionException
Throws:
IOException
ConnectionException

readDouble

public double readDouble(XmlInputStream in,
                         TypeInfo info,
                         Class<?> type)
                  throws IOException,
                         ConnectionException
Throws:
IOException
ConnectionException

parseDouble

public double parseDouble(String strValue)

deserialize

public Object deserialize(String value,
                          QName type)

readObject

public Object readObject(XmlInputStream in,
                         TypeInfo info,
                         Class<?> type)
                  throws ConnectionException,
                         IOException
Throws:
ConnectionException
IOException

readPartialArray

public Object readPartialArray(XmlInputStream in,
                               TypeInfo result__typeInfo,
                               Class<?> type)
                        throws ConnectionException,
                               IOException
Throws:
ConnectionException
IOException

getXsiType

public QName getXsiType(XmlInputStream in)

getType

public static String getType(String xsiType)

getPrefix

public static String getPrefix(String xsiType)


Copyright © 2013. All Rights Reserved.