1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.betwixt.expression;
  17. /** <p><code>Expression</code> represents an arbitrary expression on a bean.</p>
  18. *
  19. * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  20. */
  21. public interface Expression {
  22. /** Evaluates the expression on the bean with the given context
  23. * and returns the result
  24. *
  25. * @param context evaluate against this <code>Context</code>
  26. * @return the value of the expression
  27. */
  28. public Object evaluate(Context context);
  29. /* XXX
  30. Is update actually useful?
  31. None of the expression implementations i can find do anything when it's called.
  32. I suspect that it's been replaced by Updater
  33. but i maybe i'm missing something subtle
  34. */
  35. /** <p>Updates the current bean context with a new String value.
  36. * This is typically used when parsing XML and updating a beans value
  37. * from XML.<p>
  38. *
  39. * @param context update this <code>Context</code>
  40. * @param newValue the new value for this expression
  41. * @deprecated 0.5 use {@link Updater} instead
  42. */
  43. public void update(Context context, String newValue);
  44. }