Package net.shibboleth.idp.authn.principal

# Class GenericPrincipalService<T extends Principal>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.authn.principal.GenericPrincipalService<T>

Type Parameters:
  `T` - type of principal

All Implemented Interfaces:
  `PrincipalService<T>`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`

public class GenericPrincipalService<T extends Principal> extends AbstractIdentifiableInitializableComponent implements PrincipalService<T>
`PrincipalService` for most principal types that just exposes the proper `PrincipalSerializer`.

Mainly provided in the event that the service API gets more complex.

Since:
  4.1.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private final PrincipalSerializer<String>`
`principalSerializer`
Generic principal serializer.
`private final Class<T>`
`principalType`
Type of principal.

## Constructor Summary

Constructors
Constructor
Description
`GenericPrincipalService(Class<T> claz, PrincipalSerializer<String> serializer)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`PrincipalSerializer<String>`
`getSerializer()`
Get a serializer instance for this type of `Principal`.
`Class<T>`
`getType()`
Get the type of object supported.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### principalType

@Nonnull private final Class<T extends Principal> principalType
Type of principal.

### principalSerializer

@Nonnull private final PrincipalSerializer<String> principalSerializer
Generic principal serializer.

## Constructor Details

### GenericPrincipalService

public GenericPrincipalService(@Nonnull @ParameterName(name="claz") Class<T> claz, @Nonnull @ParameterName(name="serializer") PrincipalSerializer<String> serializer)
Constructor.

Parameters:
  `claz` - the principal type
  `serializer` - the principal serializer to use

## Method Details

### getType

@Nonnull public Class<T> getType()
Get the type of object supported.

Specified by:
  `getType` in interface `PrincipalService<T extends Principal>`
Returns:
  supported type

### getSerializer

@Nonnull public PrincipalSerializer<String> getSerializer()
Get a serializer instance for this type of `Principal`.

Specified by:
  `getSerializer` in interface `PrincipalService<T extends Principal>`
Returns:
  the serializer