SlideShare a Scribd company logo
Creating Global functions
- By Rahul Kumar
Creating Global functions
Global function can be used in any Mule Expression within the project.
You can then invoke it anywhere in your DataWeave code, without need for any
special syntax.
Creating Global functions
To create a global function, you must edit your Mule project’s XML file and
enclose any functions that you wish to define in the following set of tags,
which must be placed in the global elements section, before any of the
flows are defined.
Creating Global functions
Use any existing java functions or create one :
Create a java function
package org.rahul.util;
import org.apache.commons.lang3.text.WordUtils;
public class StringUtil {
public static String fullyCapitalize(String string)
{
String orignal_string = string;
System.out.println(orignal_string);
String fullyCapitalizedString = WordUtils.capitalizeFully(orignal_string);
System.out.println(fullyCapitalizedString);
return fullyCapitalizedString;
}
}
Creating Global functions
Edit your Mule project’s XML file and enclose any functions that you wish to define in the
following set of tags, which must be placed in the global elements section, before any of the
flows are defined.
Note : The function should be in the classpath
<expression-language>
<global-functions>
def fullyCapitalize(str) {
org.rahul.util.StringUtil.fullyCapitalize(str)
}
</global-functions>
</expression-language>
Configuration
Use the created function anywhere in your project in Mule Expressions, in
Dataweave component
%dw 1.0
%output application/json
---
{
"output” : fullyCapitalize(“HELLo how ArE yOU”),
}
Thank You

More Related Content

PDF
Introduction to React Hooks
PDF
React js use contexts and useContext hook
PDF
React table tutorial use filter (part 2)
PPTX
Angular 1.x vs 2 - In code level
ODP
Docker - An Introduction
PPTX
Deploy Laravel on Heroku
PDF
Redux and context api with react native app introduction, use cases, implemen...
PDF
Hello, React Hooks!
Introduction to React Hooks
React js use contexts and useContext hook
React table tutorial use filter (part 2)
Angular 1.x vs 2 - In code level
Docker - An Introduction
Deploy Laravel on Heroku
Redux and context api with react native app introduction, use cases, implemen...
Hello, React Hooks!

What's hot (20)

ODP
Microservices in a netshell
PPTX
React and Flux life cycle with JSX, React Router and Jest Unit Testing
PDF
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
PPTX
Scaling React and Redux at IOOF
PDF
Angular 2... so can I use it now??
PPTX
Angular 2 + TypeScript = true. Let's Play!
PPTX
Dependency Inversion in large-scale TypeScript applications with InversifyJS
PDF
React native app with type script tutorial
PPTX
React js
PDF
React js t3 - es6
PPTX
React Hooks
PDF
React js t4 - components
PDF
React js t6 -lifecycle
PDF
React js t1 - introduction
ODP
Pluggable Pipelines
PDF
React App State Management with react hooks and context api
PPTX
Do and Don't summary of React Component Lifecycle Methods
PPTX
Dive into Angular, part 3: Performance
PDF
Angular 2 - An Introduction
PPTX
What are the components in React?
Microservices in a netshell
React and Flux life cycle with JSX, React Router and Jest Unit Testing
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
Scaling React and Redux at IOOF
Angular 2... so can I use it now??
Angular 2 + TypeScript = true. Let's Play!
Dependency Inversion in large-scale TypeScript applications with InversifyJS
React native app with type script tutorial
React js
React js t3 - es6
React Hooks
React js t4 - components
React js t6 -lifecycle
React js t1 - introduction
Pluggable Pipelines
React App State Management with react hooks and context api
Do and Don't summary of React Component Lifecycle Methods
Dive into Angular, part 3: Performance
Angular 2 - An Introduction
What are the components in React?
Ad

Similar to Creating global functions (20)

PPTX
Mule data weave_10
PDF
MuleSoft Surat Live Demonstration Virtual Meetup#3 - Building JWT OAuth 2.0 C...
PDF
Fundamental Concepts of React JS for Beginners.pdf
PPTX
React Basic and Advance || React Basic
ODP
Bring the fun back to java
ODP
Unit Testing and Coverage for AngularJS
ODP
Jquery Plugin
ODP
Mule maven
PDF
Di code steps
PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
PPTX
PPTX
Mule dataweave
PPTX
Muledataweave10 161029032456-161119152200
PPTX
ReactJS.pptx
PPT
JAVA_BASICS_Data_abstraction_encapsulation.ppt
PPTX
PDF
Gephi Toolkit Tutorial
PDF
Introduction to gradle
PPTX
Mule with data weave
PDF
"Xapi-lang For declarative code generation" By James Nelson
Mule data weave_10
MuleSoft Surat Live Demonstration Virtual Meetup#3 - Building JWT OAuth 2.0 C...
Fundamental Concepts of React JS for Beginners.pdf
React Basic and Advance || React Basic
Bring the fun back to java
Unit Testing and Coverage for AngularJS
Jquery Plugin
Mule maven
Di code steps
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Mule dataweave
Muledataweave10 161029032456-161119152200
ReactJS.pptx
JAVA_BASICS_Data_abstraction_encapsulation.ppt
Gephi Toolkit Tutorial
Introduction to gradle
Mule with data weave
"Xapi-lang For declarative code generation" By James Nelson
Ad

More from Rahul Kumar (20)

PPTX
Combine collections transformer
PPTX
Creating custom object store
PPTX
Using parse template component
PPTX
Using groovy component
PPTX
Using expression component
PPTX
Creating custom transformer
PPTX
Creating custom aggregation strategy
PPTX
Creating custom aggregator
PPTX
Byte array to hex string transformer
PPTX
Creating custom filter
PPTX
Hex string to byte array transformer
PPTX
XML to DOM Transformer
PPTX
Dom to xml transformer
PPTX
Object to input stream transformer
PPTX
Byte array to object transformer
PPTX
Byte array to string transformer
PPTX
Object to string transformer
PPTX
Csv to json transform in simple steps
PPTX
Using scatter gather
PPTX
Choice router
Combine collections transformer
Creating custom object store
Using parse template component
Using groovy component
Using expression component
Creating custom transformer
Creating custom aggregation strategy
Creating custom aggregator
Byte array to hex string transformer
Creating custom filter
Hex string to byte array transformer
XML to DOM Transformer
Dom to xml transformer
Object to input stream transformer
Byte array to object transformer
Byte array to string transformer
Object to string transformer
Csv to json transform in simple steps
Using scatter gather
Choice router

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Digital Strategies for Manufacturing Companies
PDF
medical staffing services at VALiNTRY
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
Nekopoi APK 2025 free lastest update
Designing Intelligence for the Shop Floor.pdf
top salesforce developer skills in 2025.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Reimagine Home Health with the Power of Agentic AI​
Which alternative to Crystal Reports is best for small or large businesses.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Transform Your Business with a Software ERP System
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
How to Choose the Right IT Partner for Your Business in Malaysia
Digital Strategies for Manufacturing Companies
medical staffing services at VALiNTRY
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Design an Analysis of Algorithms II-SECS-1021-03
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Wondershare Filmora 15 Crack With Activation Key [2025

Creating global functions

  • 2. Creating Global functions Global function can be used in any Mule Expression within the project. You can then invoke it anywhere in your DataWeave code, without need for any special syntax.
  • 3. Creating Global functions To create a global function, you must edit your Mule project’s XML file and enclose any functions that you wish to define in the following set of tags, which must be placed in the global elements section, before any of the flows are defined.
  • 4. Creating Global functions Use any existing java functions or create one : Create a java function package org.rahul.util; import org.apache.commons.lang3.text.WordUtils; public class StringUtil { public static String fullyCapitalize(String string) { String orignal_string = string; System.out.println(orignal_string); String fullyCapitalizedString = WordUtils.capitalizeFully(orignal_string); System.out.println(fullyCapitalizedString); return fullyCapitalizedString; } }
  • 5. Creating Global functions Edit your Mule project’s XML file and enclose any functions that you wish to define in the following set of tags, which must be placed in the global elements section, before any of the flows are defined. Note : The function should be in the classpath <expression-language> <global-functions> def fullyCapitalize(str) { org.rahul.util.StringUtil.fullyCapitalize(str) } </global-functions> </expression-language>
  • 6. Configuration Use the created function anywhere in your project in Mule Expressions, in Dataweave component %dw 1.0 %output application/json --- { "output” : fullyCapitalize(“HELLo how ArE yOU”), }