Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

EvalContext.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. Copyright (c) 2016 James Ahlborn
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package com.healthmarketscience.jackcess.expr;
  14. import javax.script.Bindings;
  15. /**
  16. * EvalContext encapsulates all shared state for expression parsing and
  17. * evaluation. It provides a bridge between the expression execution engine
  18. * and the current Database.
  19. *
  20. * @author James Ahlborn
  21. */
  22. public interface EvalContext extends LocaleContext
  23. {
  24. /**
  25. * @param seed the seed for the random value, following the rules for the
  26. * "Rnd" function
  27. * @return a random value for the given seed following the statefulness
  28. * rules for the "Rnd" function
  29. */
  30. public float getRandom(Integer seed);
  31. /**
  32. * @return the expected type of the result value for the current expression
  33. * evaluation (for "default value" and "calculated" expressions)
  34. */
  35. public Value.Type getResultType();
  36. /**
  37. * @return the value of the "current" column (for "field validator"
  38. * expressions)
  39. */
  40. public Value getThisColumnValue();
  41. /**
  42. * @return the value of the entity identified by the given identifier (for
  43. * "calculated" and "row validator" expressions)
  44. */
  45. public Value getIdentifierValue(Identifier identifier);
  46. /**
  47. * @return the currently configured Bindings (from the {@link EvalConfig})
  48. */
  49. public Bindings getBindings();
  50. /**
  51. * @return the value of the current key from the currently configured
  52. * {@link Bindings}
  53. */
  54. public Object get(String key);
  55. /**
  56. * Sets the value of the given key to the given value in the currently
  57. * configured {@link Bindings}.
  58. */
  59. public void put(String key, Object value);
  60. }