XINS types

the section called “Defining Input, Output.” shows you an example on how to use the types when defining the function.

Predefined types.

XINS has some integrated types which facilitate the use of input and output parameters with the implementation.

Table 4. XINS integrated types

typeJava representationExample
_textjava.lang.Stringhello world
_booleanbooleantrue
_int8byte25
_int16short2004
_int32int15
_int64long654654132135544566
_float32float25.6
_float64double3.14159
_dateorg.xins.common.types.standard.Date.Value20040514
_timestamporg.xins.common.types.standard.Timestamp.Value20040514115930
_propertyorg.xins.common.collections.PropertyReaderupgrade%3Dtrue%26surname%3Dde%2BHaan
_listorg.xins.common.types.standard.List.Valueitem1%26item2%26item1
_setorg.xins.common.types.standard.Set.Valueitem3%26item1%26item2
_base64byte[]aGVsbG8=
_hexbyte[]546573746f
_urlStringhttp://www.google.com
_descriptororg.xins.common.service.Descriptor

descriptor=group, random, target1, target2

descriptor.target1=service, http://127.0.0.1:8080/my-project/, 8000

descriptor.target2=service, http://192.168.0.1:8080/my-project/, 8000

_xmlorg.xins.common.xml.Element<firstName>Alain</firstName>

You can find an example using all these types in the function demo\xins-project\apis\allinone\spec\SimpleTypes.fnc.

Defined types

As seen in the section called “Defining Input, Output.”, it's also possible to define your own type. Here is a list of the possible types to define in XINS:

  • <pattern>: This type accepts a PERL5 regular expression and allows you to define a text that has some constraints in its format.

  • <enum>: This type must contain a list of <item> elements, each item element must have a value attribute that contains the value of the item and can have a name attribute that contains the description of the item. If the name is not defined it's set by default to the value of the item.

  • <int8>, <int16>, <int32>, <int64>: These types define a number. They accept the optional attributes min and max that can be used to set a minimum and a maximum value for the parameter.

  • <float32>, <float64>: These types define a floating point number. They accept the optional attributes min and max that can be used to set a minimum and a maximum value for the parameter.

  • <properties>: This type is similar to the _property type but it allows you to specify a type for the keys and the values of the property by using the optional attributes nameType and valueType. If not specified the type _text will be used.

  • <list> and <set>: These types are used to define a list of values in a parameter. The type of the value can be restricted by using the optional attribute type. If not specified the default value for the type attribute is _text.

  • <base64>, <hex>: This type defines a binary. They accept the optional attributes min and max that can be used to set a minimum and a maximum size in bytes for the binary.

You can find an example using some of these types in the function demo\xins-project\apis\allinone\spec\DefinedTypes.fnc.

Shared types

If you have more than one API, you may want to reuse types defined in other APIs (for example EMail.typ, Account.typ, LastName.typ, ...). Instead of copying the file to the new API, you can also point to this type. This is done by using <api name>/<type name> in api.xml and in the function(s) specification.

For example:

  <type name="petstore/EMail"/>
  <param name="outputEMail" required="false" type="petstore/EMail">
    <description>An example of output shared type.</description>
  </param>