Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [interface]

An interface is like a class, but it only contains the method's signatures. Interfaces can provide a layer of abstraction to code, and is an element of object-oriented programming.

Filter by
Sorted by
Tagged with
0 votes
0 answers
30 views

run a script in the the developer console while implementing interface [duplicate]

I'm trying to run a script from the developer console with the queueable interface implemented, but the execute method isn't called. code to put in Execute Anonymous Window in the developer console: ...
Json's user avatar
  • 1,617
0 votes
1 answer
195 views

how to develop custom interface in LWC or any alternate of <Aura:interface in LWC

In our project aura:interface is using to render data from multiple child aura:component, now we want to include LWC component as well as child component. Is there any way to implement similar flow as ...
Shilpa Jain's user avatar
2 votes
0 answers
273 views

Not able to access interface methods from an abstract class instance

I'm trying to build an Apex classes structure where I have two (or more) entities that have something in common but at the same time have a different set of fields. In the example below it's gonna be ...
Ilya Matsuev's user avatar
3 votes
1 answer
1k views

How do I create a List with a dynamic type?

I have a generic method that sets up some objects and returns a list of them. The type of the object is defined by an interface. The interface: public interface DynamicThing { DynamicThing ...
Rob Baillie's user avatar
0 votes
1 answer
163 views

Custom iterator: Inserting elements into the list being iterated over

I have the following custom iterator class that iterates over a list of Accounts (accounts): public class CustomIterator implements Iterator<Account>{ private List<Account> ...
user369137's user avatar
2 votes
1 answer
240 views

Error:Invalid conversion from runtime type Map<String,ANY> to List<ANY> Class

Here is my request json. { "apply_header":" CER202208170008", "sn":"CERL202208170008", "cert_cat":"MCS", "cert_name":&...
questioner's user avatar
7 votes
1 answer
312 views

Covariant Return Types in Interfaces

Having recently rolled out a beta version of my open source project, I started looking for ways to optimize it, and accidentally came across the fact that apex actually supports covariant return types ...
Oleh Berehovskyi's user avatar
-3 votes
1 answer
125 views

Whats best suited in the below scenario (Interface ? Abstract ? Inheritance)

I have two classes. They both contain a method that has almost the same logic. But the methods differ in a number of parameters. I want to keep a common method in the base class and use it in several ...
Muskan Khare's user avatar
7 votes
1 answer
3k views

Invoking Interface Method in Abstract Class Method

Assume we have some interface, abstract class and contrete class: interface I { void foo(); void bar(); } abstract class A implements I { public void barFoo() { bar(); // Compile ...
Oleh Berehovskyi's user avatar
16 votes
1 answer
1k views

Interface method can be implemented as static

Assume we have some simple interface: public interface IExecutable { void execute(); } and some class that implements the interface: public class Executor implements IExecutable { public ...
Oleh Berehovskyi's user avatar
6 votes
1 answer
725 views

How to implement Lambda expression in Apex

I have this below interface in Java public interface DoubleOperator { double applyAsDouble(double left, double right); } And below implementing it using Lambda - DoubleOperator [] ops = { (a, b)...
sfdc_to_learn's user avatar
2 votes
1 answer
325 views

How to define a interface datatype? [duplicate]

I was preparing for PD1 exam and came across the below sentence on interface in the developer documentation which I’m unable to understand. Can anyone help with an example as to what the below ...
Krishnamurthy's user avatar
2 votes
1 answer
356 views

How to call an Apex Class and method using Type casting?

I would like to call someMethod1 and someMethod2 from myClass from a Trigger on update. How can I use type casting to call the two methods? myInterfaceClass public interface myInterfaceClass { void ...
usernameabc's user avatar
2 votes
1 answer
265 views

Can managed Apex code instantiate a type that is outside its namespace?

In a managed package I have a global interface and some code that accepts a string as input (which should be a class name). Will this managed code be able to instantiate an Apex type that is outside ...
Renato Oliveira's user avatar
2 votes
1 answer
289 views

Packaged Interface cannot be instantiated after critical update "Restrict Reflective Access to Non-Global Constructors in Packages"

We have a global apex interface in a managed package that enables a subscriber org to transform a field value during a calculation in our package. global interface CustomCallable { Object execute(...
Robert Méndez's user avatar
0 votes
1 answer
278 views

Design Pattern Help: Extended Interfaces with methods that shared the same functionality/code

I'm trying to figure out the best pattern for the code below (example: not actual code). IOpportunitiesA and IOpportunitiesB are extending the base interface and they have a similar method, ...
Andrew L.'s user avatar
  • 837
1 vote
0 answers
29 views

Class vs Interface in Patch org

Why am I able to change the access specifier for an interface in a patch org but I can't do the same for a class? I know the documentation mentions some restrictions for patch orgs. I'm assuming the ...
d_k's user avatar
  • 1,291
5 votes
2 answers
681 views

An inner interface inside an outer interface is not supported in Apex?

Can't find a post saying this, and I get a compile error, but just to be sure, this is not supported in Apex right? public interface Access { public interface Context { ... } ...
Keith C's user avatar
  • 136k
2 votes
2 answers
543 views

Do callable classes still need to be marked as global to access them outside of managed packages?

I created a callable class for a managed packaged but I am unable to actually get an instance while calling it from outside the package. In execute anonymous: Type.forName returns null Callable ...
TemporaryFix's user avatar
  • 2,946
1 vote
1 answer
771 views

Object Permissions from permissions sets don't work as expected

What does the " -- " in the type of permission object? I need to set this to readOnly
Lucas Garcia's user avatar
2 votes
1 answer
337 views

Managed Package - Global interface and global/public class

Let's say we have global ProductFactory class like this: global class ProductFactory { global static ProductService getProductService() { return new ProductServiceBasic(); } } ...
wesaw's user avatar
  • 3,080
1 vote
2 answers
2k views

Variables in Interface in Salesforce

Can you declare variables in Interface in Apex (Salesforce). In Java, it allows you to declare and initialize variables with public static final keywords in Interface. Also in Apex, are all abstract ...
Faiz's user avatar
  • 31
2 votes
1 answer
319 views

Where or how can I find what interfaces an out of the box Apex class implements?

Is there a method of discovering (or a place to look up) all of the interfaces that an out of the box Salesforce class (Like LoginHistory) implements? The reason I ask: I'm attempting to test a ...
SF1Dev's user avatar
  • 775
1 vote
1 answer
3k views

Lightning Component force:hasSObjectName, sObjectName undefined

Per the force:hasSObjectName interface documentation, I can reference an automatically added attribute named sObjectName to retrieve the object where my custom lightning component is being accessed. ...
Ayoola Olapo's user avatar
14 votes
2 answers
2k views

Can create an Instance of Abstract Class, Salesforce Bug?

I was playing with Apex and stumbled upon this. Created an Abstract Class and made the constructor as private, so that noone can create an instance of it. This works just fine during compilation. it ...
Pranay Jaiswal's user avatar
1 vote
2 answers
2k views

Does Database.SaveResult, Database.DeleteResult, etc. implement a public interface?

The various DML operations (insert, update, delete, etc.) all return results with very similar methods and properties. It is not uncommon, as a developer, that I should want to handle these results ...
Brian Kessler's user avatar
4 votes
2 answers
4k views

Apex PMD: Avoid empty block statements

Perhaps this isn't the place for this -- but it looks like a good place to start. I'm using Apex PMD code analysis (within Visual Studio Code) and it's throwing off the following for an interface ...
Michael Paler's user avatar
0 votes
1 answer
99 views

Global Inner Interfaces in managed package

We have an global interface inside a global class: global class SomeClass { global interface someInterface() { //various methods returning and accepting standard Apex objects only String ...
NickJ's user avatar
  • 680
1 vote
2 answers
330 views

Design pattern for an attachment trigger using trigger framework?

Hoping to tap into the wisdom of the Apex design pattern wizards out there. We have recently moved to a trigger framework in order to decouple and standardize our wildly disparate trigger code ...
Michael Paler's user avatar
5 votes
1 answer
473 views

Versioning Apex Interfaces in managed packages

As documented in What are the pitfalls around Apex Interfaces in managed packages? a global Apex interface that has been published in a managed package can't be modified. Trying to do so results in ...
Daniel Ballinger's user avatar
20 votes
2 answers
859 views

Are Apex interfaces and abstract classes case-sensitive?

My understanding from the docs is that apex class and method names are case-insensitive. I've run across an edge-case with interfaces and abstract classes which appears to be undocumented behavior ...
Greg Grinberg's user avatar
6 votes
2 answers
629 views

What are the risks or drawbacks of creating Parameterized Interfaces using of the Apex API version 25?

Unfortunately, as of API version 26, SFDC removed parameterized interfaces. However, it is relatively easy to create new interfaces and set the version as 25. So, to take the example from ...
Brian Kessler's user avatar
0 votes
2 answers
135 views

Is there a dictionary of SFDC native interfaces we can leverage in Apex code? [closed]

Interfaces are wonderful for creating reusable code, as well as enabling us to reuse or make better use of the functionality SFDC already provides us. The Apex Developer's Guide tells us how to ...
Brian Kessler's user avatar
3 votes
1 answer
2k views

Inner Classes/Interfaces

the guide says that one difference between Java and Apex is: Inner classes and interfaces can only be declared one level deep inside an outer class. Considering I know in Java what is an Inner class,...
trocchietto's user avatar
2 votes
1 answer
113 views

Can Interface declare only methods?

I have created the following interface and a class that implements it. global interface SampleInterface { String logicA(); } public class SampleClass implements SampleInterface { public ...
user avatar
0 votes
0 answers
265 views

Invoking AWS CLI from Apex class

I need to invoke AWS Command Line Interface from a apex class. Can someone please help me in that? Thanks.
Nitin Varshney's user avatar
2 votes
0 answers
567 views

Global Interface in managed package

We are building a managed package and we have an understanding gap on the usage of Global Interface in the code. Couple of months back our package was rejected in the security review citing usage of ...
Hal's user avatar
  • 21
2 votes
0 answers
203 views

Impossible to add "flexipage:availableForRecordHome" on a component

I'm trying to create a new lightning component that should be displayed on a record page. However the error I'm getting this error when I'm adding the interface Deployment Failed: ...
Nordine Hammache's user avatar
11 votes
1 answer
3k views

How to deserialize into interface type when concrete type is unknown

As a follow up to this question: I am essentially trying to deserialize a JSON object into an Interface Type. Unfortunately we cannot deserialize using an Interface as the ApexType and must know ...
Eric's user avatar
  • 54.2k
7 votes
2 answers
2k views

Cannot deserialize JSON as abstract type?

While writing a class to help me manage @future jobs for a project, I stumbled onto an error message I can find very little help on. Cannot deserialize JSON as abstract type I used an interface ...
battery.cord's user avatar
  • 8,825
7 votes
2 answers
1k views

Static method able to be called/executed from class instantiated from type.newInstance() with interface. Expected?

When trying to execute a static method from an instance of a class testMe tmp = New testMe(); tmp.myStaticMethod('a','b'); we get the familiar: Static method cannot be referenced from a non ...
Eric's user avatar
  • 54.2k
11 votes
1 answer
3k views

Are Lightning Interfaces (e.g. implements="c:MyInterface") actually useful for anything?

I've been trying to build a Lightning Community where I use component inheritance and interfaces to share certain bits of functionality. For my particular use, composition wouldn't fit as well as ...
Aidan's user avatar
  • 13.7k
4 votes
1 answer
6k views

How Custom Iterators with Iterable Work

I was reading the topic of using iterator and iterabel Interface - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_iterable.htm It says : If you do not want ...
SfdcBat's user avatar
  • 4,811
2 votes
1 answer
275 views

Programmatically list all public/global attributes on a lightning component

Salesforce has provided some new lightning component interfaces to make communities a bit more customizable. They have provided some documentation for these, but it is weak at best: https://...
dsharrison's user avatar
  • 3,992
0 votes
1 answer
1k views

Using interfaces as parameter arguments

Is it possible to use interfaces as parameters within Apex? As an example: public interface InterfaceExample{ void example(InterfaceExample ex); // Will not compile InterfaceExample example2(...
Mattisdada's user avatar
  • 1,071
7 votes
1 answer
310 views

Doesn't Set<T> collection implement Iterable<T> interface? [duplicate]

I am trying to join String elements of Set with semicolon. Set<String> elements = new Set<String>{ 'foo', 'bar' }; System.debug(String.join(elements, ';')); getting the ...
Oleksandr Berehovskyi's user avatar
1 vote
1 answer
447 views

Clearing (or Cleaning) Global Search Cache - False Results - Sharing

How do we get Global Search to NOT show results that are NO LONGER VISIBLE to the logged in user? More quickly? Ever? I'm noticing as we test our implementation in Sandbox that when I login as ...
AMM's user avatar
  • 4,704
1 vote
0 answers
51 views

Error: Managed interface that is released can't implement new interfaces (bug?)

I have a managed package with the following class already in it: global class MyInterfaceClass { global interface InnerInterface {} global interface DeepInterface extends InnerInterface {} } ...
Mossi's user avatar
  • 3,966
1 vote
2 answers
11k views

custom component not showing up in community builder

a custom lightning component I just created is not showing up in my community-community builder custom component list as an option to use. I have had this issue before but forget how to make it ...
koolkeith's user avatar
0 votes
1 answer
27 views

Designed schema and loaded data -- is it possible to build an app that will just visualize this data from custom user requests?

Quick question -- I'm new to salesforce but I tried to dig around and want to 1) check if my understanding is correct and 2) see if something is possible. Basically, I have a schema that I built ...
shishy's user avatar
  • 103