Interface IStruct

All Superinterfaces:
IReferenceable, IType, Map<Key,Object>
All Known Subinterfaces:
IClassRunnable, IScope
All Known Implementing Classes:
ApplicationScope, ArgumentsScope, BaseScope, ClassVariablesScope, ImmutableStruct, LocalScope, RequestScope, ScopeWrapper, ServerScope, SessionScope, StaticScope, Struct, ThisScope, ThreadScope, VariablesScope, XML

public interface IStruct extends Map<Key,Object>, IType, IReferenceable
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The Available types of structs

    Nested classes/interfaces inherited from interface java.util.Map

    Map.Entry<K,V>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAll(Map<? extends Object,? extends Object> map)
    Copies all of the mappings from the specified map to this map (optional operation).
    boolean
    Returns true if this map maps one or more keys using a String key
    boolean
    Returns true if this map contains a mapping for the specified Key
    Returns a Set view of the mappings contained in this map.
    get(String key)
    Returns the value to which the specified Key is mapped
    default <T> T
    getAs(Class<T> clazz, Key key)
    Convenience method for getting a key using the first param as the casting class
    default Array
    Convenience method for getting cast as Array Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Attempt<Object>
    Convenience method for getting cast as BoxLang Attempt Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Boolean
    Convenience method for getting cast as Boolean Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default BoxInterface
    Convenience method for getting cast as BoxInterface Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    Convenience method for getting cast as BoxRunnable Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default DateTime
    Convenience method for getting cast as DateTime Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Double
    Convenience method for getting cast as Double Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Function
    Convenience method for getting cast as Function Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Integer
    Convenience method for getting cast as Integer Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Key
    Convenience method for getting cast as Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Long
    Convenience method for getting cast as Long Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Number
    Convenience method for getting cast as Number Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Optional<Object>
    Convenience method for getting cast as Optional Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Query
    Convenience method for getting cast as Query Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default Stream<?>
     
    default String
    Convenience method for getting cast as String Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default IStruct
    Convenience method for getting cast as Struct Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    default XML
    Convenience method for getting cast as XML Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    Get an array list of all the keys in the struct
    Get an array list of all the keys in the struct
    getOrDefault(String key, Object defaultValue)
    Get key, with default value if not found
    getOrDefault(Key key, Object defaultValue)
    Get key, with default value if not found
    getRaw(Key key)
    Returns the value of the key safely, nulls will be wrapped in a NullValue still.
    Get the type of struct
    Get the wrapped map used in the implementation
    Returns a boolean as to whether the struct instance is case sensitive
    Returns a boolean as to whether the struct assignments are soft referenced
    put(String key, Object value)
    Set a value in the struct by a string key, which we auto-convert to a Key object
    put(Key key, Object value)
    Set a value in the struct by a Key object
    putIfAbsent(String key, Object value)
    Put a value in the struct if the key doesn't exist
    putIfAbsent(Key key, Object value)
    Put a value in the struct if the key doesn't exist
    Remove a value from the struct by a Key object
    remove(Key key)
    Remove a value from the struct by a Key object
    Convert the struct to a human-readable string, usually great for debugging Remember structs have no order except their internal hash code

    Methods inherited from interface ortus.boxlang.runtime.dynamic.IReferenceable

    assign, dereference, dereferenceAndInvoke, dereferenceAndInvoke

    Methods inherited from interface ortus.boxlang.runtime.types.IType

    asString, getBoxMeta
  • Method Details

    • containsKey

      boolean containsKey(Key key)
      Returns true if this map contains a mapping for the specified Key
      Parameters:
      key - key whose presence in this map is to be tested
      Returns:
      true if this map contains a mapping for the specified
    • containsKey

      boolean containsKey(String key)
      Returns true if this map maps one or more keys using a String key
      Parameters:
      key - The string key to look for. Automatically converted to Key object
      Returns:
      true if this map contains a mapping for the specified
    • get

      Object get(String key)
      Returns the value to which the specified Key is mapped
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value to which the specified key is mapped or null if not found
    • getOrDefault

      Object getOrDefault(Key key, Object defaultValue)
      Get key, with default value if not found
      Parameters:
      key - The key to look for
      defaultValue - The default value to return if the key is not found
      Returns:
      The value of the key
    • getOrDefault

      Object getOrDefault(String key, Object defaultValue)
      Get key, with default value if not found
      Parameters:
      key - The key to look for
      defaultValue - The default value to return if the key is not found
      Returns:
      The value of the key
    • getRaw

      Object getRaw(Key key)
      Returns the value of the key safely, nulls will be wrapped in a NullValue still.
      Parameters:
      key - The key to look for
      Returns:
      The value of the key or a NullValue object, null means the key didn't exist *
    • put

      Object put(Key key, Object value)
      Set a value in the struct by a Key object
      Specified by:
      put in interface Map<Key,Object>
      Parameters:
      key - The key to set
      value - The value to set
      Returns:
      The previous value of the key, or null if not found
    • put

      Object put(String key, Object value)
      Set a value in the struct by a string key, which we auto-convert to a Key object
      Parameters:
      key - The string key to set
      value - The value to set
      Returns:
      The previous value of the key, or null if not found
    • putIfAbsent

      Object putIfAbsent(Key key, Object value)
      Put a value in the struct if the key doesn't exist
      Specified by:
      putIfAbsent in interface Map<Key,Object>
      Parameters:
      key - The key to set
      value - The value to set
      Returns:
      The previous value of the key, or null if not found
    • putIfAbsent

      Object putIfAbsent(String key, Object value)
      Put a value in the struct if the key doesn't exist
      Parameters:
      key - The String key to set
      value - The value to set
      Returns:
      The previous value of the key, or null if not found
    • remove

      Object remove(String key)
      Remove a value from the struct by a Key object
      Parameters:
      key - The String key to remove
    • remove

      Object remove(Key key)
      Remove a value from the struct by a Key object
      Parameters:
      key - The String key to remove
    • addAll

      void addAll(Map<? extends Object,? extends Object> map)
      Copies all of the mappings from the specified map to this map (optional operation). This method will automatically convert the keys to Key objects
      Parameters:
      map -
    • toStringWithCase

      String toStringWithCase()
      Convert the struct to a human-readable string, usually great for debugging Remember structs have no order except their internal hash code
      Returns:
      The string representation of the struct using the format {key=value, key=value}
    • getKeys

      List<Key> getKeys()
      Get an array list of all the keys in the struct
      Returns:
      An array list of all the keys in the struct
    • getKeysAsStrings

      List<String> getKeysAsStrings()
      Get an array list of all the keys in the struct
      Returns:
      An array list of all the keys in the struct
    • getWrapped

      Map<Key,Object> getWrapped()
      Get the wrapped map used in the implementation
    • getType

      IStruct.TYPES getType()
      Get the type of struct
      Returns:
      The type of struct according to the enum
    • isCaseSensitive

      Boolean isCaseSensitive()
      Returns a boolean as to whether the struct instance is case sensitive
    • isSoftReferenced

      Boolean isSoftReferenced()
      Returns a boolean as to whether the struct assignments are soft referenced
    • entrySet

      Set<Map.Entry<Key,Object>> entrySet()
      Returns a Set view of the mappings contained in this map.
      Specified by:
      entrySet in interface Map<Key,Object>
    • getAsKey

      default Key getAsKey(Key key)
      Convenience method for getting cast as Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsArray

      default Array getAsArray(Key key)
      Convenience method for getting cast as Array Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsStruct

      default IStruct getAsStruct(Key key)
      Convenience method for getting cast as Struct Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsDateTime

      default DateTime getAsDateTime(Key key)
      Convenience method for getting cast as DateTime Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsString

      default String getAsString(Key key)
      Convenience method for getting cast as String Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsDouble

      default Double getAsDouble(Key key)
      Convenience method for getting cast as Double Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsNumber

      default Number getAsNumber(Key key)
      Convenience method for getting cast as Number Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsLong

      default Long getAsLong(Key key)
      Convenience method for getting cast as Long Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsInteger

      default Integer getAsInteger(Key key)
      Convenience method for getting cast as Integer Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsBoolean

      default Boolean getAsBoolean(Key key)
      Convenience method for getting cast as Boolean Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsFunction

      default Function getAsFunction(Key key)
      Convenience method for getting cast as Function Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsQuery

      default Query getAsQuery(Key key)
      Convenience method for getting cast as Query Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsXML

      default XML getAsXML(Key key)
      Convenience method for getting cast as XML Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsOptional

      default Optional<Object> getAsOptional(Key key)
      Convenience method for getting cast as Optional Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsAttempt

      default Attempt<Object> getAsAttempt(Key key)
      Convenience method for getting cast as BoxLang Attempt Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsClassRunnable

      default IClassRunnable getAsClassRunnable(Key key)
      Convenience method for getting cast as BoxRunnable Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsBoxInterface

      default BoxInterface getAsBoxInterface(Key key)
      Convenience method for getting cast as BoxInterface Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable
    • getAsStream

      default Stream<?> getAsStream(Key key)
    • getAs

      default <T> T getAs(Class<T> clazz, Key key)
      Convenience method for getting a key using the first param as the casting class
      Parameters:
      clazz - The class to cast the object to
      key - The key to get
      Returns:
      The object casted to the class