@@ -354,7 +354,7 @@ component accessors="true" {
354354 // check if already registered, if it is, just return
355355 for ( var x = 1 ; x lte arrayLen ( variables .DIConstructorArguments ); x ++ ) {
356356 if (
357- structKeyExists ( arguments , " name" ) AND
357+ ! isNull ( arguments . name ) AND
358358 structKeyExists ( variables .DIConstructorArguments [ x ], " name" ) AND
359359 variables .DIConstructorArguments [ x ].name == arguments .name
360360 ) {
@@ -492,7 +492,10 @@ component accessors="true" {
492492 // Remove scope for setter injection
493493 definition .scope = " " ;
494494 // Verify argument name, if not default it to setter name
495- if ( NOT structKeyExists ( arguments , " argName" ) OR len ( arguments .argName ) EQ 0 ) {
495+ if (
496+ isNull ( arguments .argName ) OR
497+ len ( arguments .argName ) EQ 0
498+ ) {
496499 arguments .argName = arguments .name ;
497500 }
498501 // save incoming params
@@ -1058,44 +1061,58 @@ component accessors="true" {
10581061 }
10591062 }
10601063
1064+ /**
1065+ * Checks if the property has an annotation value for the key
1066+ *
1067+ * @metadata The metadata to check
1068+ * @key The key to look for in the annotations or documentation
1069+ *
1070+ * @return boolean
1071+ */
10611072 private boolean function hasAnnotationValue ( required struct metadata , required string key ){
1062- // Check if the property has an annotations struct
1063- if ( structKeyExists ( metadata , " annotations" ) && structKeyExists ( metadata .annotations , key ) ) {
1064- return true ;
1065- }
1073+ var annotations = arguments .metadata .keyExists ( " annotations" ) ? arguments .metadata .annotations : arguments .metadata ;
1074+ var documentation = arguments .metadata .keyExists ( " documentation" ) ? arguments .metadata .documentation : arguments .metadata ;
10661075
1067- // Check if the property has a documentation struct
1068- if ( structKeyExists ( metadata , " documentation " ) && structKeyExists ( metadata . documentation , key ) ) {
1076+ // Check in the annotations struct first
1077+ if ( structKeyExists ( annotations , key ) ) {
10691078 return true ;
10701079 }
10711080
1072- // Check if the property has the key directly
1073- else if ( structKeyExists ( metadata , key ) ) {
1081+ // Check in the documentation struct second, to support CFML engines
1082+ if ( structKeyExists ( documentation , key ) ) {
10741083 return true ;
10751084 }
10761085
10771086 return false ;
10781087 }
10791088
1089+ /**
1090+ * Get the annotation value for a given key in the metadata
1091+ *
1092+ * @metadata The metadata to check
1093+ * @key The key to look for in the annotations or documentation
1094+ * @defaultValue The default value to return if the key is not found
1095+ *
1096+ * @return any
1097+ */
10801098 private any function getAnnotationValue (
10811099 required struct metadata ,
10821100 required string key ,
10831101 any defaultValue
10841102 ){
1103+ var annotations = arguments .metadata .keyExists ( " annotations" ) ? arguments .metadata .annotations : arguments .metadata ;
1104+ var documentation = arguments .metadata .keyExists ( " documentation" ) ? arguments .metadata .documentation : arguments .metadata ;
1105+
10851106 // Check if the property has an annotations struct
1086- if ( structKeyExists ( metadata , " annotations " ) && structKeyExists ( metadata . annotations , key ) ) {
1087- return metadata . annotations [ key ];
1107+ if ( structKeyExists ( annotations , key ) ) {
1108+ return annotations [ key ];
10881109 }
10891110
10901111 // Check if the property has an documentation struct
1091- if ( structKeyExists ( metadata , " documentation " ) && structKeyExists ( metadata . documentation , key ) ) {
1092- return metadata . documentation [ key ];
1112+ if ( structKeyExists ( documentation , key ) ) {
1113+ return documentation [ key ];
10931114 }
10941115
1095- // Check if the property has the key directly
1096- else if ( structKeyExists ( metadata , key ) ) {
1097- return metadata [ key ];
1098- }
10991116 // Return default value
11001117 return defaultValue ;
11011118 }
0 commit comments