⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaulttypemappingregistry.java

📁 Xfire文件 用于开发web service 的一个开源工具 很好用的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            }            catch (Throwable t)            {                logger.info("Couldn't find Java 5 module on classpath. Annotation mappings will not be supported.");                if (!(t instanceof ClassNotFoundException))                    logger.debug("Error loading Java 5 module", t);            }        }                return xmlCreator;    }    boolean isJDK5andAbove()    {        String v = System.getProperty("java.class.version", "44.0");        return ("49.0".compareTo(v) <= 0);    }    protected AbstractTypeCreator createRootTypeCreator()    {        AbstractTypeCreator creator = TypeCreatorFactory.getTypeCreator();                creator.setConfiguration(getConfiguration());        return creator;    }    protected AbstractTypeCreator createDefaultTypeCreator()    {        AbstractTypeCreator creator = new DefaultTypeCreator();        creator.setConfiguration(getConfiguration());        return creator;    }    /**     * @see org.codehaus.xfire.aegis.type.TypeMappingRegistry#unregisterTypeMapping(java.lang.String)     */    public TypeMapping unregisterTypeMapping(String encodingStyleURI)    {        TypeMapping tm = (TypeMapping) registry.get(encodingStyleURI);        registry.remove(encodingStyleURI);        return tm;    }    public boolean removeTypeMapping(TypeMapping mapping)    {        int n = 0;        for (Iterator itr = registry.values().iterator(); itr.hasNext();)        {            if (itr.next().equals(mapping))            {                itr.remove();                n++;            }        }        return (n > 0);    }    /**     * @see org.codehaus.xfire.aegis.type.TypeMappingRegistry#clear()     */    public void clear()    {        registry.clear();    }    public TypeMapping createDefaultMappings()    {        TypeMapping tm = createTypeMapping(false);        createDefaultMappings(tm);                // Create a Type Mapping for SOAP 1.1 Encoding        TypeMapping soapTM = createTypeMapping(tm, false);        register(soapTM, boolean.class, ENCODED_BOOLEAN, new BooleanType());        register(soapTM, int.class, ENCODED_INT, new IntType());        register(soapTM, short.class, ENCODED_SHORT, new ShortType());        register(soapTM, double.class, ENCODED_DOUBLE, new DoubleType());        register(soapTM, float.class, ENCODED_FLOAT, new FloatType());        register(soapTM, long.class, ENCODED_LONG, new LongType());        register(soapTM, char.class,ENCODED_CHAR,new CharacterType());        register(soapTM, Character.class,ENCODED_CHAR,new CharacterType());        register(soapTM, String.class, ENCODED_STRING, new StringType());        register(soapTM, Boolean.class, ENCODED_BOOLEAN, new BooleanType());        register(soapTM, Integer.class, ENCODED_INT, new IntType());        register(soapTM, Short.class, ENCODED_SHORT, new ShortType());        register(soapTM, Double.class, ENCODED_DOUBLE, new DoubleType());        register(soapTM, Float.class, ENCODED_FLOAT, new FloatType());        register(soapTM, Long.class, ENCODED_LONG, new LongType());        register(soapTM, Date.class, ENCODED_DATETIME, new DateTimeType());        register(soapTM, java.sql.Date.class, ENCODED_DATETIME, new SqlDateType());        register(soapTM, Calendar.class, ENCODED_DATETIME, new CalendarType());        register(soapTM, byte[].class, ENCODED_BASE64, new Base64Type());        register(soapTM, BigDecimal.class, ENCODED_DECIMAL, new BigDecimalType());        register(soapTM, BigInteger.class, ENCODED_INTEGER, new BigIntegerType());                register(soapTM, boolean.class, XSD_BOOLEAN, new BooleanType());        register(soapTM, int.class, XSD_INT, new IntType());        register(soapTM, short.class, XSD_SHORT, new ShortType());        register(soapTM, double.class, XSD_DOUBLE, new DoubleType());        register(soapTM, float.class, XSD_FLOAT, new FloatType());        register(soapTM, long.class, XSD_LONG, new LongType());        register(soapTM, String.class, XSD_STRING, new StringType());        register(soapTM, Boolean.class, XSD_BOOLEAN, new BooleanType());        register(soapTM, Integer.class, XSD_INT, new IntType());        register(soapTM, Short.class, XSD_SHORT, new ShortType());        register(soapTM, Double.class, XSD_DOUBLE, new DoubleType());        register(soapTM, Float.class, XSD_FLOAT, new FloatType());        register(soapTM, Long.class, XSD_LONG, new LongType());        register(soapTM, Date.class, XSD_DATETIME, new DateTimeType());        register(soapTM, java.sql.Date.class, XSD_DATETIME, new SqlDateType());        register(soapTM, Time.class, XSD_TIME, new TimeType());        register(soapTM, Timestamp.class, XSD_DATETIME, new TimestampType());        register(soapTM, Calendar.class, XSD_DATETIME, new CalendarType());        register(soapTM, byte[].class, XSD_BASE64, new Base64Type());        register(soapTM, BigDecimal.class, XSD_DECIMAL, new BigDecimalType());        register(soapTM, URI.class, XSD_URI, new URIType());        register(soapTM, Document.class, XSD_ANY, new DocumentType());        register(soapTM, Source.class, XSD_ANY, new SourceType());        register(soapTM, XMLStreamReader.class, XSD_ANY, new XMLStreamReaderType());        register(soapTM, Element.class, XSD_ANY, new JDOMElementType());        register(soapTM, org.jdom.Document.class, XSD_ANY, new JDOMDocumentType());        register(soapTM, Object.class, XSD_ANY, new ObjectType());        register(soapTM, DataSource.class, XSD_BASE64, new DataSourceType());        register(soapTM, DataHandler.class, XSD_BASE64, new DataHandlerType());        register(soapTM, BigInteger.class, XSD_INTEGER, new BigIntegerType());                register(ENCODED_NS, soapTM);                register(SoapConstants.XSD, tm);        registerDefault(tm);        return tm;    }        protected void createDefaultMappings(TypeMapping tm)    {        register(tm, boolean.class, XSD_BOOLEAN, new BooleanType());        register(tm, int.class, XSD_INT, new IntType());        register(tm, short.class, XSD_SHORT, new ShortType());        register(tm, double.class, XSD_DOUBLE, new DoubleType());        register(tm, float.class, XSD_FLOAT, new FloatType());        register(tm, long.class, XSD_LONG, new LongType());        register(tm, char.class, XSD_STRING, new CharacterType());        register(tm, Character.class, XSD_STRING, new CharacterType());        register(tm, String.class, XSD_STRING, new StringType());        register(tm, Boolean.class, XSD_BOOLEAN, new BooleanType());        register(tm, Integer.class, XSD_INT, new IntType());        register(tm, Short.class, XSD_SHORT, new ShortType());        register(tm, Double.class, XSD_DOUBLE, new DoubleType());        register(tm, Float.class, XSD_FLOAT, new FloatType());        register(tm, Long.class, XSD_LONG, new LongType());        register(tm, Date.class, XSD_DATETIME, new DateTimeType());        register(tm, java.sql.Date.class, XSD_DATETIME, new SqlDateType());        register(tm, Time.class, XSD_TIME, new TimeType());        register(tm, Timestamp.class, XSD_DATETIME, new TimestampType());        register(tm, Calendar.class, XSD_DATETIME, new CalendarType());        register(tm, byte[].class, XSD_BASE64, new Base64Type());        register(tm, BigDecimal.class, XSD_DECIMAL, new BigDecimalType());        register(tm, BigInteger.class, XSD_INTEGER, new BigIntegerType());        register(tm, URI.class, XSD_URI, new URIType());        register(tm, Document.class, XSD_ANY, new DocumentType());        register(tm, Source.class, XSD_ANY, new SourceType());        register(tm, XMLStreamReader.class, XSD_ANY, new XMLStreamReaderType());        register(tm, Element.class, XSD_ANY, new JDOMElementType());        register(tm, org.jdom.Document.class, XSD_ANY, new JDOMDocumentType());        register(tm, Object.class, XSD_ANY, new ObjectType());        register(tm, DataSource.class, XSD_BASE64, new DataSourceType());        register(tm, DataHandler.class, XSD_BASE64, new DataHandlerType());        if ( isJDK5andAbove())        {            registerIfAvailable(tm, "javax.xml.datatype.Duration", XSD_DURATION, "org.codehaus.xfire.aegis.type.java5.DurationType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_DATE, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_TIME, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_G_DAY, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_G_MONTH, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_G_MONTH_DAY, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_G_YEAR, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_G_YEAR_MONTH, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");            registerIfAvailable(tm, "javax.xml.datatype.XMLGregorianCalendar", XSD_DATETIME, "org.codehaus.xfire.aegis.type.java5.XMLGregorianCalendarType");        }    }    protected void registerIfAvailable(TypeMapping tm, String className, QName typeName, String typeClassName)    {        try        {            Class cls = ClassLoaderUtils.loadClass(className, getClass());            Class typeCls = ClassLoaderUtils.loadClass(typeClassName, getClass());            try            {                Type type = (Type) typeCls.newInstance();                                register(tm, cls, typeName, type);            }            catch (InstantiationException e)            {                throw new XFireRuntimeException("Couldn't instantiate Type ", e);            }            catch (IllegalAccessException e)            {                throw new XFireRuntimeException("Couldn't instantiate Type ", e);            }        }        catch (ClassNotFoundException e)        {            logger.debug("Could not find optional Type " + className +". Skipping.");        }            }    protected void register(TypeMapping tm, Class class1, QName name, Type type)    {        if (!getConfiguration().isDefaultNillable())        {            type.setNillable(false);        }                tm.register(class1, name, type);    }    public Configuration getConfiguration()    {        return typeConfiguration;    }    public void setConfiguration(Configuration typeConfiguration)    {        this.typeConfiguration = typeConfiguration;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -