public ResourceManager { private final static ResourceManager me = new ResourceManager(); private ResourceManager() { ... } /* Note the 'private'-constructor */ public static ResourceManager getSingleton() { return ResourceManager.me; } }
@Override public ResourceManager withSubscription(String subscriptionId) { return new ResourceManager(restClient, subscriptionId); } }
@Override public ResourceManager withSubscription(String subscriptionId) { return new ResourceManager(restClient, subscriptionId); } }
var rm = new ResourceManager(resourceType); _testedPropertyDisplayName = rm.GetString(testedPropertyDisplayNameKey);
public static class Localise { private const string STRINGS_ROOT = "MyPCL.strings.strings"; public static string GetString(string sID, string sLocale) { string sResource = STRINGS_ROOT + "_" + sLocale; Type type = Type.GetType(sResource); if (type == null) { if (sLocale.Length > 2) { sResource = STRINGS_ROOT + "_" + sLocale.Substring(0, 2); // Use first two letters of region code type = Type.GetType(sResource); } } if (type == null) { sResource = STRINGS_ROOT; type = Type.GetType(sResource); if (type == null) { System.Diagnostics.Debug.WriteLine("No strings resource file when looking for " + sID + " in " + sLocale); return null; // This shouldn't ever happen in theory } } ResourceManager resman = new ResourceManager(type); return resman.GetString(sID); } }
final ResourceManager rm = new ResourceManager(1000, 1000); rm.loadImgResource(LandCardResources.INSTANCE.getMeadow(), "meadow", 0, 0); rm.loadImgResource(LandCardResources.INSTANCE.getHellHorseKnight(), "knight", 150, 150);
final FacesContext context = FacesContext.getCurrentInstance(); ClassicEngineBoot.getInstance().start(); try { // load report definition ResourceManager manager = new ResourceManager(); manager.registerDefaults(); ExternalContext extContext = context.getExternalContext(); String reportPath = "file:" + extContext.getRealPath("name/name.prpt"); Resource res = manager.createDirectly(new URL(reportPath), MasterReport.class); MasterReport report = (MasterReport) res.getResource(); ................ ................ httpServletResponse.setContentType("application/rtf"); httpServletResponse.setHeader("Content-Disposition", "attachment; filename=\"name.rtf\""); RTFReportUtil.createRTF(report, httpServletResponse.getOutputStream()); FacesContext.getCurrentInstance().responseComplete(); } catch (ReportProcessingException ex) {