Package org.keycloak.models.map.common
Interface EntityField<E>
- Type Parameters:
E-
- All Known Implementing Classes:
MapAdminEventEntityFields,MapAuthenticatedClientSessionEntityFields,MapAuthenticationExecutionEntityFields,MapAuthenticationFlowEntityFields,MapAuthenticationSessionEntityFields,MapAuthenticatorConfigEntityFields,MapAuthEventEntityFields,MapClientEntityFields,MapClientInitialAccessEntityFields,MapClientScopeEntityFields,MapComponentEntityFields,MapGroupEntityFields,MapIdentityProviderEntityFields,MapIdentityProviderMapperEntityFields,MapLockEntityFields,MapOTPPolicyEntityFields,MapPermissionTicketEntityFields,MapPolicyEntityFields,MapProtocolMapperEntityFields,MapRealmEntityFields,MapRequiredActionProviderEntityFields,MapRequiredCredentialEntityFields,MapResourceEntityFields,MapResourceServerEntityFields,MapRoleEntityFields,MapRootAuthenticationSessionEntityFields,MapScopeEntityFields,MapSingleUseObjectEntityFields,MapUserConsentEntityFields,MapUserCredentialEntityFields,MapUserEntityFields,MapUserFederatedIdentityEntityFields,MapUserLoginFailureEntityFields,MapUserSessionEntityFields,MapWebAuthnPolicyEntityFields
public interface EntityField<E>
Represents a field in an entity with appropriate accessors.
- Author:
- hmlnarik
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> voidcollectionAdd(E e, T value) Adds an element to the collection stored in this field.default <T> ObjectcollectionRemove(E e, T value) Removes an element from the collection stored in this field.Returns the value of this field.default Class<?>default Class<?>default Class<?>default Class<?>getName()Returns name of this field with no spaces where each word starts with a capital letter.Returns name of this field in lowercase with words separated by a dash (-).default <K> ObjectRetrieves a value from the map stored in this field.default <K,T> void Adds a mapping to the map stored in this field.default <K> ObjectRemoves a mapping from the map stored in this field.default <T> voidSets the value of this field.
-
Method Details
-
getName
String getName()Returns name of this field with no spaces where each word starts with a capital letter.- Returns:
-
getNameCamelCase
String getNameCamelCase() -
getNameDashed
String getNameDashed()Returns name of this field in lowercase with words separated by a dash (-).- Returns:
-
get
Returns the value of this field.- Parameters:
e- Entity- Returns:
- Value of the field
-
set
Sets the value of this field. Does nothing by default. If you want to have a field set, override this method.- Type Parameters:
T-- Parameters:
e- Entityvalue- Value of the field
-
collectionAdd
Adds an element to the collection stored in this field.- Parameters:
e- Entityvalue- Value to be added to the collection- Throws:
ClassCastException- If this field is not a collection.UnsupportedOperationException- If this collection type is not yet known.
-
collectionRemove
Removes an element from the collection stored in this field.- Parameters:
e- Entityvalue- Value to be added to the collection- Returns:
- Defined by the underlying field. Preferrably it should return deleted object, but it can return
true / falseindication of removal, or justnull. - Throws:
ClassCastException- If this field is not a collection.
-
mapGet
Retrieves a value from the map stored in this field.- Parameters:
e- Entitykey- Requested key- Returns:
- Object mapped to this key
- Throws:
ClassCastException- If this field is not a map.
-
mapPut
Adds a mapping to the map stored in this field.- Parameters:
e- Entitykey- Key to mapvalue- Mapped value- Throws:
ClassCastException- If this field is not a map.
-
mapRemove
Removes a mapping from the map stored in this field.- Parameters:
e- Entitykey- Key to remove- Returns:
- Object mapped to this key
- Throws:
ClassCastException- If this field is not a map.
-
getFieldClass
- Returns:
- Returns the most specific type of this field.
-
getCollectionElementClass
- Returns:
- If this field is a collection, returns type of its elements; otherwise returns
Voidclass.
-
getMapKeyClass
- Returns:
- If this field is a map, returns type of its keys; otherwise returns
Voidclass.
-
getMapValueClass
- Returns:
- If this field is a map, returns type of its values; otherwise returns
Voidclass.
-