|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
This interface is meant to be implemented by objects that are created by the Confix runtime, but are meant only for the sake of creating another object. This interface can also be implemented if a validation needs to be performed before actually returning the created object.
This allows objects that do not obey the Confix restrictions (adder and setter methods, no-args constructor, etc) to still be created with Confix. For example, the following code shows how a URL instance could be created:
public class URLFactory implements ObjectCreationCallback{
private _link;
public void setLink(String link){
_link = link;
}
public object onCreate() throws ConfigurationException{
if(_link == null){
throw new ConfigurationException("URL 'link' attribute not specified");
}
try{
return new URL(_link);
}catch(MalformedURLException e){
throw new ConfigurationException("Invalid value for 'link' attribute in URL", e);
}
}
}
| Method Summary | |
|---|---|
Object |
onCreate()
Called by the Confix runtime when this instance has been created; allows it to return another object at its place. |
| Method Detail |
public Object onCreate()
throws ConfigurationException
Object
ConfigurationException - if a problem occurs.
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||