Class TranscodingRule
- java.lang.Object
-
- net.shibboleth.idp.attribute.transcoding.TranscodingRule
-
-
Constructor Summary
Constructors Constructor Description TranscodingRule(Map<String,Object> map)Constructor.TranscodingRule(Properties properties)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TranscodingRulefromResource(Resource resource)Build a new rule from a property set resource.<T> Tget(String key, Class<T> type)Get the value of a property key in the rule.Map<Locale,String>getDescriptions()Get the descriptions to attach to anyIdPAttributeobjects created by this transcoder.Map<Locale,String>getDisplayNames()Get the display names to attach to anyIdPAttributeobjects created by this transcoder.Map<String,Object>getMap()Access the underlying mapping rule.<T> TgetOrDefault(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 voidprocessDescriptions()Process any properties that start withAttributeTranscoderRegistry.PROP_DESCRIPTIONand create a Locale map around them.private voidprocessDisplayNames()Process any properties that start withAttributeTranscoderRegistry.PROP_DISPLAY_NAMEand create a Locale map around them.
-
-
-
Field Detail
-
rule
@Nonnull @NonnullElements private final Map<String,Object> rule
Underlying map containing the rule.
-
displayNames
@Nonnull @NonnullElements private Map<Locale,String> displayNames
Map of locale-specific display names.
-
descriptions
@Nonnull @NonnullElements private Map<Locale,String> descriptions
Map of locale-specific descriptions.
-
-
Constructor Detail
-
TranscodingRule
public TranscodingRule(@Nonnull @NonnullElements @ParameterName(name="map") Map<String,Object> map)
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-AttributeTranscoderinstance 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-AttributeTranscoderclass name
-
-
-
Method Detail
-
getMap
@Nonnull @NonnullElements @Live public Map<String,Object> getMap()
Access the underlying mapping rule.- Returns:
- the map representing the rule
-
get
@Nullable public <T> T get(@Nonnull @NotEmpty String key, @Nonnull Class<T> type)
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
@Nonnull @NonnullElements @NotLive @Unmodifiable public Map<Locale,String> getDisplayNames()
Get the display names to attach to anyIdPAttributeobjects created by this transcoder.- Returns:
- map of locale-based names
-
getDescriptions
@Nonnull @NonnullElements @NotLive @Unmodifiable public Map<Locale,String> getDescriptions()
Get the descriptions to attach to anyIdPAttributeobjects created by this transcoder.- Returns:
- map of locale-based descriptions
-
processDisplayNames
private void processDisplayNames()
Process any properties that start withAttributeTranscoderRegistry.PROP_DISPLAY_NAMEand create a Locale map around them.
-
processDescriptions
private void processDescriptions()
Process any properties that start withAttributeTranscoderRegistry.PROP_DESCRIPTIONand 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
-
-