[jibx-users] collection Set JDK 1.4.2
Hi All, Jibx binding compiler compiles fine with the following binding class declaration: mapping name=AsClient class=com.adminserver.dcl.ClientDcl ordered=false collection field=roles type=java.util.HashSet item-type=com.adminserver.dcl.RoleDcl name=PolicyRoles usage=optional/ /mapping mapping name=AsRole class=com.adminserver.dcl.RoleDcl ordered=false value get-method=getRoleGuid set-method=setRoleGuid name=RoleGUID style=element usage=optional/ /mapping public class ClientDcl { ... private java.util.Set roles; ... } I am getting a java.lang.ClassCastException without any more stack trace information from Jibx. Would I need to use the 'factory' attribute instead of the 'type' attribute? Something on the lines of org.jibx.runtime.Utility.arrayListFactory? Any idea what's going on here? --Sandeep Khanna --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
[jibx-users] Custom HashMap representation using HashMapperStringToComplex ?
) { ctx.element( m_index, KEY_ELEMENT_NAME, entry.getKey().toString() ); } if( entry.getValue() instanceof IMarshallable ) { ( ( IMarshallable )entry.getValue() ).marshal( ctx ); ctx.endTag( m_index, VALUE_ELEMENT_NAME ); } else { throw new JiBXException( Mapped value is not marshallable ); } } // finish with end tag for container element ctx.endTag( m_index, m_name ); } } /** * Unmarshal instance of handled class. This method call is responsible for * all handling of the unmarshalling of an object from XML text, including * creating the instance of the handled class if an instance is not * supplied. When it is called the unmarshalling context is always * positioned at or just before the start tag corresponding to the start of * the class data. * * @param obj *object to be unmarshalled (may be codenull/code) * @param ctx *unmarshalling context * @return unmarshalled object (may be codenull/code) * @throws JiBXException * on error in unmarshalling process */ public Object unmarshal( Object obj, IUnmarshallingContext ictx ) throws JiBXException { logger.debug( Unmarshalling ... ); // make sure we're at the appropriate start tag UnmarshallingContext ctx = ( UnmarshallingContext )ictx; if( !ctx.isAt( m_uri, m_name ) ) { ctx.throwStartTagNameError( m_uri, m_name ); } // create new hashmap if needed int size = ctx.attributeInt( m_uri, SIZE_ATTRIBUTE_NAME, DEFAULT_SIZE ); HashMap map = ( HashMap )obj; if( map == null ) { map = new HashMap( size ); } // process all entries present in document ctx.parsePastStartTag( m_uri, m_name ); while( ctx.isAt( m_uri, VALUE_ELEMENT_NAME ) ) { Object key = ctx.attributeText( m_uri, KEY_ELEMENT_NAME, null ); ctx.parsePastStartTag( m_uri, VALUE_ELEMENT_NAME ); Object value = ctx.unmarshalElement(); map.put( key, value ); ctx.parsePastEndTag( m_uri, VALUE_ELEMENT_NAME ); } ctx.parsePastEndTag( m_uri, m_name ); return map; } } Any help would be appreciated. --Sandeep Khanna --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
[jibx-users] Jibx mapping suggestions for HashMap please ...
Hi All, Can someone suggest the proper mapping definition for the following HashMap XML representation: ?xml version=1.0 encoding=UTF-8? AsClient ClientGUID/ SexM/Sex DateOfBirth1970-01-01T00:00:00.000-05:00/DateOfBirth TypeCode02/TypeCode TaxID999-99-/TaxID FirstNameSandeep/FirstName MiddleInitialT/MiddleInitial LastNameKhanna/LastName Fields AsClientField keyPhoneType4/key value ClientGUID/ FieldNamePhoneType4/FieldName TextValue00/TextValue FieldTypeCode02/FieldTypeCode /value /AsClientField AsClientField keyPhoneNumber3/key value ClientGUID/ FieldNamePhoneNumber3/FieldName FieldTypeCode02/FieldTypeCode /value /AsClientField /Fields /AsClient What I got so far is: ?xml version=1.0 encoding=UTF-8? binding xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:noNamespaceSchemaLocation=file:/home/sandeepk/Download/jibx/docs/binding.xsd !-- === -- !-- Mapping for class com.adminserver.dcl.ClientDcl -- !-- === -- mapping name=AsClient class=com.adminserver.dcl.ClientDcl ordered=false value get-method=getClientGuid set-method=setClientGuid name=ClientGUID style=element usage=optional/ value get-method=getSex set-method=setSex name=Sex style=element usage=optional/ value get-method=getDateOfBirth set-method=setDateOfBirth name=DateOfBirth style=element usage=optional/ value get-method=getEmail set-method=setEmail name=Email style=element usage=optional/ value get-method=getDateOfDeath set-method=setDateOfDeath name=DateOfDeath style=element usage=optional/ value get-method=getTypeCode set-method=setTypeCode name=TypeCode style=element usage=optional/ value get-method=getTaxId set-method=setTaxId name=TaxID style=element usage=optional/ value get-method=getFirstName set-method=setFirstName name=FirstName style=element usage=optional/ value get-method=getMiddleInitial set-method=setMiddleInitial name=MiddleInitial style=element usage=optional/ value get-method=getCompanyName set-method=setCompanyName name=CompanyName style=element usage=optional/ value get-method=getLastName set-method=setLastName name=LastName style=element usage=optional/ structure get-method=getFields set-method=setFields name=Fields marshaller=com.adminserver.utl.JibxHashMapHandler unmarshaller=com.adminserver.utl.JibxHashMapHandler usage=optional /structure /mapping !-- === -- !-- Mapping for class com.adminserver.dcl.ClientFieldDcl -- !-- === -- mapping name=AsClientField class=com.adminserver.dcl.ClientFieldDcl ordered=false value get-method=getClientGuid set-method=setClientGuid name=ClientGUID style=element usage=optional/ value get-method=getFieldName set-method=setFieldName name=FieldName style=element usage=optional/ value get-method=getTextValue set-method=setTextValue name=TextValue style=element usage=optional/ value get-method=getFieldTypeCode set-method=setFieldTypeCode name=FieldTypeCode style=element usage=optional/ /mapping /binding Any help would be appreciated. --Sandeep Khanna --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users