-
Notifications
You must be signed in to change notification settings - Fork 5
ReplaceWithMethodCall Code Mapping Action
ldfallas edited this page Aug 31, 2015
·
3 revisions
<map:ReplaceWithMethodCall MethodName="NEW-METHOD-NAME"/>
This action replaces a member access of the form A.B with a A.Foo() expression.
This mapping action is us used to convert from a property to a getter method.
Property | Usage | Description |
---|---|---|
MethodName | Required | The name of the getter method to generate |
The following mapping is going to convert from Microsoft.Devices.VibrateController.Default
property to the Windows.Phone.Devices.Notification.VibrationDevice.GetDefault
getter method
We want to convert from:
-- Windows Phone 8 Silverlight --
var controller = Microsoft.Devices.VibrateController.Default;
To the following code:
-- Windows UWP --
var controller = Windows.Phone.Devices.Notification.VibrationDevice.GetDefault();
<MapUnit xmlns="clr-namespace:Mobilize.Mappers.Extensibility.Core;assembly=Mobilize.ExtensibleMappers"
xmlns:map="clr-namespace:Mobilize.Mappers.Extensibility.Code;assembly=Mobilize.ExtensibleMappers">
<MapUnit.Elements>
<map:CodeMapPackage Type="Microsoft.Devices.VibrateController">
<map:CodeMapPackage.Maps>
<map:CodeMap Kind="Type">
<map:ReplaceClassUsage NewNamespace="Windows.Phone.Devices.Notification"
NewClassName="VibrationDevice" />
</map:CodeMap>
<map:CodeMap Kind="MemberAccess" MemberName="Default">
<map:CodeMap.Action>
<map:ReplaceWithMethodCall MethodName="GetDefault"/>
</map:CodeMap.Action>
</map:CodeMap>
...
</map:CodeMapPackage.Maps>
</map:CodeMapPackage>
</MapUnit.Elements>
</MapUnit>
TODO
Contact us for more information
Overview
Writing mappings
Code Mapping Actions
- ActionSequence
- AddHelper
- AddNamespaceImport
- AddPreStatementFromTemplate
- CommentOut
- Conditional
- Keep Code Mapping Action
- MarkAsNotMapped
- RedirectCall
- RedirectCallToInnerMember
- RedirectIndexer
- RedirectProperty
- RemoveCurrentStatement
- RemoveParameter
- ReplaceClassUsage
- ReplaceMethodBodyWithTemplate
- ReplaceParameterDeclarationType
- ReplaceParameterMember
- ReplaceParameterValue
- ReplaceWithMethodCall
- ReplaceWithProperty
- ReplaceWithTemplate
Code Mapping Conditions
- AllConditionsApply
- ArgumentCount
- AssignName
- AssignNameToArgumentRange
- IsExpressionOfType
- IsStringLiteralMatchingRegex
- WithArgument
- WithAssignment
- WithAssignmentLeftSide
- WithAssignmentRightSide
- WithCalledMemberOwner
- WithCalledMethodExpression
- WithConstructorCall
- WithLambdaExpressionBody
- WithLambdaExpressionParameter
- WithLeftSideOfDottedAccess
- WithMemberInitValue
- WithMethodCall
XAML mapping actions
- ActionSequence
- AddStatementToConstructorFromTemplate
- BindPropertyValueElement Xaml mapping action
- ChangeEventHandlerEventArgsType
- CommentOutElement
- CommentOutProperty
- MarkAsNotMapped
- MoveValueToContentProperty
- RemoveNamespaceDeclaration
- RenameElement
- RenameProperty
- ReplaceAttributeValue
- ReplaceEventHandlerBodyWithTemplate
- ReplaceEventHandlerParameterMember
- ReplaceNamespaceDeclaration
- ReplacePropertyValueWithParentResource
- ReplaceStaticResourceWithThemeResource
- SetPropertyValueToComplexElement
- SetPropertyValueToSimpleValue
- WrapContent
XAML mapping conditions
Misc