Alex Kwitny
Alex Kwitny

Reputation: 11564

Creating an attribute and trying to follow best practices

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?

Upvotes: 1

Views: 100

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18061

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.

Upvotes: 0

Related Questions