Interface Key
-
- All Known Subinterfaces:
AnnotationId,AxisType,ColorScheme,DataLabelId,IsEvent,IsFill,IsInteractionMode,IsKeyboardKey,IsLocaleItem,IsProgressBarType,IsShape,IsToastType,IsTooltipPosition,LabelId,PropertyKey,ScaleId,TransitionMode,Type
- All Known Implementing Classes:
AbsoluteDatasetIndexFill,AbstractDataPoint.CharbaProperty,AbstractKey,AbstractPluginOptions.Property,AbstractXYDataPoint.XYProperty,Align,Align,Align,Align,Align,Anchor,Anchor,AnimationEventType,AnimationType,AnnotationType,AxisKind,AxisPosition,BarDatasetOptionsHandler.Property,BorderAlign,BorderItemType,BorderSkipped,BorderStyle,Bounds,BrewerScheme,Calendar,CalloutPosition,CapStyle,CharacterShape,ChartAxisType,ChartEventProperty,ChartType,ClipMap,ColorMode,ColorType,CompactDisplay,ContextType,ControllerType,CrossAlign,CubicInterpolationMode,Currency,CurrencyDisplay,CurrencySign,CursorType,CustomTooltipPosition,DataPointType,Dataset.CanvasObjectProperty,Dataset.CommonProperty,DatasetSeletionEventType,DataType,DateTimeStyle,DecimationAlgorithm,DefaultAnimationCollectionKey,DefaultAnimationPropertyKey,DefaultInteractionMode,DefaultPluginId,DefaultProgressBarType,DefaultScaleId,DefaultToastType,DefaultTransitionMode,Display,Display,DrawTime,DrawTime,DrawTime,Easing,ElementAlign,Event,Event,EventType,Fill,FillHandler.Property,FillingMode,FillRule,FontStyle,FormatMatcher,FormatPartType,GlobalCompositeOperation,GoogleChartScheme,GradientOrientation,GradientScope,GradientType,GwtMaterialScheme,HourCycle,Id,ImageMimeType,ImageShape,IndexAxis,InteractionAxis,Interpolate,JoinStyle,KeyboardCommonKey,KeyboardEditingKey,KeyboardEventType,KeyboardFunctionKey,KeyboardModifierKey,KeyboardNavigationKey,KeyboardUiKey,KeyboardWhitespaceKey,LabelPosition,Language,LegendEventProperty,LegendTextHandler.Property,LocaleMatcher,MeasureUnit,MeasureUnitDisplay,MixedItemStyle,Mode,Mode,ModifierKey,MouseEventType,MutationType,Notation,NumberingSystem,NumberItemStyle,OfficeScheme,Options.CommonProperty,Overflow,PluginOptionsScope,PointerElement,PointerEventType,PointerType,PointStyle,PointStyleType,Position,Position,Position,Position,Position,Projection,Region,RegressionType,RelativeDatasetIndexFill,Render,Render,Repetition,ResourceName,ScaleTitleAlign,SchemeScope,Script,Shape,SignDisplay,Size,SpanGapHandler.Property,Status,Stepped,StringItemStyle,Style,TableauScheme,TextAlign,TextBaseline,TextDecoration,TextDirection,TickAlign,TickSource,TimeUnit,TimeZone,TimeZoneName,TooltipAlign,TooltipPosition,TouchEventType,Unit,Visibility,Weight
public interface KeyRepresents the property key of a JavaScript object.
Used for enum.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <T extends Key>
TcheckAndGetIfValid(T key)Checks if key passed as argument is notnulland its value is notnullas well.
If not, throw aIllegalArgumentException, otherwise it returns the key.static voidcheckIfValid(Key key)Checks if key passed as argument is notnulland its value is notnullas well.
If not, throw aIllegalArgumentException.static intcompare(Key k1, Key k2)Compares the two specified key values.static Keycreate(String key)Returns a key instance by its string value.static booleanequals(Key k1, Key k2)Returnstrueif the keys have got the same value.static <T extends Key>
TgetKeyByValue(T[] enumValues, String value)Returns a key in the an enumeration by the value.static <T extends Key>
TgetKeyByValue(T[] enumValues, String value, T defaultKey)Returns a key in the an enumeration by the value, or the default key passed as argument.static <T extends Key>
booleanhasKeyByValue(T[] enumValues, String value)Returnstrueif a key in the an enumeration is related to the value, otherwisefalse.static booleanisValid(Key key)Returnstrueif key passed as argument is notnulland its value is notnullas well.Stringvalue()Returns the name value of property
-
-
-
Method Detail
-
create
static Key create(String key)
Returns a key instance by its string value.- Parameters:
key- string value to use- Returns:
- a standard key instance
-
isValid
static boolean isValid(Key key)
Returnstrueif key passed as argument is notnulland its value is notnullas well.- Parameters:
key- key to be checked- Returns:
trueif key passed as argument is notnulland its value is notnullas well.
-
checkIfValid
static void checkIfValid(Key key)
Checks if key passed as argument is notnulland its value is notnullas well.
If not, throw aIllegalArgumentException.- Parameters:
key- key to be checked
-
checkAndGetIfValid
static <T extends Key> T checkAndGetIfValid(T key)
Checks if key passed as argument is notnulland its value is notnullas well.
If not, throw aIllegalArgumentException, otherwise it returns the key.- Type Parameters:
T- type of key- Parameters:
key- key to be checked- Returns:
- the same key passed as argument
-
hasKeyByValue
static <T extends Key> boolean hasKeyByValue(T[] enumValues, String value)
Returnstrueif a key in the an enumeration is related to the value, otherwisefalse.- Type Parameters:
T- type of key- Parameters:
enumValues- enumeration values of keysvalue- value to search in the key- Returns:
trueif a key in the an enumeration is related to the value, otherwisefalse
-
getKeyByValue
static <T extends Key> T getKeyByValue(T[] enumValues, String value)
Returns a key in the an enumeration by the value.- Type Parameters:
T- type of key- Parameters:
enumValues- enumeration values of keysvalue- value to search in the key- Returns:
- the found key by value or
null
-
getKeyByValue
static <T extends Key> T getKeyByValue(T[] enumValues, String value, T defaultKey)
Returns a key in the an enumeration by the value, or the default key passed as argument.- Type Parameters:
T- type of key- Parameters:
enumValues- enumeration values of keysvalue- value to search in the keydefaultKey- default key instance if the value is not found- Returns:
- the found key by value or the default one
-
compare
static int compare(Key k1, Key k2)
Compares the two specified key values.- Parameters:
k1- the first key to comparek2- the second key to compare- Returns:
- the value 0 if k1 value is equal to k2; a value less than 0 if k1 value is less than k2; and a value greater than 0 if k1 value is greater than k2.
-
equals
static boolean equals(Key k1, Key k2)
Returnstrueif the keys have got the same value.- Parameters:
k1- the first key to comparek2- the second key to compare- Returns:
trueif the keys have got the same value
-
value
String value()
Returns the name value of property- Returns:
- the name value of property
-
-