Package org.eclipse.persistence.mappings.converters

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


    protected XMLDirectMapping getJoinFetchMapping() {
        XMLDirectMapping joinFetchMapping = new XMLDirectMapping();
        joinFetchMapping.setAttributeName("m_joinFetch");
        joinFetchMapping.setGetMethodName("getJoinFetch");
        joinFetchMapping.setSetMethodName("setJoinFetch");
        joinFetchMapping.setConverter(new EnumTypeConverter(joinFetchMapping, JoinFetchType.class, false));
        joinFetchMapping.setXPath("orm:join-fetch/text()");
        return joinFetchMapping;
    }
View Full Code Here


    protected XMLDirectMapping getTemporalMapping() {
        XMLDirectMapping temporalMapping = new XMLDirectMapping();
        temporalMapping.setAttributeName("m_temporal");
        temporalMapping.setGetMethodName("getTemporal");
        temporalMapping.setSetMethodName("setTemporal");
        temporalMapping.setConverter(new EnumTypeConverter(temporalMapping, TemporalType.class, false));
        temporalMapping.setXPath("orm:temporal/text()");   
        return temporalMapping;
    }
View Full Code Here

        Class dataType = getDataType(accessor);
        Class objectType = getObjectType(accessor);
       
        if (objectType.isEnum()) {
            // Create an EnumTypeConverter.
            converter = new EnumTypeConverter(mapping, objectType.getName());
           
            // The object values should be the names of the enum members so
            // force the objectType to String to ensure the initObject calls
            // below will work.
            objectType = String.class;
View Full Code Here

        XMLDirectMapping keepAsElementMapping = new XMLDirectMapping();
        keepAsElementMapping.setAttributeName("keepAsElementPolicy");
        keepAsElementMapping.setGetMethodName("getKeepAsElementPolicy");
        keepAsElementMapping.setSetMethodName("setKeepAsElementPolicy");
        keepAsElementMapping.setXPath(getPrimaryNamespaceXPath() + "keep-as-element-policy");
        EnumTypeConverter converter = new EnumTypeConverter(keepAsElementMapping, UnmarshalKeepAsElementPolicy.class, false);
        keepAsElementMapping.setConverter(converter);
        descriptor.addMapping(keepAsElementMapping);

        return descriptor;
    }
View Full Code Here

         XMLDirectMapping nrfxMapping = new XMLDirectMapping();
         nrfxMapping.setAttributeName("marshalNullRepresentation");
         nrfxMapping.setXPath(getPrimaryNamespaceXPath() + "null-representation-for-xml/text()");
         // Restricted to XSI_NIL,ABSENT_NODE,EMPTY_NODE
         EnumTypeConverter aConverter = new EnumTypeConverter(nrfxMapping, XMLNullRepresentationType.class, false);
         nrfxMapping.setConverter(aConverter);
         aDescriptor.addMapping(nrfxMapping);

         // Subclasses
         aDescriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
View Full Code Here

         descriptor.getInheritancePolicy().setParentClass(DatabaseTypeWrapper.class);

         XMLDirectMapping wrappedDatabaseTypeMapping = new XMLDirectMapping();
         wrappedDatabaseTypeMapping.setAttributeName("wrappedDatabaseType");
         wrappedDatabaseTypeMapping.setXPath("@" + TYPE_NAME);
         EnumTypeConverter oraclePLSQLTypesEnumTypeConverter = new EnumTypeConverter(
             wrappedDatabaseTypeMapping, OraclePLSQLTypes.class, false);
         wrappedDatabaseTypeMapping.setConverter(oraclePLSQLTypesEnumTypeConverter);
         descriptor.addMapping(wrappedDatabaseTypeMapping);

         return descriptor;
View Full Code Here

         descriptor.getInheritancePolicy().setParentClass(DatabaseTypeWrapper.class);

         XMLDirectMapping wrappedDatabaseTypeMapping = new XMLDirectMapping();
         wrappedDatabaseTypeMapping.setAttributeName("wrappedDatabaseType");
         wrappedDatabaseTypeMapping.setXPath("@" + TYPE_NAME);
         EnumTypeConverter jdbcTypesEnumTypeConverter = new EnumTypeConverter(
             wrappedDatabaseTypeMapping, JDBCTypes.class, false);
         wrappedDatabaseTypeMapping.setConverter(jdbcTypesEnumTypeConverter);
         descriptor.addMapping(wrappedDatabaseTypeMapping);

         return descriptor;
View Full Code Here

        Class dataType = getDataType(accessor);
        Class objectType = getObjectType(accessor);
       
        if (objectType.isEnum()) {
            // Create an EnumTypeConverter.
            converter = new EnumTypeConverter(mapping, objectType.getName());
           
            // The object values should be the names of the enum members so
            // force the objectType to String to ensure the initObject calls
            // below will work.
            objectType = String.class;
View Full Code Here

            throw ValidationException.invalidTypeForEnumeratedAttribute(mapping.getAttributeName(), getReferenceClass(), getJavaClass());
        } else {
            // Create an EnumTypeConverter and set it on the mapping.
            if (m_enumerated == null) {
                // TODO: Log a defaulting message
                setConverter(mapping, new EnumTypeConverter(mapping, getReferenceClass(), true));
            } else {
                setConverter(mapping, new EnumTypeConverter(mapping, getReferenceClass(), m_enumerated.name().equals(EnumType.ORDINAL.name())));
            }
        }
    }
View Full Code Here

       
        XMLDirectMapping cacheTypeMapping = new XMLDirectMapping();
        cacheTypeMapping.setAttributeName("m_type");
        cacheTypeMapping.setGetMethodName("getType");
        cacheTypeMapping.setSetMethodName("setType");
        cacheTypeMapping.setConverter(new EnumTypeConverter(cacheTypeMapping, CacheType.class, false));
        cacheTypeMapping.setXPath("@type");
        descriptor.addMapping(cacheTypeMapping);
       
        XMLDirectMapping alwaysRefreshMapping = new XMLDirectMapping();
        alwaysRefreshMapping.setAttributeName("m_alwaysRefresh");
        alwaysRefreshMapping.setGetMethodName("getAlwaysRefresh");
        alwaysRefreshMapping.setSetMethodName("setAlwaysRefresh");
        alwaysRefreshMapping.setXPath("@always-refresh");
        descriptor.addMapping(alwaysRefreshMapping);
       
        XMLDirectMapping refreshOnlyIfNewerMapping = new XMLDirectMapping();
        refreshOnlyIfNewerMapping.setAttributeName("m_refreshOnlyIfNewer");
        refreshOnlyIfNewerMapping.setGetMethodName("getRefreshOnlyIfNewer");
        refreshOnlyIfNewerMapping.setSetMethodName("setRefreshOnlyIfNewer");
        refreshOnlyIfNewerMapping.setXPath("@refresh-only-if-newer");
        descriptor.addMapping(refreshOnlyIfNewerMapping);
       
        XMLDirectMapping disableHitsMapping = new XMLDirectMapping();
        disableHitsMapping.setAttributeName("m_disableHits");
        disableHitsMapping.setGetMethodName("getDisableHits");
        disableHitsMapping.setSetMethodName("setDisableHits");
        disableHitsMapping.setXPath("@disable-hits");
        descriptor.addMapping(disableHitsMapping);
       
        XMLDirectMapping coordinationTypeMapping = new XMLDirectMapping();
        coordinationTypeMapping.setAttributeName("m_coordinationType");
        coordinationTypeMapping.setGetMethodName("getCoordinationType");
        coordinationTypeMapping.setSetMethodName("setCoordinationType");
        coordinationTypeMapping.setConverter(new EnumTypeConverter(coordinationTypeMapping, CacheCoordinationType.class, false));
        coordinationTypeMapping.setXPath("@coordination-type");
        descriptor.addMapping(coordinationTypeMapping);
     
        return descriptor;
    }
View Full Code Here

TOP

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

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.