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.";
            public Object convertObjectValueToDataValue(Object objectValue, Session session){
                //if this code is writin out, write out the converted value
View Full Code Here


        XMLDirectMapping platformMapping = new XMLDirectMapping();
        platformMapping.setAttributeName("platform");
        platformMapping.setGetMethodName("getDatasourcePlatform");
        platformMapping.setSetMethodName("usePlatform");
        platformMapping.setConverter(new Converter() {
            protected DatabaseMapping mapping;
            private Map platformList;
            private String oldPrefix = "oracle.toplink.";
            private String newPrefix = "org.eclipse.persistence.";
View Full Code Here

            }
        }

        XMLMarshaller marshaller = marshalRecord.getMarshaller();
        if (xmlBinaryDataMapping.getConverter() != null) {
            Converter converter = xmlBinaryDataMapping.getConverter();
            if (converter instanceof XMLConverter) {
                objectValue = ((XMLConverter) converter).convertObjectValueToDataValue(objectValue, session, marshaller);
            } else {
                objectValue = converter.convertObjectValueToDataValue(objectValue, session);
            }
        }
        XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver);
        if(xPathFragment.isAttribute()){
            if (objectValue == null) {
View Full Code Here

      }        
      return true;
    }
   
    private Object getConvertedValue(Object originalValue,MarshalRecord marshalRecord, AbstractSession session){
      Converter converter = xmlChoiceCollectionMapping.getConverter();
        if (null != converter) {
          if (converter instanceof XMLConverter) {
            return ((XMLConverter)converter).convertObjectValueToDataValue(originalValue, session, marshalRecord.getMarshaller());
          } else {
            return converter.convertObjectValueToDataValue(originalValue, session);
         }
       }
       return originalValue;     
    }
View Full Code Here

            } else if (mapping.isManyToManyMapping()) {
                buildRelationTableDefinition((ManyToManyMapping)mapping, ((ManyToManyMapping)mapping).getRelationTableMechanism(), ((ManyToManyMapping)mapping).getListOrderField(), mapping.getContainerPolicy());
            } else if (mapping.isDirectCollectionMapping()) {
                buildDirectCollectionTableDefinition((DirectCollectionMapping) mapping, descriptor);
            } else if (mapping.isDirectToFieldMapping()) {
                Converter converter = ((DirectToFieldMapping)mapping).getConverter();
                if (converter != null) {
                    if (converter instanceof TypeConversionConverter) {
                        resetFieldTypeForLOB((DirectToFieldMapping)mapping);
                    }
                   
View Full Code Here

     * @return
     */
    public boolean marshalSelfAttributes(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, AbstractSession session, NamespaceResolver namespaceResolver, XMLMarshaller marshaller) {
        Object objectValue = xmlCompositeObjectMapping.getAttributeValueFromObject(object);
        if (xmlCompositeObjectMapping.getConverter() != null) {
            Converter converter = xmlCompositeObjectMapping.getConverter();
            if (converter instanceof XMLConverter) {
                objectValue = ((XMLConverter)converter).convertObjectValueToDataValue(objectValue, session, marshaller);
            } else {
                objectValue = converter.convertObjectValueToDataValue(objectValue, session);
            }
        }
        XMLDescriptor descriptor = (XMLDescriptor)session.getDescriptor(objectValue);
        if(descriptor != null){
            TreeObjectBuilder objectBuilder = (TreeObjectBuilder)descriptor.getObjectBuilder();
View Full Code Here

    }

    public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object objectValue, AbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) {
     
        XMLMarshaller marshaller = marshalRecord.getMarshaller();
        Converter converter = xmlCompositeObjectMapping.getConverter();
        if (null != converter) {
            if (converter instanceof XMLConverter) {
                objectValue = ((XMLConverter)converter).convertObjectValueToDataValue(objectValue, session, marshaller);
            } else {
                objectValue = converter.convertObjectValueToDataValue(objectValue, session);
            }
        }
        if (null == objectValue) {
            return xmlCompositeObjectMapping.getNullPolicy().compositeObjectMarshal(xPathFragment, marshalRecord, object, session, namespaceResolver);
        }
View Full Code Here

                }
                inverseReferenceMapping.getContainerPolicy().addInto(unmarshalRecord.getCurrentObject(), backpointerContainer, unmarshalRecord.getSession());
            }
        }
        if (xmlCompositeObjectMapping.getConverter() != null) {
            Converter converter = xmlCompositeObjectMapping.getConverter();
            if (converter instanceof XMLConverter) {
                object = ((XMLConverter)converter).convertDataValueToObjectValue(object, unmarshalRecord.getSession(), unmarshalRecord.getUnmarshaller());
            } else {
                object = converter.convertDataValueToObjectValue(object, unmarshalRecord.getSession());
            }
        }
        // Set the child object on the parent
        unmarshalRecord.setAttributeValue(object, xmlCompositeObjectMapping);
    }
View Full Code Here

                    xmlCompositeObjectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), element);
                }
            }
        } else {
            Object valueToSet = selfRecord.getCurrentObject();
            Converter converter = xmlCompositeObjectMapping.getConverter();
            if (null != converter) {
                if (converter instanceof XMLConverter) {
                    valueToSet = ((XMLConverter)converter).convertDataValueToObjectValue(valueToSet, unmarshalRecord.getSession(), unmarshalRecord.getUnmarshaller());
                } else {
                    valueToSet = converter.convertDataValueToObjectValue(valueToSet, unmarshalRecord.getSession());
                }
            }

            xmlCompositeObjectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), valueToSet);
            XMLInverseReferenceMapping inverseReferenceMapping = xmlCompositeObjectMapping.getInverseReferenceMapping();
View Full Code Here

        }

        // Handle enumerations
        Class attributeClassification = mapping.getAttributeClassification();
        if (attributeClassification != null && Enum.class.isAssignableFrom(attributeClassification)) {
            Converter converter = mapping.getConverter();
            if (converter != null && converter instanceof EnumTypeConverter) {
                processEnumeration(schemaTypeString, frag, mapping, seq, ct, workingSchema, converter);
                return;
            }
        }
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.