org.apache.axis2.databinding.utils.BeanUtil.deserialize()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(207)

本文整理了Java中org.apache.axis2.databinding.utils.BeanUtil.deserialize()方法的一些代码示例,展示了BeanUtil.deserialize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BeanUtil.deserialize()方法的具体详情如下:
包路径:org.apache.axis2.databinding.utils.BeanUtil
类名称:BeanUtil
方法名:deserialize

BeanUtil.deserialize介绍

[英]To get JavaObjects from XML element , the element most of the time contains only one element in that case that element will be converted to the JavaType specified by the javaTypes array The algo is as follows, get the childerns of the response element , and if it conatian more than one element then check the retuen type of that element and conver that to corresponding JavaType
[中]要从XML元素中获取JavaObject,该元素大部分时间只包含一个元素。在这种情况下,该元素将转换为javaTypes数组指定的JavaType。算法如下:获取响应元素的子元素,如果它包含多个元素,则检查该元素的retuen类型并将其转换为相应的JavaType

代码示例

代码示例来源:origin: org.apache.axis2/axis2-adb

public static Object[] processRequest(OMElement methodElement,
                   Method method, ObjectSupplier objectSupplier, String[] parameterNames)
    throws AxisFault {
  Class[] parameters = method.getParameterTypes();
  return BeanUtil.deserialize(methodElement, parameters, objectSupplier, parameterNames, method);
}

代码示例来源:origin: apache/axis2-java

public static Object[] processRequest(OMElement methodElement,
                   Method method, ObjectSupplier objectSupplier, String[] parameterNames)
    throws AxisFault {
  Class[] parameters = method.getParameterTypes();
  return BeanUtil.deserialize(methodElement, parameters, objectSupplier, parameterNames, method);
}

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters

try {
  Object[] objects =
      BeanUtil.deserialize(tobeAdapted, parameters.toArray(
          new Object[parameters.size()]), new DefaultObjectSupplier(),
          strings, null);

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters

public Object getAdaptedFacts(ResourceDescription description, String className, OMElement tobeAdapted, Object source) {
  QName qName = getQName(description, className, tobeAdapted);
  if (!qName.equals(tobeAdapted.getQName())) {
    if (log.isDebugEnabled()) {
      log.debug("The source element QName does not match with the expected QName." +
          "[ Source Element QName:  " + tobeAdapted.getQName() + " ] " +
          "[ Expected QName : " + qName + " ].");
    }
    return null;
  }
  try {
    return BeanUtil.deserialize(ClassHelper.loadAClass(className,
        description.getResourceClassLoader()),
        tobeAdapted, new DefaultObjectSupplier(), null);
  } catch (AxisFault axisFault) {
    throw new LoggedRuntimeException("Cannot create a custom Java object " +
        "form XML. Java class is : " + className + " and XML is : " +
        source, log);
  }
}

代码示例来源:origin: org.apache.axis2/axis2-adb

public static Object[] deserialize(OMElement response,
                  Object[] javaTypes,
                  ObjectSupplier objectSupplier,
                  String[] parameterNames,
                  Method method) throws AxisFault {
  /*
   * Take the number of parameters in the method and , only take that much of child elements
   * from the OMElement , other are ignore , as an example
   * if the method is , foo(String a , int b)
   * and if the OMElemet
   * <foo>
   *  <arg0>Val1</arg0>
   *  <arg1>Val2</arg1>
   *  <arg2>Val3</arg2>
   *
   * only the val1 and Val2 take into account
   */
  int length = javaTypes.length;
  int count = 0;
  Object[] retObjs = new Object[length];
  /*
  * If the body first child contains , then there can not be any other element withot
  * refs , so I can assume if the first child of the body first element has ref then
  * the message has to handle as mutiref message.
  * as an exmple if the body is like below
  * <foo>
  *  <arg0 href="#0"/>
  * </foo>
  *

代码示例来源:origin: org.apache.axis2/axis2-adb

partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts);
if (partObj == null) {
  partObj = deserialize(parameters, parts, objectSupplier, null);

代码示例来源:origin: apache/axis2-java

partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts);
if (partObj == null) {
  partObj = deserialize(parameters, parts, objectSupplier, null);

代码示例来源:origin: apache/axis2-java

public static Object[] deserialize(OMElement response,
                  Object[] javaTypes,
                  ObjectSupplier objectSupplier,
                  String[] parameterNames,
                  Method method) throws AxisFault {
  /*
   * Take the number of parameters in the method and , only take that much of child elements
   * from the OMElement , other are ignore , as an example
   * if the method is , foo(String a , int b)
   * and if the OMElemet
   * <foo>
   *  <arg0>Val1</arg0>
   *  <arg1>Val2</arg1>
   *  <arg2>Val3</arg2>
   *
   * only the val1 and Val2 take into account
   */
  int length = javaTypes.length;
  int count = 0;
  Object[] retObjs = new Object[length];
  /*
  * If the body first child contains , then there can not be any other element withot
  * refs , so I can assume if the first child of the body first element has ref then
  * the message has to handle as mutiref message.
  * as an exmple if the body is like below
  * <foo>
  *  <arg0 href="#0"/>
  * </foo>
  *

代码示例来源:origin: org.apache.axis2/axis2-adb

/**
 * @param opName      Operation QName (to get the body wrapper element)
 * @param args        Arraylist of objects
 * @param returnTypes , this array contains the JavaTypes for the return object , it could be
 *                    one or more depending on the return type , most of the type array will
 *                    contain just one element It should be noted that the array should only
 *                    contains JavaTypes NOT real object , what this methods does is , get the
 *                    body first element , and if it contains more than one childern take ith
 *                    element and convert that to ith javatype and fill the return arrya the
 *                    array will look like as follows [Integer, String, MyBean , etc]
 * @return Object array , whic will contains real object , but the object can either be simple
 *         type object or the JavaBeans, thats what this method can handle right now the return
 *         array will contains [10, "Axis2Echo", {"foo","baa","11"}]
 * @throws AxisFault a problem occurred, either locally or on the other side of the wire
 */
public Object[] invokeBlocking(QName opName, Object [] args, Class [] returnTypes)
    throws AxisFault {
  OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null);
  OMElement response;
  if (notNullService) {
    response = super.sendReceive(opName, omElement);
  } else {
    response = super.sendReceive(omElement);
  }
  return BeanUtil.deserialize(response, returnTypes,
                new DefaultObjectSupplier());
}

代码示例来源:origin: apache/axis2-java

/**
 * @param opName      Operation QName (to get the body wrapper element)
 * @param args        Arraylist of objects
 * @param returnTypes , this array contains the JavaTypes for the return object , it could be
 *                    one or more depending on the return type , most of the type array will
 *                    contain just one element It should be noted that the array should only
 *                    contains JavaTypes NOT real object , what this methods does is , get the
 *                    body first element , and if it contains more than one childern take ith
 *                    element and convert that to ith javatype and fill the return arrya the
 *                    array will look like as follows [Integer, String, MyBean , etc]
 * @return Object array , whic will contains real object , but the object can either be simple
 *         type object or the JavaBeans, thats what this method can handle right now the return
 *         array will contains [10, "Axis2Echo", {"foo","baa","11"}]
 * @throws AxisFault a problem occurred, either locally or on the other side of the wire
 */
public Object[] invokeBlocking(QName opName, Object [] args, Class [] returnTypes)
    throws AxisFault {
  OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null);
  OMElement response;
  if (notNullService) {
    response = super.sendReceive(opName, omElement);
  } else {
    response = super.sendReceive(omElement);
  }
  return BeanUtil.deserialize(response, returnTypes,
                new DefaultObjectSupplier());
}

代码示例来源:origin: apache/axis2-java

objectSupplier, generictype);
} else {
  Object obj = BeanUtil.deserialize(javatype, val, this, objectSupplier);
  objectmap.put(id, obj);
  return obj;

代码示例来源:origin: org.apache.axis2/axis2-adb

objectSupplier, generictype);
} else {
  Object obj = BeanUtil.deserialize(javatype, val, this, objectSupplier);
  objectmap.put(id, obj);
  return obj;

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters

return BeanUtil.deserialize(ClassHelper.loadAClass(className,
    description.getResourceClassLoader()),
    tobeAdapted, new DefaultObjectSupplier(), null);

代码示例来源:origin: org.apache.axis2/axis2-adb

Object obj = deserialize(arrayClassType,
             omElement,
             objectSupplier, "array");
  partObj = SimpleTypeMapper.getDataHandler(parts);
} else if (parameters.isArray()) {
  partObj = deserialize(parameters, (OMElement) parts.getParent(),
             objectSupplier, prty.getName());
} else if (SimpleTypeMapper.isMap(parameters)){
  partObj =processEnumObject(parameters , parts);
} else {
  partObj = deserialize(parameters, parts, objectSupplier, null);

代码示例来源:origin: apache/axis2-java

Object obj = deserialize(arrayClassType,
             omElement,
             objectSupplier, "array");
  partObj = SimpleTypeMapper.getDataHandler(parts);
} else if (parameters.isArray()) {
  partObj = deserialize(parameters, (OMElement) parts.getParent(),
             objectSupplier, prty.getName());
} else if (SimpleTypeMapper.isMap(parameters)){
  partObj =processEnumObject(parameters , parts);
} else {
  partObj = deserialize(parameters, parts, objectSupplier, null);

代码示例来源:origin: org.apache.axis2/axis2-adb

return processEnumObject(classType, omElement);
}else {
  return BeanUtil.deserialize(classType, omElement, objectSupplier, null);

代码示例来源:origin: apache/axis2-java

return processEnumObject(classType, omElement);
}else {
  return BeanUtil.deserialize(classType, omElement, objectSupplier, null);

相关文章

微信公众号

最新文章

更多