程序包 com.script

类 SimpleBindings

java.lang.Object
com.script.SimpleBindings
所有已实现的接口:
Bindings, Map<String,Object>

public class SimpleBindings extends Object implements Bindings
A simple implementation of Bindings backed by a HashMap or some other specified Map.
从以下版本开始:
1.6
  • 构造器详细资料

    • SimpleBindings

      public SimpleBindings(Map<String,Object> m)
      Constructor uses an existing Map to store the values.
      参数:
      m - The Map backing this SimpleBindings.
      抛出:
      NullPointerException - if m is null
    • SimpleBindings

      public SimpleBindings()
      Default constructor uses a HashMap.
  • 方法详细资料

    • put

      public Object put(String name, Object value)
      Sets the specified key/value in the underlying map field.
      指定者:
      put 在接口中 Bindings
      指定者:
      put 在接口中 Map<String,Object>
      参数:
      name - Name of value
      value - Value to set.
      返回:
      Previous value for the specified key. Returns null if key was previously unset.
      抛出:
      NullPointerException - if the name is null.
      IllegalArgumentException - if the name is empty.
    • putAll

      public void putAll(Map<? extends String,? extends Object> toMerge)
      putAll is implemented using Map.putAll.
      指定者:
      putAll 在接口中 Bindings
      指定者:
      putAll 在接口中 Map<String,Object>
      参数:
      toMerge - The Map of values to add.
      抛出:
      NullPointerException - if toMerge map is null or if some key in the map is null.
      IllegalArgumentException - if some key in the map is an empty String.
    • clear

      public void clear()
      指定者:
      clear 在接口中 Map<String,Object>
    • containsKey

      public boolean containsKey(Object key)
      Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)
      指定者:
      containsKey 在接口中 Bindings
      指定者:
      containsKey 在接口中 Map<String,Object>
      参数:
      key - key whose presence in this map is to be tested.
      返回:
      true if this map contains a mapping for the specified key.
      抛出:
      NullPointerException - if key is null
      ClassCastException - if key is not String
      IllegalArgumentException - if key is empty String
    • containsValue

      public boolean containsValue(Object value)
      指定者:
      containsValue 在接口中 Map<String,Object>
    • entrySet

      public Set<Map.Entry<String,Object>> entrySet()
      指定者:
      entrySet 在接口中 Map<String,Object>
    • get

      public Object get(Object key)
      Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

      More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

      指定者:
      get 在接口中 Bindings
      指定者:
      get 在接口中 Map<String,Object>
      参数:
      key - key whose associated value is to be returned.
      返回:
      the value to which this map maps the specified key, or null if the map contains no mapping for this key.
      抛出:
      NullPointerException - if key is null
      ClassCastException - if key is not String
      IllegalArgumentException - if key is empty String
    • isEmpty

      public boolean isEmpty()
      指定者:
      isEmpty 在接口中 Map<String,Object>
    • keySet

      public Set<String> keySet()
      指定者:
      keySet 在接口中 Map<String,Object>
    • remove

      public Object remove(Object key)
      Removes the mapping for this key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that (key==null ? k==null : key.equals(k)), that mapping is removed. (The map can contain at most one such mapping.)

      Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. (A null return can also indicate that the map previously associated null with the specified key if the implementation supports null values.) The map will not contain a mapping for the specified key once the call returns.

      指定者:
      remove 在接口中 Bindings
      指定者:
      remove 在接口中 Map<String,Object>
      参数:
      key - key whose mapping is to be removed from the map.
      返回:
      previous value associated with specified key, or null if there was no mapping for key.
      抛出:
      NullPointerException - if key is null
      ClassCastException - if key is not String
      IllegalArgumentException - if key is empty String
    • size

      public int size()
      指定者:
      size 在接口中 Map<String,Object>
    • values

      public Collection<Object> values()
      指定者:
      values 在接口中 Map<String,Object>