intarsys runtime library

de.intarsys.tools.preferences
Class PreferencesTools

java.lang.Object
  extended by de.intarsys.tools.preferences.PreferencesTools

public class PreferencesTools
extends Object

A tool class for some common tasks when dealing with IPreferences.


Field Summary
static String ELEMENT_SEPARATOR
           
static String KEY_VALUE_SEPARATOR
           
 
Method Summary
static String fitKey(String name)
           
static
<T extends EnumItem>
T
getEnumItem(IPreferences preferences, EnumMeta<T> meta, String name)
           
static
<T extends EnumItem>
T
getEnumItem(IPreferences preferences, EnumMeta<T> meta, String name, String defaultValue)
           
static String getLarge(IPreferences preferences, String name, String defaultValue)
           
static String getSecret(IPreferences preferences, String name, String defaultValue)
           
static void importPreferences(IPreferences root, IPreferences source)
           
static void mergeArgs(IPreferences source, IArgs args)
          Add all argument bindings stored in source to args.
static void putArgs(IPreferences preferences, IArgs args, IDeclarationBlock block)
          Serialize the declared argument bindings to a preferences node.
static void putArgsAll(IPreferences preferences, IArgs args, boolean secret)
          Save all argument bindings in the preferences node.
static void putArgsDeclared(IPreferences preferences, IArgs args, IDeclarationElement[] declarations, boolean secret)
          Serialize the declared argument bindings to a preferences node.
static void putArgValue(IPreferences preferences, String name, Object pValue, IArgumentDeclaration argDecl, boolean secret)
          Serialize a name/value pair in a preferences node.
static void putEnumItem(IPreferences preferences, String name, EnumItem item)
           
static void putLarge(IPreferences preferences, String name, String longValue)
           
static void putSecret(IPreferences preferences, String name, String value)
           
static Rectangle toRect(String value)
           
static Rectangle toRect(String value, int[] ranges)
           
static String toString(float[] value)
           
static String toString(int[] value)
           
static String toString(List value)
           
static String toString(Map map)
           
static String toString(Rectangle rect)
           
static String toString(String[] value)
           
static String[] toStringArray(String value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_SEPARATOR

public static final String ELEMENT_SEPARATOR
See Also:
Constant Field Values

KEY_VALUE_SEPARATOR

public static final String KEY_VALUE_SEPARATOR
See Also:
Constant Field Values
Method Detail

fitKey

public static String fitKey(String name)

getEnumItem

public static <T extends EnumItem> T getEnumItem(IPreferences preferences,
                                                 EnumMeta<T> meta,
                                                 String name)

getEnumItem

public static <T extends EnumItem> T getEnumItem(IPreferences preferences,
                                                 EnumMeta<T> meta,
                                                 String name,
                                                 String defaultValue)

getLarge

public static String getLarge(IPreferences preferences,
                              String name,
                              String defaultValue)

getSecret

public static String getSecret(IPreferences preferences,
                               String name,
                               String defaultValue)

importPreferences

public static void importPreferences(IPreferences root,
                                     IPreferences source)
                              throws BackingStoreException
Throws:
BackingStoreException

mergeArgs

public static void mergeArgs(IPreferences source,
                             IArgs args)
Add all argument bindings stored in source to args.

Parameters:
source -
args -

putArgs

public static void putArgs(IPreferences preferences,
                           IArgs args,
                           IDeclarationBlock block)
Serialize the declared argument bindings to a preferences node.

This implementation does not remove any binding from preferences. If this is required, you should clear the preferences beforehand.

Parameters:
preferences -
args -
block -

putArgsAll

public static void putArgsAll(IPreferences preferences,
                              IArgs args,
                              boolean secret)
Save all argument bindings in the preferences node.

This implementation does not remove any binding from preferences. If this is required, you should clear the preferences beforehand.

Parameters:
preferences -
args -
secret -

putArgsDeclared

public static void putArgsDeclared(IPreferences preferences,
                                   IArgs args,
                                   IDeclarationElement[] declarations,
                                   boolean secret)
Serialize the declared argument bindings to a preferences node.

This implementation does not remove any binding from preferences. If this is required, you should clear the preferences beforehand.

Parameters:
preferences -
args -
declarations -

putArgValue

public static void putArgValue(IPreferences preferences,
                               String name,
                               Object pValue,
                               IArgumentDeclaration argDecl,
                               boolean secret)
Serialize a name/value pair in a preferences node.

If value is itself an IArgs structure, argument serialization is recursed.

Parameters:
preferences -
name -
pValue -
argDecl -
secret -

putEnumItem

public static void putEnumItem(IPreferences preferences,
                               String name,
                               EnumItem item)

putLarge

public static void putLarge(IPreferences preferences,
                            String name,
                            String longValue)

putSecret

public static void putSecret(IPreferences preferences,
                             String name,
                             String value)

toRect

public static Rectangle toRect(String value)

toRect

public static Rectangle toRect(String value,
                               int[] ranges)

toString

public static String toString(float[] value)

toString

public static String toString(int[] value)

toString

public static String toString(List value)

toString

public static String toString(Map map)

toString

public static String toString(Rectangle rect)

toString

public static String toString(String[] value)

toStringArray

public static String[] toStringArray(String value)

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.