/* (non-Javadoc)
@see nyla.solutions.core.util.Settings#getPropertyCharacter(java.lang.Class, java.lang.String, char)
976770
@Override
	public Character getPropertyCharacter(Class<?> aClass, String key,
			char defaultValue)
	{
		String results = getProperty(aClass, key, "");

		if (results.length() == 0)
			return Character.valueOf(defaultValue);
		else
			return Character.valueOf(results.charAt(0));// return first character

	}
902106
public Character getCharacterProperty(String key) {
    JsonElement propertyKey = properties().get(key);
    return propertyKey == null ? null : propertyKey.getAsCharacter();
  }
1033515
@SuppressWarnings("unchecked")
	private <T> T getPropertyAs(String propertyName, Class<T> propertyType) {
		final String sValue = properties == null ? null : properties.getProperty(propertyName);
		final T value;
		if (sValue == null) {
			value = null;
		} else if (propertyType.equals(String.class)) {
			value = propertyType.cast(sValue);
		} else if (propertyType.equals(Integer.class)) {
			value = propertyType.cast(Integer.valueOf(sValue));
		} else if (propertyType.equals(int.class)) {
			value = (T) Integer.valueOf(sValue);
		} else if (propertyType.equals(Long.class)) {
			value = propertyType.cast(Long.valueOf(sValue));
		} else if (propertyType.equals(long.class)) {
			value = (T) Long.valueOf(sValue);
		} else if (propertyType.equals(Boolean.class)) {
			value = propertyType.cast(Boolean.valueOf(sValue));
		} else if (propertyType.equals(boolean.class)) {
			value = (T) Boolean.valueOf(sValue);
		} else {
			value = null;
		}
		return value;
	}
678487
@Override
    public String getCharacterEncoding() {
        if (null == this.encoding) {
            EncodingUtils encodingUtils = connection.getEncodingUtils();
            this.encoding = encodingUtils.getEncodingFromLocale(this.locale);
            if (null == this.encoding) {
                this.encoding = encodingUtils.getDefaultEncoding();
            }
        }
        return this.encoding;
    }
243259
private static Class getSpiClass(String type) {
        Class clazz = spiMap.get(type);
        if (clazz != null) {
            return clazz;
        }
        try {
            clazz = Class.forName("java.security." + type + "Spi");
            spiMap.put(type, clazz);
            return clazz;
        } catch (ClassNotFoundException e) {
            throw new AssertionError("Spi class not found", e);
        }
    }
818408
@SuppressWarnings("unused")
    public CharSequence getTextForAccessibility() {
        if (getObjects().size() == 0) {
            return getText();
        }

        SpannableStringBuilder description = new SpannableStringBuilder();
        Editable text = getText();
        int selectionStart = -1;
        int selectionEnd = -1;
        int i;
        //Need to take the existing tet buffer and
        // - replace all tokens with a decent string representation of the object
        // - set the selection span to the corresponding location in the new CharSequence
        for (i = 0; i < text.length(); ++i) {
            //See if this is where we should start the selection
            int origSelectionStart = Selection.getSelectionStart(text);
            if (i == origSelectionStart) {
                selectionStart = description.length();
            }
            int origSelectionEnd = Selection.getSelectionEnd(text);
            if (i == origSelectionEnd) {
                selectionEnd = description.length();
            }

            //Replace token spans
            TokenImageSpan[] tokens = text.getSpans(i, i, TokenImageSpan.class);
            if (tokens.length > 0) {
                TokenImageSpan token = tokens[0];
                description = description.append(tokenizer.wrapTokenValue(token.getToken().toString()));
                i = text.getSpanEnd(token);
                continue;
            }

            description = description.append(text.subSequence(i, i + 1));
        }

        int origSelectionStart = Selection.getSelectionStart(text);
        if (i == origSelectionStart) {
            selectionStart = description.length();
        }
        int origSelectionEnd = Selection.getSelectionEnd(text);
        if (i == origSelectionEnd) {
            selectionEnd = description.length();
        }

        if (selectionStart >= 0 && selectionEnd >= 0) {
            Selection.setSelection(description, selectionStart, selectionEnd);
        }

        return description;
    }
617119
public Charset getCharsetProperty(final String name, final Charset defaultValue) {
        final String prop = getStringProperty(name);
        try {
            return prop == null ? defaultValue : Charset.forName(prop);
        } catch (UnsupportedCharsetException e) {
            LowLevelLogUtil.logException("Unable to get Charset '" + name + "', using default " + defaultValue, e);
            return defaultValue;
        }
    }
172425
public static Function<Object,Character> c(final String methodName, final Object... optionalParameters) {
        return methodForCharacter(methodName, optionalParameters);
    }
1230671
public Character getCharacter(Class<?> aClass,String key,char defaultValue)
   {
	   String results = getText(aClass,key, "");
	   
	   if(results.length() == 0)
		   return Character.valueOf(defaultValue);
	   else return Character.valueOf(results.charAt(0));//return first character
	   
   }
329379
@Override
	public char[] getPropertyPassword(String key, char[] defaultPassword)
	{
		char[] bVal = null;
		String sVal = getSecureProperty(key);
		if ((sVal != null) && (sVal.length() > 0))
		{
			bVal = sVal.toCharArray();
		}
		else
		{
			bVal = defaultPassword;
		}
		return bVal;

	}
279681
@Override
    public Object getProperty(String propertyId)
            throws SAXNotRecognizedException {
        if ((PROPERTY + "declaration-handler").equals(propertyId)) {
            return (declHandler == base) ? null : declHandler;
        }

        if ((PROPERTY + "lexical-handler").equals(propertyId)) {
            return (lexicalHandler == base) ? null : lexicalHandler;
        }

        // unknown properties
        throw new SAXNotRecognizedException(propertyId);
    }
1223284
public Charset getCharsetParameter() {
    String value = getParameter("charset");
    return value == null ? null : Charset.forName(value);
  }
898768
public static String getDescription(char ch)
    {
        CharInfo info = (CharInfo) fCodeMap.get(Integer.valueOf(ch));
        return (info != null) ? info.fDescription : null;
    }
478113
public Object get(Object propertyName) {
        if (propertyName instanceof CharSequence) {
            propertyName = propertyName.toString();
        }

        if (propertyName instanceof List) {
            Map submap = new HashMap();
            List propertyNames = (List)propertyName;
            for (Object currentName : propertyNames) {
                if (currentName != null) {
                    currentName = currentName.toString();
                    if (containsKey(currentName)) {
                        submap.put(currentName, get(currentName));
                    }
                }
            }
            return submap;
        }

        if (NameUtils.isConfigurational(propertyName.toString())) {
            return null;
        }

        Object val = null;
        MetaProperty mp = metaClass.getMetaProperty(propertyName.toString());
        if (mp != null) {
            val = mp.getProperty(instance);
        }
        return val;
    }
524712
@Override
	public String getProperty(Class<?> aClass, String key)
	{
		return getProperty(new StringBuilder(aClass.getName()).append(".").append(key).toString());
	}
861982
public static Character toCharacter(Object o, Character defaultValue) {
	if (o instanceof Character) return (Character) o;
	if (defaultValue != null) return new Character(toCharValue(o, defaultValue.charValue()));

	char res = toCharValue(o, Character.MIN_VALUE);
	if (res == Character.MIN_VALUE) return defaultValue;
	return new Character(res);
    }
841873
public static void typeCharacter(final Robot robot, final char character)
		throws IllegalAccessException, NoSuchFieldException
	{
		final boolean upperCase = Character.isUpperCase(character);
		final int keyCode = getKeyCode(character);
		if (upperCase)
		{
			robot.keyPress(KeyEvent.VK_SHIFT);
		}
		robot.keyPress(keyCode);
		robot.keyRelease(keyCode);
		if (upperCase)
		{
			robot.keyRelease(KeyEvent.VK_SHIFT);
		}
	}