選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

EvalContext.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 java.text.SimpleDateFormat;
  15. import javax.script.Bindings;
  16. /**
  17. * EvalContext encapsulates all shared state for expression parsing and
  18. * evaluation. It provides a bridge between the expression execution engine
  19. * and the current Database.
  20. *
  21. * @author James Ahlborn
  22. */
  23. public interface EvalContext
  24. {
  25. /**
  26. * @return the currently configured TemporalConfig (from the
  27. * {@link EvalConfig})
  28. */
  29. public TemporalConfig getTemporalConfig();
  30. /**
  31. * @return an appropriately configured (i.e. TimeZone and other date/time
  32. * flags) SimpleDateFormat for the given format.
  33. */
  34. public SimpleDateFormat createDateFormat(String formatStr);
  35. /**
  36. * @param seed the seed for the random value, following the rules for the
  37. * "Rnd" function
  38. * @return a random value for the given seed following the statefulness
  39. * rules for the "Rnd" function
  40. */
  41. public float getRandom(Integer seed);
  42. /**
  43. * @return the expected type of the result value for the current expression
  44. * evaluation (for "default value" and "calculated" expressions)
  45. */
  46. public Value.Type getResultType();
  47. /**
  48. * @return the value of the "current" column (for "field validator"
  49. * expressions)
  50. */
  51. public Value getThisColumnValue();
  52. /**
  53. * @return the value of the entity identified by the given identifier (for
  54. * "calculated" and "row validator" expressions)
  55. */
  56. public Value getIdentifierValue(Identifier identifier);
  57. /**
  58. * @return the currently configured Bindings (from the {@link EvalConfig})
  59. */
  60. public Bindings getBindings();
  61. /**
  62. * @return the value of the current key from the currently configured
  63. * {@link Bindings}
  64. */
  65. public Object get(String key);
  66. /**
  67. * Sets the value of the given key to the given value in the currently
  68. * configured {@link Bindings}.
  69. */
  70. public void put(String key, Object value);
  71. }