So I want to create handler classes for different Objects with my SF org, specifically for some of the custom objects. For instance I have a Global__c object that stores global settings in encrypted text fields for things like credentials to 3rd party logins.
My hope is to have a reusable way of fetching data as needed. I am new to SF so any education about this request would be helpful, even if that includes saying this is a dumb request :P
So far I have this:
public virtual class Global_Settings {
public static Global__C g;
/**
* CONSTRUCTOR
*/
public Global_Settings(){
this(g);
}
/**
* GET A GLOBAL BY NAME
* Fetch Global__c by Name field
* @example Globals.get(<Name>)
* @author Nick Worth
*/
public get( String name ){
Global_Settings.g = [SELECT Id, Name, Value__c FROM Global__c WHERE Name = :name];
return g;
}
}
At the moment I'm getting this error when attempting to deploy to sandbox:
1. classes/Globals.cls -- Error: Invalid constructor name: get (line 30)
Apparently its not recognizing my constructor even though it is clearly there. I thought maybe it wasn't allowed to be empty so I added this(g)
but still no progress.
Potentially this class and others like it would have utility like methods in here specific to the object. So in addition to my constructor issue I'm curious about this approach, potential problems, benefits, etc.
Thank you.