Created
June 20, 2019 00:19
-
-
Save danieljpeter/2714615d16259736a05dd98987d13177 to your computer and use it in GitHub Desktop.
GET NAMESPACE IN APEX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChrisNamespace { | |
public static final String ns = Namespace; | |
public static final String nsUU = NamespaceUU; | |
public static String Namespace { | |
get { | |
if (Namespace != null) return Namespace; | |
ApexClass ac = [SELECT NameSpacePrefix FROM ApexClass WHERE Name = 'ChrisNamespace' limit 1]; | |
Namespace = ac.NameSpacePrefix != null ? ac.NameSpacePrefix : ''; | |
return Namespace; | |
} | |
private set; | |
} | |
public static String NamespaceUU { get {return Namespace != '' ? Namespace + '__' : '' ;} } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment