Package org.eclipse.persistence.mappings.converters

Examples of org.eclipse.persistence.mappings.converters.Converter


        XMLDirectMapping platformClassMapping = new XMLDirectMapping();
        platformClassMapping.setAttributeName("m_platformClass");
        platformClassMapping.setGetMethodName("getPlatformClass");
        platformClassMapping.setSetMethodName("setPlatformClass");
        platformClassMapping.setXPath("platform-class/text()");
        platformClassMapping.setConverter(new Converter(){
            private Map platformList;
            private String oldPrefix = "oracle.toplink.";
            private String newPrefix = "org.eclipse.persistence.";
            private String oldOxmPrefix = oldPrefix + "ox.";
            private String newOxmPrefix = newPrefix + "oxm.";
View Full Code Here


                data = attachmentUnmarshaller.getAttachmentAsDataHandler(this.c_id);
            } else {
                data = attachmentUnmarshaller.getAttachmentAsByteArray(this.c_id);
            }
            if (this.converter != null) {
                Converter converter = this.converter;
                if (converter instanceof XMLConverter) {
                    data = ((XMLConverter) converter).convertDataValueToObjectValue(data, record.getSession(), record.getUnmarshaller());
                } else {
                    data = converter.convertDataValueToObjectValue(data, record.getSession());
                }
            }
            data = XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(data, mapping.getAttributeClassification(), record.getSession());
            //check for collection case
            if (isCollection) {
View Full Code Here

    }

    public void writeSingleValue(Object attributeValue, Object parent, XMLRecord record, AbstractSession session) {
        XMLMarshaller marshaller = record.getMarshaller();
        if (getConverter() != null) {
            Converter converter = getConverter();
            if (converter instanceof XMLConverter) {
                attributeValue = ((XMLConverter) converter).convertObjectValueToDataValue(attributeValue, session, record.getMarshaller());
            } else {
                attributeValue = converter.convertObjectValueToDataValue(attributeValue, session);
            }
        }
        XMLField field = (XMLField) getField();
        if (field.getLastXPathFragment().isAttribute()) {
            if (isSwaRef() && (marshaller.getAttachmentMarshaller() != null)) {
View Full Code Here

    public Object getValueToWrite(Object value, Object parent, XMLRecord record, XMLField field, XMLField includeField, AbstractSession session) {
        XMLMarshaller marshaller = record.getMarshaller();
        Object element = value;
        boolean isAttribute = ((XMLField) getField()).getLastXPathFragment().isAttribute();
        if (getValueConverter() != null) {
            Converter converter = getValueConverter();
            if (converter instanceof XMLConverter) {
                element = ((XMLConverter) converter).convertObjectValueToDataValue(element, session, record.getMarshaller());
            } else {
                element = converter.convertObjectValueToDataValue(element, session);
            }
        }

        if(element == null){
            return null;
View Full Code Here

       List<XMLEntry> values = ((DOMRecord)row).getValuesIndicatingNoEntry(this.getFields());
       Object container = getContainerPolicy().containerInstance(values.size());
       for(XMLEntry next:values) {
           XMLField valueField = next.getXMLField();
           DatabaseMapping nextMapping = (DatabaseMapping)this.choiceElementMappings.get(valueField);
           Converter converter = getConverter();
           if(nextMapping.isAbstractCompositeCollectionMapping()) {
               XMLCompositeCollectionMapping xmlMapping = (XMLCompositeCollectionMapping)nextMapping;
               Object value = xmlMapping.buildObjectFromNestedRow((AbstractRecord)next.getValue(), joinManager, sourceQuery, executionSession, isTargetProtected);
               if(converter != null) {
                   if (converter instanceof XMLConverter) {
                       value = ((XMLConverter) converter).convertDataValueToObjectValue(value, executionSession, ((XMLRecord) row).getUnmarshaller());
                   } else {
                       value = converter.convertDataValueToObjectValue(value, executionSession);
                   }
               }
               getContainerPolicy().addInto(value, container, executionSession);
           } else if(nextMapping instanceof XMLCompositeDirectCollectionMapping){
               XMLCompositeDirectCollectionMapping xmlMapping = (XMLCompositeDirectCollectionMapping)nextMapping;
               Object value = next.getValue();
               if(converter != null) {
                   if (converter instanceof XMLConverter) {
                       value = ((XMLConverter) converter).convertDataValueToObjectValue(value, executionSession, ((XMLRecord) row).getUnmarshaller());
                   } else {
                       value = converter.convertDataValueToObjectValue(value, executionSession);
                   }
               }
               getContainerPolicy().addInto(value, container, executionSession);
           }
       }
View Full Code Here

            }
        }       
        Iterator<XMLMapping> mappings = mappingsList.iterator();
        while(mappings.hasNext()){
            DatabaseMapping nextMapping = (DatabaseMapping)mappings.next();
            Converter converter = null;
            if(fieldsToConverters != null) {
                converter = fieldsToConverters.get(nextMapping.getField());
            }
            if(nextMapping.isAbstractCompositeDirectCollectionMapping()){
                XMLConversionManager xmlConversionManager = (XMLConversionManager) session.getDatasourcePlatform().getConversionManager();                  
View Full Code Here

        fieldsToConverters.put(field, converter);
    }

    public Converter getConverter(XMLField field) {
        if(null != this.fieldsToConverters) {
            Converter converter = fieldsToConverters.get(field);
            if(null != converter) {
                return converter;
            }
            if(null != this.choiceElementMappings) {
                DatabaseMapping mapping = (DatabaseMapping) this.choiceElementMappings.get(field);
View Full Code Here

        }       
        Iterator<XMLMapping> mappings = mappingsList.iterator();
        while(mappings.hasNext()){
            DatabaseMapping nextMapping = (DatabaseMapping)mappings.next();
              
            Converter converter = null;
            if(fieldsToConverters != null) {
                converter = fieldsToConverters.get(nextMapping.getField());
            }
                       
            if(nextMapping.isAbstractDirectMapping()){
View Full Code Here

        fieldsToConverters.put(field, converter);      
    }

    public Converter getConverter(XMLField field) {
        if(null != this.fieldsToConverters) {
            Converter converter = fieldsToConverters.get(field);
            if(null != converter) {
                return converter;
            }
            if(null != this.choiceElementMappings) {
                DatabaseMapping mapping = (DatabaseMapping) this.choiceElementMappings.get(field);
View Full Code Here

        }
       
        // Instantiate any custom converter class
        if (converterClassName != null) {
            Class converterClass;
            Converter converter;
   
            try {
                if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
                    try {
                        converterClass = (Class) AccessController.doPrivileged(new PrivilegedClassForName(converterClassName, true, classLoader));
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.mappings.converters.Converter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.