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


Java Context.getProperties方法代码示例

本文整理汇总了Java中org.switchyard.Context.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getProperties方法的具体用法?Java Context.getProperties怎么用?Java Context.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.switchyard.Context的用法示例。


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

示例1: mapTo

import org.switchyard.Context; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void mapTo(Context context, IndexedRecordBindingData target) throws Exception {
    super.mapTo(context, target);

    IndexedRecord record = target.getRecord();
    for (Property property : context.getProperties()) {
        String name = property.getName();
        Object value = property.getValue();
        if (value == null) {
            continue;
        }
        if (name.equals(JCAConstants.CCI_RECORD_NAME_KEY)) {
            record.setRecordName(value.toString());
        } else if (name.equals(JCAConstants.CCI_RECORD_SHORT_DESC_KEY)) {
            record.setRecordShortDescription(value.toString());
        } else if (matches(name)) {
            record.add(name + "=" + value);
        }  else if (matches(name, getIncludeRegexes(), new ArrayList<Pattern>())) {
            record.add(name + "=" + value);
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:27,代码来源:IndexedRecordContextMapper.java

示例2: mapTo

import org.switchyard.Context; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void mapTo(Context context, StreamableRecordBindingData target) throws Exception {
    StreamableRecord record = target.getRecord();
    for (Property property : context.getProperties()) {
        String name = property.getName();
        Object value = property.getValue();
        if (value == null) {
            continue;
        }
        if (name.equals(JCAConstants.CCI_RECORD_NAME_KEY)) {
            record.setRecordName(value.toString());
        } else if (name.equals(JCAConstants.CCI_RECORD_SHORT_DESC_KEY)) {
            record.setRecordShortDescription(value.toString());
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:20,代码来源:StreamableRecordContextMapper.java

示例3: mapTo

import org.switchyard.Context; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void mapTo(Context context, MappedRecordBindingData target) throws Exception {
    super.mapTo(context, target);

    MappedRecord record = target.getRecord();
    for (Property property : context.getProperties()) {
        String name = property.getName();
        Object value = property.getValue();
        if (value == null) {
            continue;
        }
        if (name.equals(JCAConstants.CCI_RECORD_NAME_KEY)) {
            record.setRecordName(value.toString());
        } else if (name.equals(JCAConstants.CCI_RECORD_SHORT_DESC_KEY)) {
            record.setRecordShortDescription(value.toString());
        } else if (matches(name)) {
            record.put(name, value);
        } else if (matches(name, getIncludeRegexes(), new ArrayList<Pattern>())) {
            record.put(name, value);
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:27,代码来源:MappedRecordContextMapper.java

示例4: copyProperties

import org.switchyard.Context; //导入方法依赖的package包/类
private void copyProperties(Context context, Exchange exchange) {
    for (Property property : context.getProperties()) {
        if (property.hasLabel(BehaviorLabel.TRANSIENT.label()) 
                || ContextPropertyUtil.isReservedProperty(property.getName(), property.getScope())) {
            continue;
        }

        if (Scope.EXCHANGE.equals(property.getScope())) {
            exchange.setProperty(property.getName(), property.getValue());
        } else {
            exchange.getIn().setHeader(property.getName(), property.getValue());
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:15,代码来源:CamelTransformer.java

示例5: copy

import org.switchyard.Context; //导入方法依赖的package包/类
/**
 * Copy properties from source context to destination context. Properties with
 * TRANSIENT label will be skipped.
 * 
 * @param source Source context.
 * @param destination Destination context.
 * @return Destination context.
 */
public static Context copy(Context source, Context destination) {
    for (Property property : source.getProperties()) {
        if (!property.hasLabel(BehaviorLabel.TRANSIENT.label())) {
            destination.setProperty(property.getName(), property.getValue())
                .addLabels(property.getLabels());
        }
    }
    return destination;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:18,代码来源:ContextUtil.java

示例6: mapTo

import org.switchyard.Context; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings("unchecked")
public void mapTo(Context context, RESTEasyBindingData target) throws Exception {
    super.mapTo(context, target);

    Map<String, List<String>> httpHeaders = target.getHeaders();
    for (Property property : context.getProperties()) {
        String name = property.getName();
        Object value = property.getValue();
        if ((value != null) && (matches(name) || property.hasLabel(EndpointLabel.HTTP.label()))) {
            if (HTTP_RESPONSE_STATUS.equals(name)) {
                target.setStatusCode((Integer)property.getValue());
            } else {
                if (value instanceof List) {
                    List<String> stringList = new ArrayList<String>();
                    for (Object obj : ((List)value)) {
                        if (obj != null) {
                            stringList.add(obj.toString());
                        } else {
                            stringList.add(null);
                        }
                    }
                    httpHeaders.put(name, stringList);
                } else if (value instanceof String) {
                    List<String> list = new ArrayList<String>();
                    list.add(String.valueOf(value));
                    httpHeaders.put(name, list);
                }
            }
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:36,代码来源:RESTEasyContextMapper.java


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