Package ortus.boxlang.runtime.types
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
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
Copies all of the mappings from the specified map to this map (optional operation).boolean
containsKey
(String key) Returnstrue
if this map maps one or more keys using a String keyboolean
containsKey
(Key key) Returnstrue
if this map contains a mapping for the specifiedKey
entrySet()
Returns aSet
view of the mappings contained in this map.Returns the value to which the specified Key is mappeddefault <T> T
Convenience method for getting a key using the first param as the casting classdefault 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 castablegetAsAttempt
(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 castabledefault 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 castabledefault 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 castabledefault 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 castabledefault 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 castabledefault 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 castabledefault 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 castabledefault 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 castabledefault Key
Convenience method for getting cast as Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castabledefault Long
Convenience method for getting cast as Long Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castabledefault 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 castablegetAsOptional
(Key key) Convenience method for getting cast as Optional Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castabledefault 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 castabledefault Stream
<?> getAsStream
(Key key) 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 castabledefault 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 castabledefault XML
Convenience method for getting cast as XML Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castablegetKeys()
Get an array list of all the keys in the structGet an array list of all the keys in the structgetOrDefault
(String key, Object defaultValue) Get key, with default value if not foundgetOrDefault
(Key key, Object defaultValue) Get key, with default value if not foundReturns the value of the key safely, nulls will be wrapped in a NullValue still.getType()
Get the type of structGet the wrapped map used in the implementationReturns a boolean as to whether the struct instance is case sensitiveReturns a boolean as to whether the struct assignments are soft referencedSet a value in the struct by a string key, which we auto-convert to a Key objectSet a value in the struct by a Key objectputIfAbsent
(String key, Object value) Put a value in the struct if the key doesn't existputIfAbsent
(Key key, Object value) Put a value in the struct if the key doesn't existRemove a value from the struct by a Key objectRemove a value from the struct by a Key objectConvert the struct to a human-readable string, usually great for debugging Remember structs have no order except their internal hash codeMethods inherited from interface ortus.boxlang.runtime.dynamic.IReferenceable
assign, dereference, dereferenceAndInvoke, dereferenceAndInvoke
Methods inherited from interface ortus.boxlang.runtime.types.IType
asString, getBoxMeta
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
containsKey
Returnstrue
if this map contains a mapping for the specifiedKey
- Parameters:
key
- key whose presence in this map is to be tested- Returns:
true
if this map contains a mapping for the specified
-
containsKey
Returnstrue
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
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
Get key, with default value if not found- Parameters:
key
- The key to look fordefaultValue
- The default value to return if the key is not found- Returns:
- The value of the key
-
getOrDefault
Get key, with default value if not found- Parameters:
key
- The key to look fordefaultValue
- The default value to return if the key is not found- Returns:
- The value of the key
-
getRaw
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
Set a value in the struct by a Key object -
put
Set a value in the struct by a string key, which we auto-convert to a Key object- Parameters:
key
- The string key to setvalue
- The value to set- Returns:
- The previous value of the key, or null if not found
-
putIfAbsent
Put a value in the struct if the key doesn't exist- Specified by:
putIfAbsent
in interfaceMap<Key,
Object> - Parameters:
key
- The key to setvalue
- The value to set- Returns:
- The previous value of the key, or null if not found
-
putIfAbsent
Put a value in the struct if the key doesn't exist- Parameters:
key
- The String key to setvalue
- The value to set- Returns:
- The previous value of the key, or null if not found
-
remove
Remove a value from the struct by a Key object- Parameters:
key
- The String key to remove
-
remove
Remove a value from the struct by a Key object- Parameters:
key
- The String key to remove
-
addAll
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
Get an array list of all the keys in the struct- Returns:
- An array list of all the keys in the struct
-
getKeysAsStrings
Get an array list of all the keys in the struct- Returns:
- An array list of all the keys in the struct
-
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
Returns aSet
view of the mappings contained in this map. -
getAsKey
Convenience method for getting cast as Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsArray
Convenience method for getting cast as Array Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsStruct
Convenience method for getting cast as Struct Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsDateTime
Convenience method for getting cast as DateTime Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsString
Convenience method for getting cast as String Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsDouble
Convenience method for getting cast as Double Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsNumber
Convenience method for getting cast as Number Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsLong
Convenience method for getting cast as Long Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsInteger
Convenience method for getting cast as Integer Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsBoolean
Convenience method for getting cast as Boolean Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsFunction
Convenience method for getting cast as Function Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsQuery
Convenience method for getting cast as Query Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsXML
Convenience method for getting cast as XML Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsOptional
Convenience method for getting cast as Optional Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsAttempt
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
Convenience method for getting cast as BoxRunnable Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsBoxInterface
Convenience method for getting cast as BoxInterface Does NOT perform BoxLang casting, only Java cast so the object needs to actually be castable -
getAsStream
-
getAs
Convenience method for getting a key using the first param as the casting class- Parameters:
clazz
- The class to cast the object tokey
- The key to get- Returns:
- The object casted to the class
-