Source:
<code>static void addTransformations(ModelVersion version, ResourceTransformationDescriptionBuilder builder) { if (JGroupsModel.VERSION_3_0_0.requiresTransformation(version)) { AttributeConverter typeConverter = new AttributeConverter.DefaultAttributeConverter() { @Override protected void convertAttribute(PathAddress address, String name, ModelNode value, TransformationContext context) { if (!value.isDefined()) { value.set(address.getLastElement().getValue()); } } }; builder.getAttributeBuilder() .setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(MODULE.getDefaultValue()), MODULE) .addRejectCheck(RejectAttributeChecker.DEFINED, MODULE) .setValueConverter(typeConverter, TYPE) .end(); OperationTransformer putPropertyTransformer = new OperationTransformer() { @Override public ModelNode transformOperation(ModelNode operation) { if (operation.get(ModelDescriptionConstants.NAME).asString().equals(PROPERTIES.getName())) { String key = operation.get("key").asString(); ModelNode value = operation.get(ModelDescriptionConstants.VALUE); PathAddress address = Operations.getPathAddress(operation); ModelNode transformedOperation = Util.createAddOperation(address.append(PropertyResourceDefinition.pathElement(key))); transformedOperation.get(PropertyResourceDefinition.VALUE.getName()).set(value); return transformedOperation; } return operation; } }; builder.addRawOperationTransformationOverride(MapOperations.MAP_PUT_DEFINITION.getName(), new SimpleOperationTransformer(putPropertyTransformer)); OperationTransformer removePropertyTransformer = new OperationTransformer() { @Override public ModelNode transformOperation(ModelNode operation) { if (operation.get(ModelDescriptionConstants.NAME).asString().equals(PROPERTIES.getName())) { String key = operation.get("key").asString(); PathAddress address = Operations.getPathAddress(operation); return Util.createRemoveOperation(address.append(PropertyResourceDefinition.pathElement(key))); } return operation; } }; builder.addRawOperationTransformationOverride(MapOperations.MAP_PUT_DEFINITION.getName(), new SimpleOperationTransformer(removePropertyTransformer)); <START> builder.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, PROPERTIES); <END> } if (JGroupsModel.VERSION_1_2_0.requiresTransformation(version)) { builder.getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, PROPERTIES) .end(); } }</code><technical_language>Reject if defined</technical_language>

Target:
static void addTransformations(ModelVersion version, ResourceTransformationDescriptionBuilder builder) { if (JGroupsModel.VERSION_3_0_0.requiresTransformation(version)) { AttributeConverter typeConverter = new AttributeConverter.DefaultAttributeConverter() { @Override protected void convertAttribute(PathAddress address, String name, ModelNode value, TransformationContext context) { if (!value.isDefined()) { value.set(address.getLastElement().getValue()); } } }; builder.getAttributeBuilder() .setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(MODULE.getDefaultValue()), MODULE) .addRejectCheck(RejectAttributeChecker.DEFINED, MODULE) .setValueConverter(typeConverter, TYPE) .end(); OperationTransformer putPropertyTransformer = new OperationTransformer() { @Override public ModelNode transformOperation(ModelNode operation) { if (operation.get(ModelDescriptionConstants.NAME).asString().equals(PROPERTIES.getName())) { String key = operation.get("key").asString(); ModelNode value = operation.get(ModelDescriptionConstants.VALUE); PathAddress address = Operations.getPathAddress(operation); ModelNode transformedOperation = Util.createAddOperation(address.append(PropertyResourceDefinition.pathElement(key))); transformedOperation.get(PropertyResourceDefinition.VALUE.getName()).set(value); return transformedOperation; } return operation; } }; builder.addRawOperationTransformationOverride(MapOperations.MAP_PUT_DEFINITION.getName(), new SimpleOperationTransformer(putPropertyTransformer)); OperationTransformer removePropertyTransformer = new OperationTransformer() { @Override public ModelNode transformOperation(ModelNode operation) { if (operation.get(ModelDescriptionConstants.NAME).asString().equals(PROPERTIES.getName())) { String key = operation.get("key").asString(); PathAddress address = Operations.getPathAddress(operation); return Util.createRemoveOperation(address.append(PropertyResourceDefinition.pathElement(key))); } return operation; } }; builder.addRawOperationTransformationOverride(MapOperations.MAP_REMOVE_DEFINITION.getName(), new SimpleOperationTransformer(removePropertyTransformer)); } if (JGroupsModel.VERSION_1_2_0.requiresTransformation(version)) { builder.getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, PROPERTIES) .end(); } }