Class Option<Type>

    • Constructor Detail

      • Option

        protected Option​(@NonNls @NotNull
                         String key,
                         @NotNull
                         Type defaultValue)
        Parameters:
        key - name of the parameter. Used in equals and hashCode
        defaultValue - default value for this option, if not specified
    • Method Detail

      • fromString

        public abstract Type fromString​(@NotNull
                                        String value)
        Option values are serialized to strings using toString() call. To restore option value from string this method is used
        Parameters:
        value - serialized option value Object.toString() method is used for serialization)
        Returns:
        deserialized value
      • toString

        public abstract String toString​(Type value)
        Serialize option value to string
        Parameters:
        value - value to serialize
        Returns:
        serialized option value
      • fromKey

        @Nullable
        public static Option fromKey​(String key)
        Find option with given key in the registry of options
        Parameters:
        key - option key, see getKey()
        Returns:
        option for this key
      • getKey

        @NotNull
        public String getKey()
        Returns:
        key of the option (non-displayable)
      • getDefaultValue

        @NotNull
        public Type getDefaultValue()
        Returns:
        default value of the option
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object