• jmischo
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I'm working on a [soon to be open-sourced] application configuration object that allows an application to programmatically check for a specific custom setting and load a default value from a file if it hasn't been set.  To that end, I've got a constructor for this class that requires a custom settings object and a string to pass to getValues() on that object.

 

Unfortunately, when I attempt to call getInstance() on the object (which I've tried using both SObject and Object s the primitive for), the Force.com IDE gives me a save error.  I'd really appreciate any insight into what the correct primitive type would be for this object (hopefully there's an undocumented primitive that has getInstance(string) defined on it?).

 

The errors I get are below - I get a similar error if I use getValues() instead of getInstance():

Save error: Method does not exist or incorrect signature: [SObject].getInstance(string)

or

Save error: Method does not exist or incorrect signature: [Object].getInstance(string)

 

The constructor in question is pretty simple (see below), with the error appearing on line 2 of 2 in the method body.  Both lines are assigning values to private instance variables for use by other methods in the class.

The constructor:

 

<code> 

    public ApplicationConfigurator( String defaultConfigurationResourceName,

 Object systemConfigurationObject,

 String systemConfigurationInstanceName)

    {

 defaultConfigurationFileResource = defaultConfigurationResourceName;

 systemConfigInstance = systemConfigurationObject.getValues(systemConfigurationInstanceName);

    }

</code>

I'm working on a [soon to be open-sourced] application configuration object that allows an application to programmatically check for a specific custom setting and load a default value from a file if it hasn't been set.  To that end, I've got a constructor for this class that requires a custom settings object and a string to pass to getValues() on that object.

 

Unfortunately, when I attempt to call getInstance() on the object (which I've tried using both SObject and Object s the primitive for), the Force.com IDE gives me a save error.  I'd really appreciate any insight into what the correct primitive type would be for this object (hopefully there's an undocumented primitive that has getInstance(string) defined on it?).

 

The errors I get are below - I get a similar error if I use getValues() instead of getInstance():

Save error: Method does not exist or incorrect signature: [SObject].getInstance(string)

or

Save error: Method does not exist or incorrect signature: [Object].getInstance(string)

 

The constructor in question is pretty simple (see below), with the error appearing on line 2 of 2 in the method body.  Both lines are assigning values to private instance variables for use by other methods in the class.

The constructor:

 

<code> 

    public ApplicationConfigurator( String defaultConfigurationResourceName,

 Object systemConfigurationObject,

 String systemConfigurationInstanceName)

    {

 defaultConfigurationFileResource = defaultConfigurationResourceName;

 systemConfigInstance = systemConfigurationObject.getValues(systemConfigurationInstanceName);

    }

</code>