-
-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathMixerUtil.cfc
99 lines (88 loc) · 2.09 KB
/
MixerUtil.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
* www.ortussolutions.com
* ---
* I am an AOP mixer utility method
*/
component {
/**
* Constructor
*/
function init(){
return this;
}
/****************************** AOP UTILITY MIXINS ******************************/
/**
* Store JointPoint information
*
* @jointpoint The jointpoint to proxy
* @interceptors The jointpoint interceptors
*
* @return instance
*/
function $wbAOPStoreJointPoint( required jointpoint, required interceptors ){
this.$wbAOPTargets[ arguments.jointpoint ] = {
udfPointer : variables[ arguments.jointpoint ],
interceptors : arguments.interceptors
};
return this;
}
/**
* Invoke a mixed in proxy method
*
* @method The method to proxy execute
* @args The method args to proxy execute
*/
function $wbAOPInvokeProxy( required method, required args ){
return this.$wbAOPTargets[ arguments.method ].udfPointer( argumentCollection = arguments.args );
}
/**
* Mix in a template on an injected target
*
* @templatePath The template to mix in
*
* @return Instance
*/
function $wbAOPInclude( required templatePath ){
include "#arguments.templatePath#";
return this;
}
/**
* Remove a method from this target mixin
*
* @methodName The method to poof away!
*
* @return Instance
*/
function $wbAOPRemove( required methodName ){
structDelete( this, arguments.methodName );
structDelete( variables, arguments.methodName );
return this;
}
/****************************** UTILITY Methods ******************************/
/**
* Write an aspect to disk
*
* @genPath The location path
* @code The code to write
*
* @return Instance
*/
function writeAspect( required genPath, required code ){
fileWrite( arguments.genPath, arguments.code );
return this;
}
/**
* Remove an aspect from disk
*
* @filePath The location path
*
* @return Instance
*/
function removeAspect( required filePath ){
if ( fileExists( arguments.filePath ) ) {
fileDelete( arguments.filePath );
}
return this;
}
}