Content type vs Java wrapper type

Hi,

When you area creating a document in the IS and defining its variables, what’s the difference between setting the variable type as String and defining a Content Type vs setting the type as Object and defining a Java Wrapper Type?

For example, my document has a variable named “id” which will be filled with an SMALLINT from a DB, how should I define it? String/content type short or Object/java.lang.Short?

I’ve searched and found comments like:

I’m using Designer 8 so in my case is much easier to use java wrappers to handle info while developing CAF components… but should I consider anything else?

Thanks!

The difference between the two is that with the string/content-type is the variable is a Java String object while the object/Java-type is a Java object of the type indicated. For example, a field named XYZ of type String/xsd:boolean is just a string. While the same XYZ field of type Object/Java wrapper Boolean is a Boolean object.

The majority of FLOW services, built-in or otherwise, expect strings. Some use custom Java objects but that’s generally an exception. For FLOW development, strings are easier to work with. Using objects usually requires Java service helpers, which may be more trouble than they are worth.

Keep in mind that the IS document type definition is just a definition. It defines what is expected to be in a document instance. It does not control what is present. E.g. if a doc type is defined with field XYZ to hold a java.util.Date object and the code assigns a string to XYZ, the document instance will have a string, not a Date.

I would suggest using strings for IS doc type definitions. Using objects might make CAF development somewhat easier it will make FLOW development harder.

That was the kind of answer I was expecting.
Thanks!