1

If I want to write a code library as a managed package, I need to expose all methods and classes that are used by it via a global interface. This exposes a large chunk of library code.

How can I write a code library as a managed package that wouldn't expose the internals?

1

You can add the global to specific methods and classes (and interfaces) and leave other methods and classes invisible to users of the managed package. Users of the managed package will only get to see the signatures that are marked as global and will see no implementation detail at all.

But how much you will need to expose depends on the design of your classes: you may choose to add facades to make the set of things you need to make global smaller.

Note that once a class or method has been made global and the managed package has been released that decision cannot be reversed. So design and plan carefully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.