Class MappingPropertySkeleton<K,V>
- Type Parameters:
K- the java type of the keyV- the java type of the value
- All Implemented Interfaces:
Property<Map<K,V>>, Property.MultiValue<Map<K, V>>
A MappingProperty represents a Map. It has one key type and one value type.
For example, think of validators that should validate request parameters based on their type.
These validators can be registered via a MappingPropertySkeleton<Class, Validator>, basically representing
an Map<Class, Validator>.
If multiple PropertyProviders are registered for this property at the same introspection instance, all values are combined and the ones
from a provider with a higher priority
override the values of the ones from provider with a lower priority. (think of Map.put(Object, Object)).
For information on how fallback values are trod, visit the documentation of Property.FallbackStrategy.
If you have multiple PropertyProviders registered at different introspection instances, that are related to each other
(the one is child of the other), the above applies for each introspection instance itself. The final value is then computed
by combining all values under the rule that values from a child override the parents' ones.
For example, take a look here (simplified API):
IntrospectionSkeleton A = IntrospectionImplSkeleton.create(Scopes.ROOT)
.addBuilder(Property.MAPPING, _ -> Map.of("foo", "Value A Builder")) // builder has higher priority than fallback
.addFallback(Property.MAPPING, _ -> Map.of("foo", "Value A Fallback"))
.build();
A.get(Property.MAPPING).get("foo") // returns "Value A Builder"
IntrospectionSkeleton B = A.createChild(Scopes.ROOT)
.addFallback(Property.MAPPING, _ -> Map.of("foo", "Value B"))
.build();
B.get(Property.MAPPING).get("foo") // returns "Value B"
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Property
Property.FallbackStrategy, Property.MultiValue<T>, Property.SingleValue<T>, Property.Source -
Constructor Summary
ConstructorsConstructorDescriptionMappingPropertySkeleton(String name, Property.Source source, Scope scope, Class<K> keyType, Class<V> valueType, Property.FallbackStrategy fallbackStrategy) -
Method Summary
Modifier and TypeMethodDescriptionbooleantheProperty.FallbackStrategyused determine how to treadPropertyProviders with priority set toPriority.FALLBACKinthashCode()keyType()the java type of the keyname()The name of this property.scope()TheScopethat this property is bound to.source()TheProperty.Sourceof this property.toString()the java type of the value
-
Constructor Details
-
MappingPropertySkeleton
public MappingPropertySkeleton(String name, Property.Source source, Scope scope, Class<K> keyType, Class<V> valueType, Property.FallbackStrategy fallbackStrategy) - Parameters:
name- the name of this propertysource- the source of this propertyscope- the scope of this propertykeyType- the key's java type of this propertyvalueType- the value's java type of this propertyfallbackStrategy- the fallback strategy of this property
-
-
Method Details
-
name
-
source
TheProperty.Sourceof this property. -
scope
-
fallbackStrategy
theProperty.FallbackStrategyused determine how to treadPropertyProviders with priority set toPriority.FALLBACK- Specified by:
fallbackStrategyin interfaceProperty.MultiValue<K>- Returns:
- the used
Property.FallbackStrategy
-
keyType
-
valueType
-
equals
-
hashCode
-
toString
-