本文整理汇总了Java中org.jboss.dmr.ModelNode.asPropertyList方法的典型用法代码示例。如果您正苦于以下问题:Java ModelNode.asPropertyList方法的具体用法?Java ModelNode.asPropertyList怎么用?Java ModelNode.asPropertyList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.dmr.ModelNode
的用法示例。
在下文中一共展示了ModelNode.asPropertyList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateParameter
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
@Override
public void validateParameter(String parameterName, ModelNode values) throws OperationFailedException {
for (Property property : values.asPropertyList()) {
if (!VALID_PROPERTIES.containsKey(property.getName())) {
throw new OperationFailedException("Invalid property name: " + property.getName());
}
if (!VALID_PROPERTIES.get(property.getName()).contains(property.getValue().asString().toUpperCase())) {
throw new OperationFailedException(
"Invalid value of property " + property.getName() + ": " + property.getValue());
}
}
}
示例2: writeContent
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
final ModelNode node = context.getModelNode();
final ModelNode mbean = node.get(SmppMbeanDefinition.MBEAN);
for (Property mbeanProp : mbean.asPropertyList()) {
writer.writeStartElement(SmppMbeanDefinition.MBEAN);
final ModelNode mbeanEntry = mbeanProp.getValue();
SmppMbeanDefinition.NAME_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
SmppMbeanDefinition.TYPE_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
final ModelNode property = mbeanEntry.get(SmppMbeanPropertyDefinition.PROPERTY);
if (property != null && property.isDefined()) {
for (Property propertyProp : property.asPropertyList()) {
writer.writeStartElement(SmppMbeanPropertyDefinition.PROPERTY);
final ModelNode propertyEntry = propertyProp.getValue();
SmppMbeanPropertyDefinition.NAME_ATTR.marshallAsAttribute(propertyEntry, true, writer);
SmppMbeanPropertyDefinition.TYPE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
SmppMbeanPropertyDefinition.VALUE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
writer.writeEndElement();
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}