• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConverterUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.axis2.databinding.utils.ConverterUtil的典型用法代码示例。如果您正苦于以下问题:Java ConverterUtil类的具体用法?Java ConverterUtil怎么用?Java ConverterUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConverterUtil类属于org.apache.axis2.databinding.utils包,在下文中一共展示了ConverterUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startElement

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
  if (XmlConstants.SERVER_INFO.equals(qName)) {
    try {
      URI serverUri = new URI(attributes.getValue(XmlConstants.URI_ATTR));
      myCurrentServerInfo =
        new ServerInfo(serverUri, attributes.getValue(XmlConstants.GUID_ATTR), new TfsBeansHolder(serverUri));
    }
    catch (URISyntaxException e) {
      throw new SAXException(e);
    }
  }
  else if (XmlConstants.WORKSPACE_INFO.equals(qName)) {
    String name = attributes.getValue(XmlConstants.NAME_ATTR);
    String owner = attributes.getValue(XmlConstants.OWNER_NAME_ATTR);
    String computer = attributes.getValue(XmlConstants.COMPUTER_ATTR);
    String comment = attributes.getValue(XmlConstants.COMMENT_ATTR);
    Calendar timestamp = ConverterUtil.convertToDateTime(attributes.getValue(XmlConstants.TIMESTAMP_ATTR));
    myCurrentWorkspaceInfo = new WorkspaceInfo(myCurrentServerInfo, name, owner, computer, comment, timestamp);
  }
  else if (XmlConstants.MAPPED_PATH.equals(qName)) {
    myCurrentWorkspaceInfo
      .addWorkingFolderInfo(new WorkingFolderInfo(VcsUtil.getFilePath(attributes.getValue(XmlConstants.PATH_ATTR), true)));
  }
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:25,代码来源:WorkstationCacheReader.java


示例2: toString

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
/**
 * Returns the time as it would be in GMT. This is accurate to the seconds. Milliseconds
 * probably gets lost.
 *
 * @return Returns String.
 */
public String toString() {
    if (_value == null) {
        return "unassigned Time";
    }

    if (isFromString) {
        return originalString;
    } else {
        StringBuffer timeString = new StringBuffer();
        ConverterUtil.appendTime(_value,timeString);
        ConverterUtil.appendTimeZone(_value,timeString);
        return timeString.toString();
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:Time.java


示例3: writeQName

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
/**
 * method to handle Qnames
 */

private void writeQName(javax.xml.namespace.QName qname,
                        javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
    java.lang.String namespaceURI = qname.getNamespaceURI();
    if (namespaceURI != null) {
        java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
        if (prefix == null) {
            prefix = generatePrefix(namespaceURI);
            xmlWriter.writeNamespace(prefix, namespaceURI);
            xmlWriter.setPrefix(prefix, namespaceURI);
        }

        if (prefix.trim().length() > 0) {
            xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
        } else {
            // i.e this is the default namespace
            xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
        }

    } else {
        xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:Array.java


示例4: writeQName

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
private void writeQName(QName qname,
                        XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
    String namespaceURI = qname.getNamespaceURI();
    if (namespaceURI != null) {
        String prefix = xmlWriter.getPrefix(namespaceURI);
        if (prefix == null) {
            prefix = generatePrefix(namespaceURI);
            xmlWriter.writeNamespace(prefix, namespaceURI);
            xmlWriter.setPrefix(prefix, namespaceURI);
        }

        if (prefix.trim().length() > 0) {
            xmlWriter.writeCharacters(prefix + ":" + ConverterUtil.convertToString(qname));
        } else {
            // i.e this is the default namespace
            xmlWriter.writeCharacters(ConverterUtil.convertToString(qname));
        }

    } else {
        xmlWriter.writeCharacters(ConverterUtil.convertToString(qname));
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:MTOMAwareOMBuilderTest.java


示例5: getDate

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
/**
 * Create a Date object from the given date string.
 */
public static Date getDate(String value) throws DataServiceFault {
    /* if something goes wrong with converting the value to a date,
       * try with dateTime and get the date out it, this is because,
       * some service clients send a full date-time string for a date */
    try {
        java.util.Date date = ConverterUtil.convertToDate(value);
        if (null == date) {
            throw new DataServiceFault("Empty string or null value was found as date.");
        } else {
            return new Date(date.getTime());
        }
    } catch (Exception e) {
        java.util.Calendar calendarDate = ConverterUtil.convertToDateTime(value);
        if (null == calendarDate) {
            throw new DataServiceFault("Empty string or null value was found as date.");
        } else {
            return new Date(calendarDate.getTimeInMillis());
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:24,代码来源:DBUtils.java


示例6: transformComment

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
/**
 * Transforms the CommentDAO to TComment type.
 *
 * @param comment : The CommentDAO to be transformed.
 * @return : The transformed object.
 */
public static TComment transformComment(CommentDAO comment) {

    TComment transformedComment = new TComment();
    Calendar addedAt = Calendar.getInstance();
    addedAt.setTime(comment.getCommentedDate());
    transformedComment.setAddedTime(addedAt);

    TUser commentedBy = new TUser();
    commentedBy.setTUser(comment.getCommentedBy());
    transformedComment.setAddedBy(commentedBy);

    transformedComment.setText(comment.getCommentText());
    transformedComment.setId(ConverterUtil.convertToURI(comment.getId().toString()));

    TUser lastModifiedBy = new TUser();
    if (StringUtils.isNotEmpty(comment.getModifiedBy())) {
        lastModifiedBy.setTUser(comment.getModifiedBy());
    } else {
        lastModifiedBy.setTUser(comment.getCommentedBy());
    }
    transformedComment.setLastModifiedBy(lastModifiedBy);

    Calendar modifiedAt = Calendar.getInstance();
    if (comment.getModifiedDate() != null) {
        modifiedAt.setTime(comment.getModifiedDate());
    } else {
        modifiedAt.setTime(comment.getCommentedDate());
    }
    transformedComment.setLastModifiedTime(modifiedAt);

    return transformedComment;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:39,代码来源:TransformerUtils.java


示例7: transformTaskEvents

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public static TTaskEvents transformTaskEvents(TaskDAO task, String caller) {
    TTaskEvents taskEvents = new TTaskEvents();

    if (task.getEvents() != null) {
        for (EventDAO taskEvent : task.getEvents()) {
            TTaskEvent tEvent = new TTaskEvent();
            tEvent.setEventDetail(taskEvent.getDetails());
            tEvent.setEventId(ConverterUtil.convertToURI(taskEvent.getId().toString()));


            TUser user = new TUser();
            user.setTUser(taskEvent.getUser());
            tEvent.setEventInitiator(user);

            //Set the created time
            Calendar eventTime = Calendar.getInstance();
            eventTime.setTime(taskEvent.getTimeStamp());
            tEvent.setEventTime(eventTime);


            tEvent.setEventType(taskEvent.getType().toString().toLowerCase());
            tEvent.setNewState(transformStatus(taskEvent.getNewState()));
            tEvent.setOldState(transformStatus(taskEvent.getOldState()));

            taskEvents.addEvent(tEvent);
        }
    }

    return taskEvents;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:31,代码来源:TransformerUtils.java


示例8: getSubscription

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
/**
 * creates the subscription object from the subscription resource
 *
 * @param subscriptionResource
 * @return
 */
public static Subscription getSubscription(Resource subscriptionResource) {

    Subscription subscription = new Subscription();
    subscription.setTenantId(CarbonContext.getThreadLocalCarbonContext().getTenantId());
    Properties properties = subscriptionResource.getProperties();
    if ((properties != null) && (!properties.isEmpty())) {
        for (Enumeration enumeration = properties.propertyNames(); enumeration.hasMoreElements();) {
            String propertyName = (String) enumeration.nextElement();
            if (EventBrokerConstants.EB_RES_SUBSCRIPTION_URL.equals(propertyName)) {
                subscription.setEventSinkURL(
                        subscriptionResource.getProperty(EventBrokerConstants.EB_RES_SUBSCRIPTION_URL));
            } else if (EventBrokerConstants.EB_RES_EVENT_DISPATCHER_NAME.equals(propertyName)) {
                subscription.setEventDispatcherName(
                        subscriptionResource.getProperty(EventBrokerConstants.EB_RES_EVENT_DISPATCHER_NAME));
            } else if (EventBrokerConstants.EB_RES_EXPIRS.equals(propertyName)) {
                subscription.setExpires(
                        ConverterUtil.convertToDateTime(
                                subscriptionResource.getProperty(EventBrokerConstants.EB_RES_EXPIRS)));
            } else if (EventBrokerConstants.EB_RES_OWNER.equals(propertyName)) {
                subscription.setOwner(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_OWNER));
            } else if (EventBrokerConstants.EB_RES_TOPIC_NAME.equals(propertyName)) {
                subscription.setTopicName(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_TOPIC_NAME));
            } else if (EventBrokerConstants.EB_RES_CREATED_TIME.equals(propertyName)) {
                subscription.setCreatedTime(new Date(Long.parseLong(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_CREATED_TIME))));
            } else if (EventBrokerConstants.EB_RES_MODE.equals(propertyName)) {
                subscription.setMode(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_MODE));
            } else {
                subscription.addProperty(propertyName, subscriptionResource.getProperty(propertyName));
            }
        }
    }
    return subscription;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:40,代码来源:JavaUtil.java


示例9: getJMSSubscriptions

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Subscription[] getJMSSubscriptions(String topicName) throws EventBrokerException {
    try {
        Subscription[] subscriptionsArray = new Subscription[0];

        UserRegistry userRegistry =
                this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
        String resourcePath = JavaUtil.getResourcePath(topicName, this.topicStoragePath);
        if (!resourcePath.endsWith("/")) {
            resourcePath = resourcePath + "/";
        }
        resourcePath = resourcePath + EventBrokerConstants.EB_CONF_JMS_SUBSCRIPTION_COLLECTION_NAME;

        // Get subscriptions
        if (userRegistry.resourceExists(resourcePath)) {
            Collection subscriptionCollection = (Collection) userRegistry.get(resourcePath);
            subscriptionsArray =
                    new Subscription[subscriptionCollection.getChildCount()];

            int index = 0;
            for (String subs : subscriptionCollection.getChildren()) {
                Collection subscription = (Collection) userRegistry.get(subs);

                Subscription subscriptionDetails = new Subscription();
                subscriptionDetails.setId(subscription.getProperty("Name"));
                subscriptionDetails.setOwner(subscription.getProperty("Owner"));
                subscriptionDetails.setCreatedTime(ConverterUtil.convertToDate(subscription.getProperty("createdTime")));

                subscriptionsArray[index++] = subscriptionDetails;
            }
        }

        return subscriptionsArray;
    } catch (RegistryException e) {
        throw new EventBrokerException("Cannot read the registry resources ", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:41,代码来源:RegistryTopicManager.java


示例10: testCalender

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public void testCalender() throws AxisFault {
    RPCServiceClient sender = getRPCClient("EchoXMLService", "echoCalander");

    ArrayList args = new ArrayList();
    Calendar calendar = Calendar.getInstance();
    args.add(ConverterUtil.convertToString(calendar));
    OMElement response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoCalander", "req"), args.toArray());
    assertEquals(response.getFirstElement().getText(), ConverterUtil.convertToString(calendar));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:RPCCallTest.java


示例11: getElementText

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public String getElementText() throws XMLStreamException {
    if (state == START_ELEMENT) {
        //move to the end state and return the value
        state = END_ELEMENT_STATE;
        if (convertedText == null) {
            convertedText = ConverterUtil.getStringFromDatahandler(value);
        }
        return convertedText;
    } else {
        throw new XMLStreamException();
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:ADBDataHandlerStreamReader.java


示例12: getText

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public String getText() {
    if (state == TEXT_STATE) {
        if (convertedText == null) {
            convertedText =
                    ConverterUtil.getStringFromDatahandler(value);
        }
        return convertedText;
    } else {
        throw new IllegalStateException();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:12,代码来源:ADBDataHandlerStreamReader.java


示例13: getTextCharacters

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public char[] getTextCharacters() {
    if (state == TEXT_STATE) {
        if (convertedText == null) {
            convertedText =
                    ConverterUtil.getStringFromDatahandler(value);
        }
        return convertedText.toCharArray();
    } else {
        throw new IllegalStateException();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:12,代码来源:ADBDataHandlerStreamReader.java


示例14: getTextLength

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public int getTextLength() {
    if (state == TEXT_STATE) {
        if (convertedText == null) {
            convertedText =
                    ConverterUtil.getStringFromDatahandler(value);
        }
        return convertedText.length();
    } else {
        throw new IllegalStateException();
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:ADBDataHandlerStreamReader.java


示例15: getText

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public String getText() {
    if (state == DELEGATED_STATE) {
        return childReader.getText();
    } else if (state == TEXT_STATE) {
        Object property = properties[currentPropertyIndex - 1];
        if (property instanceof DataHandler){
            return ConverterUtil.getStringFromDatahandler((DataHandler)property);
        } else {
            return (String)properties[currentPropertyIndex - 1];
        }
    } else {
        throw new IllegalStateException();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:ADBXMLStreamReaderImpl.java


示例16: writeQNames

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
private void writeQNames(javax.xml.namespace.QName[] qnames,
                         javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

    if (qnames != null) {
        // we have to store this data until last moment since it is not possible to write any
        // namespace data after writing the charactor data
        java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
        java.lang.String namespaceURI = null;
        java.lang.String prefix = null;

        for (int i = 0; i < qnames.length; i++) {
            if (i > 0) {
                stringToWrite.append(" ");
            }
            namespaceURI = qnames[i].getNamespaceURI();
            if (namespaceURI != null) {
                prefix = xmlWriter.getPrefix(namespaceURI);
                if ((prefix == null) || (prefix.length() == 0)) {
                    prefix = generatePrefix(namespaceURI);
                    xmlWriter.writeNamespace(prefix, namespaceURI);
                    xmlWriter.setPrefix(prefix, namespaceURI);
                }

                if (prefix.trim().length() > 0) {
                    stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
                } else {
                    stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
                }
            } else {
                stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
            }
        }
        xmlWriter.writeCharacters(stringToWrite.toString());
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:37,代码来源:Array.java


示例17: getStringValue

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public static String getStringValue(Object obj) {
    if (obj instanceof Float ||
            obj instanceof Double) {
        double data;
        if (obj instanceof Float) {
            data = ((Float)obj).doubleValue();
        } else {
            data = (Double)obj;
        }
        if (Double.isNaN(data)) {
            return "NaN";
        } else if (data == Double.POSITIVE_INFINITY) {
            return "INF";
        } else if (data == Double.NEGATIVE_INFINITY) {
            return "-INF";
        } else {
            return obj.toString();
        }
    } else if (obj instanceof Calendar) {
        Calendar calendar = (Calendar) obj;
        return ConverterUtil.convertToString(calendar);
    } else if (obj instanceof Date) {
        SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");

        MessageContext messageContext = MessageContext.getCurrentMessageContext();
        if (messageContext != null) {
            AxisService axisServce = messageContext.getAxisService();
            // if the user has given a pirticualr timezone we use it.
            if (axisServce.getParameter("TimeZone") != null) {
                zulu.setTimeZone(TimeZone.getTimeZone((String) axisServce.getParameter("TimeZone").getValue()));
            }
        }
        return zulu.format(obj);
    } else if (obj instanceof URI){
        return obj.toString();
    } else if (obj instanceof BigDecimal) {
    	 return ((BigDecimal) obj).toPlainString();
    }
    return obj.toString();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:41,代码来源:SimpleTypeMapper.java


示例18: writeQNames

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
private void writeQNames(QName[] qnames,
                         XMLStreamWriter xmlWriter) throws XMLStreamException {

    if (qnames != null) {
        // we have to store this data until last moment since it is not possible to write any
        // namespace data after writing the charactor data
        StringBuffer stringToWrite = new StringBuffer();
        String namespaceURI = null;
        String prefix = null;

        for (int i = 0; i < qnames.length; i++) {
            if (i > 0) {
                stringToWrite.append(" ");
            }
            namespaceURI = qnames[i].getNamespaceURI();
            if (namespaceURI != null) {
                prefix = xmlWriter.getPrefix(namespaceURI);
                if ((prefix == null) || (prefix.length() == 0)) {
                    prefix = generatePrefix(namespaceURI);
                    xmlWriter.writeNamespace(prefix, namespaceURI);
                    xmlWriter.setPrefix(prefix, namespaceURI);
                }

                if (prefix.trim().length() > 0) {
                    stringToWrite.append(prefix).append(":").append(ConverterUtil.convertToString(qnames[i]));
                } else {
                    stringToWrite.append(ConverterUtil.convertToString(qnames[i]));
                }
            } else {
                stringToWrite.append(ConverterUtil.convertToString(qnames[i]));
            }
        }
        xmlWriter.writeCharacters(stringToWrite.toString());
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:37,代码来源:MTOMAwareOMBuilderTest.java


示例19: testPopulate

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public void testPopulate() throws Exception {
    // Skip for JDK1.4
    if (System.getProperty("java.version").startsWith("1.4.")) {
        return;
    }
    Calendar calendar;
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
    for (int i = 0; i < values.length; i++) {
        calendar = ConverterUtil.convertToDateTime(values[i]);
        checkValue(xmlString[i],ConverterUtil.convertToString(calendar));
   }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:SimpleTypeDateTimePopulateTest.java


示例20: testPopulate

import org.apache.axis2.databinding.utils.ConverterUtil; //导入依赖的package包/类
public void testPopulate() throws Exception {

        Date date = null;

        for (int i = 0; i < values.length; i++) {
            date = ConverterUtil.convertToDate(values[i]);
            checkValue(xmlString[i],ConverterUtil.convertToString(date));
        }
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:SimpleTypeDatePopulateTest.java



注:本文中的org.apache.axis2.databinding.utils.ConverterUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PDJpeg类代码示例发布时间:2022-05-22
下一篇:
Java NetServer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap