public Byte convert (@Nonnull final Object aSource) { return StringParser.parseByteObj (aSource, (Byte) null); } });
/** * Parse the given {@link Object} as {@link Byte} with radix * {@value #DEFAULT_RADIX}. * * @param aObject * The object to parse. May be <code>null</code>. * @return <code>null</code> if the object does not represent a valid value. */ @Nullable public static Byte parseByteObj (@Nullable final Object aObject) { return parseByteObj (aObject, DEFAULT_RADIX, null); }
/** * Parse the given {@link String} as {@link Byte} with radix * {@value #DEFAULT_RADIX}. * * @param sStr * The String to parse. May be <code>null</code>. * @return <code>null</code> if the string does not represent a valid value. */ @Nullable public static Byte parseByteObj (@Nullable final String sStr) { return parseByteObj (sStr, DEFAULT_RADIX, null); }
/** * Parse the given {@link Object} as {@link Byte} with radix * {@value #DEFAULT_RADIX}. * * @param aObject * The object to parse. May be <code>null</code>. * @param aDefault * The default value to be returned, if the passed object cannot be * converted. May be <code>null</code>. * @return the passed default value if the object does not represent a valid * value. */ @Nullable public static Byte parseByteObj (@Nullable final Object aObject, @Nullable final Byte aDefault) { return parseByteObj (aObject, DEFAULT_RADIX, aDefault); }
/** * Parse the given {@link String} as {@link Byte} with radix * {@value #DEFAULT_RADIX}. * * @param sStr * The String to parse. May be <code>null</code>. * @param aDefault * The default value to be returned if the passed string could not be * converted to a valid value. May be <code>null</code>. * @return <code>aDefault</code> if the string does not represent a valid * value. */ @Nullable public static Byte parseByteObj (@Nullable final String sStr, @Nullable final Byte aDefault) { return parseByteObj (sStr, DEFAULT_RADIX, aDefault); }
/** * Parse the given {@link Object} as {@link Byte} with the specified radix. * * @param aObject * The object to parse. May be <code>null</code>. * @param nRadix * The radix to use. Must be ≥ {@link Character#MIN_RADIX} and ≤ * {@link Character#MAX_RADIX}. * @param aDefault * The default value to be returned, if the passed object cannot be * converted. May be <code>null</code>. * @return the passed default value if the object does not represent a valid * value. */ @Nullable public static Byte parseByteObj (@Nullable final Object aObject, @Nonnegative final int nRadix, @Nullable final Byte aDefault) { if (aObject == null) return aDefault; if (aObject instanceof Number) return Byte.valueOf (((Number) aObject).byteValue ()); return parseByteObj (aObject.toString (), nRadix, aDefault); }