{"id":157,"date":"2007-09-16T18:57:54","date_gmt":"2007-09-17T02:57:54","guid":{"rendered":"http:\/\/www.ericfeminella.com\/blog\/2007\/09\/16\/static-constant-definition-utility\/"},"modified":"2012-03-04T23:31:17","modified_gmt":"2012-03-05T04:31:17","slug":"static-constant-definition-utility","status":"publish","type":"post","link":"https:\/\/www.ericfeminella.com\/blog\/2007\/09\/16\/static-constant-definition-utility\/","title":{"rendered":"Static constant definition utility"},"content":{"rendered":"<p>\nI recently was working on an application where I needed to verify that certain static constants were defined by a specific class. I have run into similar situations like this before so I decided to write a simple utility which I could reuse.\n<\/p>\n<p>\nConstantDefinitionUtil is an all static class which provides an API for determining if specific constants have been defined by a class.\n<\/p>\n<p>\nAdditionally, ConstantDefinitionUtil provides a method for retrieving all static constants which have been defined by a class.\n<\/p>\n<p>\nThe following example demonstrates how ConstantDefinitionUtil can be utilized to determine if the static constant &#8220;X&#8221; has been defined by ClassA:\n<\/p>\n<pre lang=\"actionscript\">\r\npackage\r\n{\r\n    public class ClassA\r\n    {\r\n        public static const X:int = 1;\r\n        public static const Y:int = 2;\r\n        public static const Z:int = 3;\r\n    }\r\n}\r\n\r\nimport com.ericfeminella.utils.ConstantDefinitionUtil;\r\n\r\ntrace( ConstantDefinitionUtil.isDefinedBy(\"X\",ClassA) ); \/\/true\r\n<\/pre>\n<p><a href=\"http:\/\/code.ericfeminella.com\/classes\/as3\/ConstantDefinitionUtil.as.html\" target=\"_blank\">ConstantDefinitionUtil.as<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently was working on an application where I needed to verify that certain static constants were defined by a specific class. I have run into similar situations like this before so I decided to write a simple utility which I could reuse. ConstantDefinitionUtil is an all static class which provides an API for determining if specific constants have been&#8230; <a class=\"read-more\" href=\"https:\/\/www.ericfeminella.com\/blog\/2007\/09\/16\/static-constant-definition-utility\/\">Continue Reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[35],"tags":[],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-software-engineering"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":0,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}