Class SchemaUtils
- java.lang.Object
-
- de.hybris.platform.odata2services.odata.schema.utils.SchemaUtils
-
public final class SchemaUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTAINER_NAMEstatic java.lang.StringNAMESPACE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbuildAssociationName(java.lang.String sourceTypeCode, java.lang.String targetTypeCode)static java.util.List<org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute>createNamespaceAnnotations()Defines new annotation attributes for things like namespacesstatic java.util.Optional<TypeAttributeDescriptor>findFirstLocalizedAttribute(java.util.Collection<IntegrationObjectItemAttributeModel> attributeModels)Finds the first localized attribute from theCollectionof attributesstatic java.lang.StringfullyQualified(java.lang.String name)Prepends schema name to the specified name.static java.lang.StringlocalizedEntityName(java.lang.String typeCode)Returns the localized entity namestatic <T,U>
java.util.List<T>removeDuplicates(java.util.List<T> list, java.util.function.Function<T,U> idFunction)Removes duplicates from the givenListAn example usage would be: Given aListTo remove replicates, calllist = Arrays.asList("a", "b", "a"); removeDuplicates(list, e -> e);, where the idFunction is the element e itself.static org.apache.olingo.odata2.api.edm.FullQualifiedNametoFullQualifiedName(java.lang.String name)Converts specified simple schema element name to the fully qualified name.
-
-
-
Field Detail
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
CONTAINER_NAME
public static final java.lang.String CONTAINER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
fullyQualified
public static java.lang.String fullyQualified(java.lang.String name)
Prepends schema name to the specified name.- Parameters:
name- name of a schema element, e.g. EnityType, to be presented in a fully qualified format.- Returns:
- string presentation of the fully qualified name.
- Throws:
java.lang.IllegalArgumentException- if the specified name isnull, empty or blank.
-
toFullQualifiedName
public static org.apache.olingo.odata2.api.edm.FullQualifiedName toFullQualifiedName(java.lang.String name)
Converts specified simple schema element name to the fully qualified name.- Parameters:
name- name of a schema element, e.g. EntityType, to be converted.- Returns:
- fully qualified name.
- Throws:
java.lang.IllegalArgumentException- if the specified name isnull, empty or blank.
-
buildAssociationName
public static java.lang.String buildAssociationName(java.lang.String sourceTypeCode, java.lang.String targetTypeCode)
-
localizedEntityName
public static java.lang.String localizedEntityName(java.lang.String typeCode)
Returns the localized entity name- Parameters:
typeCode- type of the integration object item- Returns:
- localized entity name
-
removeDuplicates
public static <T,U> java.util.List<T> removeDuplicates(java.util.List<T> list, java.util.function.Function<T,U> idFunction)Removes duplicates from the givenListAn example usage would be: Given aListTo remove replicates, calllist = Arrays.asList("a", "b", "a"); removeDuplicates(list, e -> e);, where the idFunction is the element e itself. The resulting list would be["a", "b"].- Type Parameters:
T- Type of the elements in theListU- Type of the unique identifier of object T- Parameters:
list- List to remove the duplicates fromidFunction- Function that returns the identifier that uniquely identifies object of type T- Returns:
- List of type T with duplicates removed
-
findFirstLocalizedAttribute
public static java.util.Optional<TypeAttributeDescriptor> findFirstLocalizedAttribute(java.util.Collection<IntegrationObjectItemAttributeModel> attributeModels)
Finds the first localized attribute from theCollectionof attributes- Parameters:
attributeModels- Collection of attributes- Returns:
- An
Optionalcontaining theTypeAttributeDescriptorif found, otherwise empty
-
createNamespaceAnnotations
public static java.util.List<org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute> createNamespaceAnnotations()
Defines new annotation attributes for things like namespaces- Returns:
- the newly defined annotation attributes
-
-