Class TranscodingRule
java.lang.Object
net.shibboleth.idp.attribute.transcoding.TranscodingRule
Wrapper around a
Map
representing a rule for transcoding, used to
detect and load the rules at runtime from a Spring context.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTranscodingRule
(Map<String, Object> map) Constructor.TranscodingRule
(Properties properties) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic TranscodingRule
fromResource
(Resource resource) Build a new rule from a property set resource.<T> T
Get the value of a property key in the rule.Get the descriptions to attach to anyIdPAttribute
objects created by this transcoder.Get the display names to attach to anyIdPAttribute
objects created by this transcoder.getMap()
Access the underlying mapping rule.<T> T
getOrDefault
(String key, Class<T> type, T defValue) Get the value of a property key in the rule or a default value if no property exists.private void
Process any properties that start withAttributeTranscoderRegistry.PROP_DESCRIPTION
and create a Locale map around them.private void
Process any properties that start withAttributeTranscoderRegistry.PROP_DISPLAY_NAME
and create a Locale map around them.
-
Field Details
-
rule
Underlying map containing the rule. -
displayNames
Map of locale-specific display names. -
descriptions
Map of locale-specific descriptions.
-
-
Constructor Details
-
TranscodingRule
Constructor.- Parameters:
map
- a map containing the ruleThe rule MUST contain at least:
-
AttributeTranscoderRegistry.PROP_ID
- internal attribute ID to map to/from -
AttributeTranscoderRegistry.PROP_TRANSCODER
-AttributeTranscoder
instance supporting the type
-
-
TranscodingRule
public TranscodingRule(@Nonnull @NonnullElements @ParameterName(name="properties") Properties properties) Constructor.- Parameters:
properties
- a property set to initialize the mapThe rule MUST contain at least:
-
AttributeTranscoderRegistry.PROP_ID
- internal attribute ID to map to/from -
AttributeTranscoderRegistry.PROP_TRANSCODER
-AttributeTranscoder
class name
-
-
-
Method Details
-
getMap
Access the underlying mapping rule.- Returns:
- the map representing the rule
-
get
Get the value of a property key in the rule.- Type Parameters:
T
- type of property value- Parameters:
key
- key of propertytype
- class type of property- Returns:
- the mapped value, or null
-
getOrDefault
@Nullable public <T> T getOrDefault(@Nonnull @NotEmpty String key, @Nonnull Class<T> type, @Nullable T defValue) Get the value of a property key in the rule or a default value if no property exists.- Type Parameters:
T
- type of property value- Parameters:
key
- key of propertytype
- class type of propertydefValue
- default value- Returns:
- the mapped value, or the default
-
getDisplayNames
Get the display names to attach to anyIdPAttribute
objects created by this transcoder.- Returns:
- map of locale-based names
-
getDescriptions
Get the descriptions to attach to anyIdPAttribute
objects created by this transcoder.- Returns:
- map of locale-based descriptions
-
processDisplayNames
private void processDisplayNames()Process any properties that start withAttributeTranscoderRegistry.PROP_DISPLAY_NAME
and create a Locale map around them. -
processDescriptions
private void processDescriptions()Process any properties that start withAttributeTranscoderRegistry.PROP_DESCRIPTION
and create a Locale map around them. -
fromResource
@Nonnull public static TranscodingRule fromResource(@Nonnull @ParameterName(name="resource") Resource resource) throws IOException Build a new rule from a property set resource.- Parameters:
resource
- a property set to initialize the map- Returns:
- the new rule
- Throws:
IOException
- if an error occurs
-