Class AbstractAttributeDisplayFunction
- java.lang.Object
-
- net.shibboleth.idp.consent.logic.impl.AbstractAttributeDisplayFunction
-
- All Implemented Interfaces:
Function<IdPAttribute,String>
- Direct Known Subclasses:
AttributeDisplayDescriptionFunction,AttributeDisplayNameFunction
public abstract class AbstractAttributeDisplayFunction extends Object implements Function<IdPAttribute,String>
Abstract Function which returnsLocale-aware information about an attribute. The abstract methodgetDisplayInfo(AttributeTranscoderRegistry, IdPAttribute)returns the information selected for the attribute from the transcoder. This function defaults to returning the attribute ID if no information is selected from the attribute for the desired locales.
-
-
Field Summary
Fields Modifier and Type Field Description private Map<IdPAttribute,Map<Locale,String>>cachedInfoCache of already looked up values.private List<Locale.LanguageRange>defaultLanguageRangeThe tags for the fallback languages.private List<Locale.LanguageRange>languageRangeThe range of locales from the request.private ReloadableService<AttributeTranscoderRegistry>transcoderHow to do the lookup.
-
Constructor Summary
Constructors Constructor Description AbstractAttributeDisplayFunction(javax.servlet.http.HttpServletRequest request, List<String> defaultLanguages, ReloadableService<AttributeTranscoderRegistry> transcoderService)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringapply(IdPAttribute input)protected abstract Map<Locale,String>getDisplayInfo(AttributeTranscoderRegistry registry, IdPAttribute attribute)Get the information to be displayed from the attribute.
-
-
-
Field Detail
-
languageRange
@Nonnull @Unmodifiable private final List<Locale.LanguageRange> languageRange
The range of locales from the request.
-
defaultLanguageRange
@Nonnull @Unmodifiable private final List<Locale.LanguageRange> defaultLanguageRange
The tags for the fallback languages.
-
cachedInfo
@Nonnull private Map<IdPAttribute,Map<Locale,String>> cachedInfo
Cache of already looked up values.
-
transcoder
@Nonnull private ReloadableService<AttributeTranscoderRegistry> transcoder
How to do the lookup.
-
-
Constructor Detail
-
AbstractAttributeDisplayFunction
public AbstractAttributeDisplayFunction(@Nonnull javax.servlet.http.HttpServletRequest request, @Nullable List<String> defaultLanguages, ReloadableService<AttributeTranscoderRegistry> transcoderService)Constructor.- Parameters:
request-HttpServletRequestused to get preferred languagesdefaultLanguages- list of fallback languages in order of decreasing preferencetranscoderService- the attribute transcoder service
-
-
Method Detail
-
apply
@Nullable public String apply(@Nullable IdPAttribute input)
- Specified by:
applyin interfaceFunction<IdPAttribute,String>
-
getDisplayInfo
@Nonnull protected abstract Map<Locale,String> getDisplayInfo(@Nonnull AttributeTranscoderRegistry registry, @Nonnull IdPAttribute attribute)
Get the information to be displayed from the attribute.- Parameters:
registry- theAttributeTranscoderRegistryto ask.attribute- the attribute to consider- Returns:
- the map of locale dependent information to be displayed
-
-