Package com.activeviam.copper
Class LevelIdentifier
- java.lang.Object
-
- com.activeviam.copper.LevelIdentifier
-
- All Implemented Interfaces:
Serializable
public final class LevelIdentifier extends Object implements Serializable
The identifier of a level in a cube.- Author:
- ActiveViam
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description StringlevelThe level name.HierarchyIdentifierparentThe identifier of the hierarchy containing this level.
-
Constructor Summary
Constructors Constructor Description LevelIdentifier(HierarchyIdentifier hierarchy, String level)Constructor.LevelIdentifier(String dimension, String hierarchy, String level)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static LevelIdentifierfromDescription(@NonNull String description)Parses a description of the form levelName@hierarchyName@dimensionName to create an identifier from it.HierarchyIdentifiergetHierarchy()Gets the hierarchy of the level.inthashCode()static LevelIdentifiersimple(String level)Creates an identifier for a level belonging to a simple hierarchy where level, hierarchy and dimension share the same name.StringtoDescription()Converts this level identifier to a string of the form levelName@hierarchyName@dimensionName to be used in String based descriptions.static StringtoDescription(String dimension, String hierarchy, String level)Converts this level identifier to a string of the form levelName@hierarchyName@dimensionName to be used in String based descriptions.StringtoString()
-
-
-
Field Detail
-
parent
public final HierarchyIdentifier parent
The identifier of the hierarchy containing this level.
-
level
public final String level
The level name.
-
-
Constructor Detail
-
LevelIdentifier
public LevelIdentifier(String dimension, String hierarchy, String level)
Constructor.- Parameters:
dimension- the dimension namehierarchy- the hierarchy namelevel- the level name
-
LevelIdentifier
public LevelIdentifier(HierarchyIdentifier hierarchy, String level)
Constructor.- Parameters:
hierarchy- the parent hierarchy identifierlevel- the level name
-
-
Method Detail
-
simple
public static LevelIdentifier simple(String level)
Creates an identifier for a level belonging to a simple hierarchy where level, hierarchy and dimension share the same name.- Parameters:
level- name of the level- Returns:
- created identifier
-
getHierarchy
public HierarchyIdentifier getHierarchy()
Gets the hierarchy of the level.- Returns:
- the hierarchy of the level
-
toDescription
public String toDescription()
Converts this level identifier to a string of the form levelName@hierarchyName@dimensionName to be used in String based descriptions.- Returns:
- the levelName@hierarchyName@dimensionName String
-
toDescription
public static String toDescription(String dimension, String hierarchy, String level)
Converts this level identifier to a string of the form levelName@hierarchyName@dimensionName to be used in String based descriptions.- Parameters:
dimension- the dimension namehierarchy- the hierarchy namelevel- the level name- Returns:
- the levelName@hierarchyName@dimensionName String
- See Also:
HierarchyIdentifier.DESCRIPTION_SEPARATOR,HierarchyIdentifier.DESCRIPTION_ESCAPING_CHAR
-
fromDescription
public static LevelIdentifier fromDescription(@NonNull @NonNull String description)
Parses a description of the form levelName@hierarchyName@dimensionName to create an identifier from it.- Parameters:
description- the description to parse, caller should ensure this description is valid, in case of malformed input the returnedLevelIdentifierwill be inconsistent- Returns:
- the identifier extracted from the description
-
-