public final class EntityConverterUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
convertEntityId(EntityId id,
ConverterProvider converterProvider)
Converts the given entity id to its typed entity id value using the matching id converter.
|
static EntityId |
convertToEntityId(String typedIdValue,
ConverterProvider converterProvider)
Converts the given typed entity id value using the matching id converter.
|
static EntityId |
convertToEntityId(String idValue,
String typeName,
ConverterProvider converterProvider)
Converts the given entity id value using the matching id converter.
|
static EntityId |
convertToEntityId(String idValue,
String typeName,
ConverterProvider converterProvider,
EntityManager<?,?,?,?,?,?,?,?,?> manager)
Converts the given entity id value to an entity id.
|
static <S,T> ValueConverter<S,T> |
getConverterByName(String converterName,
List<? extends ValueConverter<S,T>> converters)
Returns the converter with the given name.
|
static <S,T> ValueConverter<S,T> |
getConverterBySourceValue(Object sourceValue,
List<? extends ValueConverter<S,T>> converters)
Returns the converter that can handle the given source value.
|
static com.google.common.base.Optional<? extends ValueConverter<EntityId,String>> |
getEntityIdConverter(EntityId id,
ConverterProvider converterProvider)
Returns the first matching id converter for the given entity id.
|
static com.google.common.base.Optional<? extends ValueConverter<EntityId,String>> |
getEntityIdConverter(String typedIdValue,
ConverterProvider converterProvider)
Returns the first matching id converter for the given typed entity id value.
|
static com.google.common.base.Optional<? extends ValueConverter<EntityId,String>> |
getEntityIdConverter(String idValue,
String typeName,
ConverterProvider converterProvider)
Returns the first matching id converter for the given entity id value.
|
static com.google.common.collect.ImmutableList<? extends ValueConverter<EntityId,String>> |
getEntityIdConverters(ConverterProvider converterProvider)
Returns all id converters.
|
static com.google.common.collect.ImmutableList<? extends ValueConverter<Id,String>> |
getIdentityLinkConverters(ConverterProvider converterProvider)
Returns all identity link converters.
|
static com.google.common.collect.ImmutableList<? extends ValueConverter<String,Object>> |
getPropertyConverters(ConverterProvider converterProvider)
Returns all property converters.
|
static com.google.common.collect.ImmutableList<? extends ValueConverter<Object,Object>> |
getVariableConverters(ConverterProvider converterProvider)
Returns all variable converters.
|
public static EntityId convertToEntityId(String idValue, String typeName, ConverterProvider converterProvider)
idValue
- the entity id value to converttypeName
- the name of type of the entity for which to create the entity idconverterProvider
- the provider from which to retrieve the convertersIllegalArgumentException
- thrown if no matching provider can be foundpublic static EntityId convertToEntityId(String typedIdValue, ConverterProvider converterProvider)
typedIdValue
- the typed entity id value to convertconverterProvider
- the provider from which to retrieve the convertersIllegalArgumentException
- thrown if no matching provider can be foundpublic static String convertEntityId(EntityId id, ConverterProvider converterProvider)
id
- the entity id to convertconverterProvider
- the provider from which to retrieve the convertersIllegalStateException
- thrown if no matching provider can be foundpublic static EntityId convertToEntityId(String idValue, String typeName, ConverterProvider converterProvider, EntityManager<?,?,?,?,?,?,?,?,?> manager)
idValue
- the entity id value to converttypeName
- the type name of the entity for which to create the entity idconverterProvider
- the converter providers that are used as the primary source to convert the entity id valuemanager
- the manager that is used as a fallback when there is no matching converter to do the conversion of the entity id valuepublic static com.google.common.base.Optional<? extends ValueConverter<EntityId,String>> getEntityIdConverter(String idValue, String typeName, ConverterProvider converterProvider)
idValue
- the entity id value to match againsttypeName
- the name of type of the entity to match againstconverterProvider
- the provider from which to retrieve the converterspublic static com.google.common.base.Optional<? extends ValueConverter<EntityId,String>> getEntityIdConverter(String typedIdValue, ConverterProvider converterProvider)
typedIdValue
- the typed entity id value to match againstconverterProvider
- the provider from which to retrieve the converterspublic static com.google.common.base.Optional<? extends ValueConverter<EntityId,String>> getEntityIdConverter(EntityId id, ConverterProvider converterProvider)
id
- the entity id to match againstconverterProvider
- the provider from which to retrieve the converterspublic static com.google.common.collect.ImmutableList<? extends ValueConverter<EntityId,String>> getEntityIdConverters(ConverterProvider converterProvider)
converterProvider
- the provider from which to retrieve the converterspublic static com.google.common.collect.ImmutableList<? extends ValueConverter<Object,Object>> getVariableConverters(ConverterProvider converterProvider)
converterProvider
- the provider from which to retrieve the converterspublic static com.google.common.collect.ImmutableList<? extends ValueConverter<Id,String>> getIdentityLinkConverters(ConverterProvider converterProvider)
converterProvider
- the provider from which to retrieve the converterspublic static com.google.common.collect.ImmutableList<? extends ValueConverter<String,Object>> getPropertyConverters(ConverterProvider converterProvider)
converterProvider
- the provider from which to retrieve the converterspublic static <S,T> ValueConverter<S,T> getConverterByName(String converterName, List<? extends ValueConverter<S,T>> converters)
S
- the source typeT
- the target typeconverterName
- the converter name to match against, must not be nullconverters
- the candidate converterspublic static <S,T> ValueConverter<S,T> getConverterBySourceValue(Object sourceValue, List<? extends ValueConverter<S,T>> converters)
S
- the source typeT
- the target typesourceValue
- the source value to handle, must not be nullconverters
- the candidate convertersCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.