All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.autonomy.aci.client.annotations.StringToCharacterConverter Maven / Gradle / Ivy

There is a newer version: 25.2.0
Show newest version
/*
 * Copyright 2015 Open Text.
 *
 * Licensed under the MIT License (the "License"); you may not use this file
 * except in compliance with the License.
 *
 * The only warranties for products and services of Open Text and its affiliates
 * and licensors ("Open Text") are as may be set forth in the express warranty
 * statements accompanying such products and services. Nothing herein should be
 * construed as constituting an additional warranty. Open Text shall not be
 * liable for technical or editorial errors or omissions contained herein. The
 * information contained herein is subject to change without notice.
 */

package com.autonomy.aci.client.annotations;

class StringToCharacterConverter implements Converter {
    @Override
    public Character convert(final String in) {
        if (in.length() != 1) {
            throw new IllegalArgumentException(in + " is not a character literal. Consider using java.lang.String instead.");
        }

        try {
            return in.charAt(0);
        } catch (final IndexOutOfBoundsException e) {
            return '\u0000';
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy