本文整理汇总了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);
}
}
}
示例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());
}
}
}
示例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);
}
}
}
示例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());
}
}
}
示例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;
}
示例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);
}
}
}
}
}