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

📄 arrayentrypointresolver.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: ArrayEntryPointResolver.java 12539 2008-08-20 19:40:19Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.model.resolvers;import org.mule.api.MuleEventContext;import org.mule.api.transformer.TransformerException;import org.mule.util.ClassUtils;/** * Will resolver entry point methods on a service service that accept a single array. * i.e. * <code>public Object eat(Fruit[] fruit)</code> * <p/> * This resolver will NOT resolve method entry points such as - * <code>public Object eat(Fruit[] fruit, Banana banana)</code> * <p/> * If you require to mix an array type with complex types you need to specify an inbound transformer that return a * multi-dimensional array of arguments i.e. * <code>new Object[]{new Fruit[]{new Apple(), new Orange()}, new Banana()};</code> */public class ArrayEntryPointResolver extends AbstractArgumentEntryPointResolver{    //@java.lang.Override    protected Class[] getMethodArgumentTypes(Object[] payload)    {        return ClassUtils.getClassTypes(payload);    }    //@java.lang.Override    protected Object[] getPayloadFromMessage(MuleEventContext context) throws TransformerException    {        Object temp;        if (isTransformFirst())        {            temp = context.transformMessage();        }        else        {            temp = context.getMessage().getPayload();        }        if (temp instanceof Object[])        {            return new Object[]{temp};        }        else        {            //Payload type not supported by this resolver            return null;        }    }}

⌨️ 快捷键说明

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