Question

I'm creating a custom attribute and trying to follow best practices. I looked at class SysObsoleteAttribute for an example, and can anybody explain the reasoning behind the methods they chose to create? It seems almost random and counter-intuitive.

The attribute holds two variables, explanation(str) and isError(boolean).

They created a parm method parmExplanation that just returns the explanation but doesn't allow you to set by calling the protected Explanation method.

They then create a public isError method to access the isError variable?

Is there any rhyme or reason to it?

Was it helpful?

Solution

Creating parm methods without arguments is not best practice!

I guess the answer to your question is no.

This specific attricbute class SysObsoleteAttribute is called from the compiler, so improving upon it may be difficult.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top