public get(String k) { String name = BaseDAOimpl.appComponents.getProperty(k); System.out.println(" k "+k);
}
public static Properties getAppComponents() { return appComponents; }
public static void setAppComponents(Properties appComponents) { BusinessObjectFactory.appComponents = appComponents; }
}
iam getting error(Null pointer Excetion) in the line String name =BaseDAOimpl.appComponents.getProperty(k);
if i change this line to below shown
String name =BaseDAOimpl.getAppComponents().getProperty(k); my program is running fine so suggest me what is the best way to acess a static property in a class [ August 25, 2008: Message edited by: Amirtharaj Chinnaraj ]
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
What's a property in a class? Not standard Java nomenclature. You mean a field. You get access to a private static field the same way you get access to a private instance field-with an accessor (get) method.
If the class has a private static field without a public [static] get method, then whoever wrote that class doesn't intend to grant you access to that field.
Amirtharaj Chinnaraj
Ranch Hand
Joined: Sep 28, 2006
Posts: 215
posted
0
thanks Campbell
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
Originally posted by Amirtharaj Chinnaraj: thanks Campbell
You're welcome
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: best way to get a static property from a Class