当前位置: 首页>>代码示例>>Java>>正文


Java JavaUtils类代码示例

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


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

示例1: writeSimpleTypeSetter

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
/**
   * Method writeSimpleTypeSetter
   *
   * @param simpleValueType
   */
  protected void writeSimpleTypeSetter(String simpleValueType) {

      String wrapper = JavaUtils.getWrapper(simpleValueType);

      if (wrapper != null) {
          pw.println("        this._value = new " + wrapper
                  + "(_value).toString();");
      } else {
          if (simpleValueType.equals("byte[]")) {
String encoder = getBinaryTypeEncoderName ("_value");
              pw.println(
                      "        this._value = _value == null ? null : " +
	encoder + ".encode(_value);");
          } else if (simpleValueType.equals("java.util.Calendar")) {
              pw.println(
                      "        this._value = _value == null ? null : new org.apache.axis.encoding.ser.CalendarSerializer().getValueAsString(_value, null);");
          } else {
              pw.println(
                      "        this._value = _value == null ? null : _value.toString();");
          }
      }
  }
 
开发者ID:swarmbox,项目名称:netsuite-export,代码行数:28,代码来源:JavaBeanWriter.java

示例2: extractFromHolders

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
private Object[] extractFromHolders(Object[] objects, List parameterDescs, int inParameterCount) throws JavaUtils.HolderException {
    if (objects.length != parameterDescs.size()) {
        throw new IllegalArgumentException("Mismatch parameter count: expected: " + parameterDescs.size() + ", actual: " + objects.length);
    }
    Object[] unwrapped = new Object[inParameterCount];
    int j = 0;
    for (int i = 0; objects != null && i < objects.length; i++) {
        Object parameter = objects[i];
        ParameterDesc parameterDesc = (ParameterDesc) parameterDescs.get(i);

        if (parameterDesc.getMode() == ParameterDesc.INOUT) {
            unwrapped[j++] = JavaUtils.getHolderValue(parameter);
        } else if (parameterDesc.getMode() == ParameterDesc.IN) {
            unwrapped[j++] = parameter;
        }
    }
    return unwrapped;
}
 
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:ServiceEndpointMethodInterceptor.java

示例3: getAddInputParamButton

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
/**
 * This method initializes jButton
 * 
 * @return javax.swing.JButton
 */
private JButton getAddInputParamButton() {
    if (addInputParamButton == null) {
        addInputParamButton = new JButton(PortalLookAndFeel.getAddIcon());
        addInputParamButton.setText("Add");
        addInputParamButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                if (getInputNamespaceTypesJTree().getCurrentNode() instanceof SchemaElementTypeTreeNode) {
                    NamespaceType nt = ((NamespaceType) ((NamespaceTypeTreeNode) getInputNamespaceTypesJTree()
                        .getCurrentNode().getParent()).getUserObject());
                    SchemaElementType st = ((SchemaElementType) ((SchemaElementTypeTreeNode) getInputNamespaceTypesJTree()
                        .getCurrentNode()).getUserObject());
                    MethodTypeInputsInput input = new MethodTypeInputsInput();
                    input.setQName(new QName(nt.getNamespace(), st.getType()));
                    input.setIsArray(false);
                    input.setName(CommonTools.lowerCaseFirstCharacter(JavaUtils.xmlNameToJava(st.getType())));
                    getInputParamTable().addRow(input);
                } else {
                    JOptionPane.showMessageDialog(MethodViewer.this, "Please select a type to add");
                }
            }

        });
    }
    return addInputParamButton;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:31,代码来源:MethodViewer.java

示例4: getInputNamespaceTypesJTree

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
/**
 * This method initializes namespaceTypesJTree
 * 
 * @return javax.swing.JTree
 */
private NamespacesJTree getInputNamespaceTypesJTree() {
    if (inputNamespaceTypesJTree == null) {
        inputNamespaceTypesJTree = new NamespacesJTree(info.getNamespaces(), true);
        inputNamespaceTypesJTree.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    if (getInputNamespaceTypesJTree().getCurrentNode() instanceof SchemaElementTypeTreeNode) {
                        NamespaceType nt = ((NamespaceType) ((NamespaceTypeTreeNode) getInputNamespaceTypesJTree()
                            .getCurrentNode().getParent()).getUserObject());
                        SchemaElementType st = ((SchemaElementType) ((SchemaElementTypeTreeNode) getInputNamespaceTypesJTree()
                            .getCurrentNode()).getUserObject());
                        MethodTypeInputsInput input = new MethodTypeInputsInput();
                        input.setQName(new QName(nt.getNamespace(), st.getType()));
                        input.setIsArray(false);
                        input.setName(CommonTools.lowerCaseFirstCharacter(JavaUtils.xmlNameToJava(st.getType())));
                        getInputParamTable().addRow(input);
                    }
                }
            }
        });
    }
    return inputNamespaceTypesJTree;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:29,代码来源:MethodViewer.java

示例5: getClassModifiers

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
/**
 * Returns the appropriate extends text
 *
 * @return "" or "abstract "
 */
protected String getClassModifiers() {

    Node node = type.getNode();

    if (node != null) {
        if (JavaUtils.isTrueExplicitly(Utils.getAttribute(node,
                "abstract"))) {
            return super.getClassModifiers() + "abstract ";
        }
    }

    return super.getClassModifiers();
}
 
开发者ID:swarmbox,项目名称:netsuite-export,代码行数:19,代码来源:JavaBeanWriter.java

示例6: writeToStringMethod

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
/**
 * Writes the toString method
 * Currently the toString method is only written for
 * simpleTypes.
 */
protected void writeToStringMethod() {

    // If this is a simple type, emit a toString
    if (simpleValueTypes.size() == 0) {
        return;
    }

    pw.println("    // " + Messages.getMessage("needToString"));
    pw.println("    public java.lang.String toString() {");

    if (isUnion() || simpleValueTypes.get(0).equals("java.lang.String")) {
        pw.println("        return _value;");
    } else {
        String wrapper =
                JavaUtils.getWrapper((String) simpleValueTypes.get(0));

        if (wrapper != null) {
            pw.println("        return new " + wrapper
                    + "(_value).toString();");
        } else {
            String simpleValueType0 = (String)simpleValueTypes.get(0);
            if (simpleValueType0.equals("byte[]")) {
         String encoder = getBinaryTypeEncoderName ("_value");
                pw.println(
                        "        return _value == null ? null : " +
   encoder + ".encode(_value);");
            } else if (simpleValueType0.equals("java.util.Calendar")) {
                pw.println(
                        "        return _value == null ? null : new org.apache.axis.encoding.ser.CalendarSerializer().getValueAsString(_value, null);");
            } else {
                pw.println(
                        "        return _value == null ? null : _value.toString();");
            }
        }
    }

    pw.println("    }");
    pw.println();
}
 
开发者ID:swarmbox,项目名称:netsuite-export,代码行数:45,代码来源:JavaBeanWriter.java

示例7: BeanDeserializerFactory

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
public BeanDeserializerFactory(Class javaType, QName xmlType) {
    super(BeanDeserializer.class, xmlType, javaType);
    
    // Sometimes an Enumeration class is registered as a Bean.
    // If this is the case, silently switch to the EnumDeserializer
    if (JavaUtils.isEnumClass(javaType)) {
        deserClass = EnumDeserializer.class;
    }

    typeDesc = TypeDesc.getTypeDescForClass(javaType);
    propertyMap = getProperties(javaType, typeDesc);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:13,代码来源:BeanDeserializerFactory.java

示例8: putInHolders

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
private void putInHolders(Map outputParameters, Object[] objects, List parameterDescs) throws JavaUtils.HolderException {
    for (int i = 0; i < objects.length; i++) {
        Object parameter = objects[i];
        ParameterDesc parameterDesc = (ParameterDesc) parameterDescs.get(i);
        if ((parameterDesc.getMode() == ParameterDesc.INOUT) || (parameterDesc.getMode() == ParameterDesc.OUT)) {
            Object returned = outputParameters.get(parameterDesc.getQName());
            if (returned instanceof Holder) {
                //TODO this must be a bug somewhere!!!!
                returned = JavaUtils.getHolderValue(returned);
            }
            JavaUtils.setHolderValue(parameter, returned);
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:15,代码来源:ServiceEndpointMethodInterceptor.java

示例9: addStackTraceFault

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
protected void addStackTraceFault(Throwable exception) {
    String message = exception.getClass().getName();
    String stackTrace = JavaUtils.stackToString(exception);

    // add stack trace fault
    addFaultCause(createStackFault(message, stackTrace));
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:8,代码来源:FaultHelper.java

示例10: writeSimpleTypeGetter

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
/**
 * Method writeSimpleTypeGetter
 *
 * @param simpleValueType
 * @param name
 * @param returnString
 */
protected void writeSimpleTypeGetter(String simpleValueType, String name,
                                     String returnString) {

    // Make sure we wrap base types with its Object type
    String wrapper = JavaUtils.getWrapper(simpleValueType);

    if (wrapper != null) {
        pw.println("        " + returnString + " new " + wrapper
                + "(_value)." + simpleValueType + "Value();");
    } else {
        if (simpleValueType.equals("byte[]")) {
     String encoder = getBinaryTypeEncoderName ("_value");
            pw.println("        " + returnString
                    + " " + encoder + ".decode(_value);");
        } else if (simpleValueType.equals("org.apache.axis.types.URI")) {
            pw.println("        try {");
            pw.println("            " + returnString
                    + " new org.apache.axis.types.URI(_value);");
            pw.println("        }");
            pw.println(
                    "        catch (org.apache.axis.types.URI.MalformedURIException mue) {");
            pw.println(
                    "            throw new java.lang.RuntimeException(mue.toString());");
            pw.println("       }");
        } else if (simpleValueType.equals("java.util.Date")) {
            pw.println("        try {");
            pw.println(
                    "            " + returnString
                    + " (java.text.DateFormat.getDateTimeInstance()).parse(_value);");
            pw.println("        }");
            pw.println("        catch (java.text.ParseException e){");
            pw.println(
                    "            throw new java.lang.RuntimeException(e.toString());");
            pw.println("        }");
        } else if (simpleValueType.equals("java.util.Calendar")) {
            pw.println("        java.util.Calendar cal =");
            pw.println(
                    "            (java.util.Calendar) new org.apache.axis.encoding.ser.CalendarDeserializer(");
            pw.println(
                    "                java.lang.String.class, org.apache.axis.Constants.XSD_STRING).makeValue(_value);");
            pw.println("        " + returnString + " cal;");
        } else if (enumerationTypes.contains(simpleValueType)) {

            // we're generating code that will obtain a reference to an enumeration: use the
            // class forString interface, not the constructor.  Bug 19069
            pw.println("        " + returnString + " " + simpleValueType
                    + ".fromString(_value);");
        } else {
            pw.println("        " + returnString + " new "
                    + simpleValueType + "(_value);");
        }
    }
}
 
开发者ID:swarmbox,项目名称:netsuite-export,代码行数:61,代码来源:JavaBeanWriter.java

示例11: findStubName

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
private String findStubName(Port port) {
	String portName = port.getName();
	if (!JavaUtils.isJavaId(portName))
		portName = Utils.xmlNameToJavaClass(portName);
	return portName;
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:7,代码来源:DynamicWebServiceStubGenerator.java

示例12: demarshallArguments

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
private Object[] demarshallArguments() throws Exception {
    SOAPMessage message = messageContext.getMessage();
    messageContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.TRUE);
    if (message != null) {
        message.saveChanges();
    }

    try {
        Message reqMsg = messageContext.getRequestMessage();
        SOAPEnvelope requestEnvelope = reqMsg.getSOAPEnvelope();
        RPCElement body = getBody(requestEnvelope, messageContext);
        body.setNeedDeser(true);
        Vector args = null;
        try {
            args = body.getParams();
        } catch (SAXException e) {
            if (e.getException() != null) {
                throw e.getException();
            }
            throw e;
        }

        Object[] argValues = new Object[operation.getNumParams()];

        for (int i = 0; i < args.size(); i++) {
            RPCParam rpcParam = (RPCParam) args.get(i);
            Object value = rpcParam.getObjectValue();

            ParameterDesc paramDesc = rpcParam.getParamDesc();

            if (paramDesc != null && paramDesc.getJavaType() != null) {
                value = JavaUtils.convert(value, paramDesc.getJavaType());
                rpcParam.setObjectValue(value);
            }
            int order = (paramDesc == null || paramDesc.getOrder() == -1) ? i : paramDesc.getOrder();
            argValues[order] = value;
        }
        return argValues;
    } finally {
        messageContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:43,代码来源:EjbRpcProvider.java

示例13: doIntercept

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
private Object doIntercept(Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        int index = methodProxy.getSuperIndex();
        OperationInfo operationInfo = operations[index];
        if (operationInfo == null) {
            throw new ServerRuntimeException("Operation not mapped: " + method.getName() + " index: " + index + "\n OperationInfos: " + Arrays.asList(operations));
        }
        stub.checkCachedEndpoint();

        Call call = stub.createCall();

        operationInfo.prepareCall(call);

        stub.setUpCall(call);
        if (credentialsName != null) {
            throw new UnsupportedOperationException("Client side auth is not implementd");
//            Subject subject = ContextManager.getNextCaller();
//            if (subject == null) {
//                throw new IllegalStateException("Subject missing but authentication turned on");
//            } else {
//                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
//                boolean found = false;
//                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
//                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
//                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
//                        call.setUsername(namedUsernamePasswordCredential.getUsername());
//                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
//                        found = true;
//                        break;
//                    }
//                }
//                if (!found) {
//                    throw new IllegalStateException("no NamedUsernamePasswordCredential found for name " + credentialsName);
//                }
//            }
        }
        Object response = null;
        List parameterDescs = operationInfo.getOperationDesc().getParameters();
        Object[] unwrapped = extractFromHolders(objects, parameterDescs, operationInfo.getOperationDesc().getNumInParams());
        if (operationInfo.getOperationDesc().getMep() == OperationType.REQUEST_RESPONSE) {
            try {
                response = call.invoke(unwrapped);
            } catch (RemoteException e) {
                throw operationInfo.unwrapFault(e);
            }

            if (response instanceof RemoteException) {
                throw operationInfo.unwrapFault((RemoteException) response);
            } else {
                stub.extractAttachments(call);
                Map outputParameters = call.getOutputParams();
                putInHolders(outputParameters, objects, parameterDescs);
                Class returnType = operationInfo.getOperationDesc().getReturnClass();
                //return type should never be null... but we are not objecting if wsdl-return-value-mapping is not set.
                if (response == null || returnType == null || returnType.isAssignableFrom(response.getClass())) {
                    return response;
                } else {
                    return JavaUtils.convert(response, returnType);
                }
            }
        } else if (operationInfo.getOperationDesc().getMep() == OperationType.ONE_WAY) {
            //one way
            call.invokeOneWay(unwrapped);
            return null;
        } else {
            throw new ServerRuntimeException("Invalid messaging style: " + operationInfo.getOperationDesc().getMep());
        }
    }
 
开发者ID:apache,项目名称:tomee,代码行数:68,代码来源:ServiceEndpointMethodInterceptor.java

示例14: assertContains

import org.apache.axis.utils.JavaUtils; //导入依赖的package包/类
private static void assertContains(AxisFault f, String msg) {
    String s = JavaUtils.stackToString(f);
    assertTrue(s, s.indexOf(msg) > 0);
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:5,代码来源:DataApiTest.java


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