avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Rocha <rica...@apache.org>
Subject Throwing exceptions during contextualization
Date Mon, 09 Apr 2001 05:15:52 GMT
A component implementing Contextualizable may need to assert some
condition(s) on its context and throw an exception if such condition(s)
are not met:

  public class MyComponent implements Contextualizable {
    . . .
    public void contextualize(Context context) throws ContextException {
        this.requiredComponent = context.get("required");
        if (this.required == null) {
         throw new ContextException("Required component missing in context");
        }
    }
    . . .
  }

What do you think of creating a new ContextException and have the
contextualize(Context) method throw it?

Regards,

Ricardo

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message