/** * Returns the delimiter to be used by colliding command line args when * creating non colliding arg's aliases (keys for key/value-pairs). * * @return The according delimiter. */ protected char getDelimiter() { return Delimiter.INDEX.getChar(); }
/** * Create an empty {@link PathMapBuilder} instance using the default path * delimiter "/" ({@link Delimiter#PATH}) for the path declarations. * * @param aType The type of the values being referenced by the paths. */ public PathMapBuilderImpl( Class<T> aType ) { this( Delimiter.PATH.getChar(), aType ); }
/** * Create a {@link PathMapBuilder} instance containing the elements as of * {@link MutablePathMap#insert(Object)} using the default path delimiter * "/" ({@link Delimiter#PATH}) for the path declarations. * * @param aObj The object from which the elements are to be added. * * @param aType The type of the values being referenced by the paths. */ public PathMapBuilderImpl( Object aObj, Class<T> aType ) { this( aObj, Delimiter.PATH.getChar(), aType ); }
/** * Returns the default path delimiter as of {@link Delimiter#PATH}. * * {@inheritDoc} */ @Override default char getDelimiter() { return Delimiter.PATH.getChar(); }
/** * Same as {@link #asIntegerArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default int[] asIntegerArray( String aKey ) throws NumberFormatException { return asIntegerArray( aKey, Delimiter.LIST.getChar() ); }
/** * Same as {@link #asLongArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default long[] asLongArray( Enum<?> aKey ) throws NumberFormatException { return asLongArray( aKey.toString(), Delimiter.LIST.getChar() ); }
/** * {@inheritDoc} */ @Override public String toEnvironmentVariable( String aKey ) { if ( aKey == null || aKey.length() == 0 ) return aKey; String theKey = toNormalized( aKey, Delimiter.SNAKE_CASE.getChar() ); return theKey != null ? theKey.toUpperCase() : theKey; }
/** * Retrieves the fully qualified method name of the caller of this method. * This adds the method name to the caller's fully qualified path name * separated by a hash "#". * * @return The fully qualified method name. */ public static String toFullyQualifiedMethodName() { StackTraceElement theStackTraceElement = getCallerStackTraceElement(); return theStackTraceElement.getClassName() + Delimiter.METHOD_NAME.getChar() + theStackTraceElement.getMethodName(); }
/** * Same as {@link #asBooleanArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default boolean[] asBooleanArray( Enum<?> aKey ) throws NumberFormatException { return asBooleanArray( aKey.toString(), Delimiter.LIST.getChar() ); }
/** * Same as {@link #asBooleanArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default boolean[] asBooleanArray( String aKey ) throws NumberFormatException { return asBooleanArray( aKey, Delimiter.LIST.getChar() ); }
/** * Same as {@link #asByteArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default byte[] asByteArray( Enum<?> aKey ) throws NumberFormatException { return asByteArray( aKey.toString(), Delimiter.LIST.getChar() ); }
/** * Same as {@link #asDoubleArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default double[] asDoubleArray( String aKey ) throws NumberFormatException { return asDoubleArray( aKey, Delimiter.LIST.getChar() ); }
/** * Same as {@link #asShortArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default short[] asShortArray( String aKey ) throws NumberFormatException { return asShortArray( aKey, Delimiter.LIST.getChar() ); }
/** * Same as {@link #asArray(String, char)} using a comma (',') as delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default String[] asArray( String aKey ) { return asArray( aKey, Delimiter.LIST.getChar() ); }
/** * Same as {@link #asFloatArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default float[] asFloatArray( Enum<?> aKey ) throws NumberFormatException { return asFloatArray( aKey.toString(), Delimiter.LIST.getChar() ); }
/** * Same as {@link #asLongArray(String, char)} using a comma (',') as * delimiter. * * @param aKey The key, which's value is to be converted to an array. * * @return The according array or null if no (or a null) value has been * associated to the key. */ default long[] asLongArray( String aKey ) throws NumberFormatException { return asLongArray( aKey, Delimiter.LIST.getChar() ); }
/** * Returns the key/value-pair as a property {@link String} "key=value". * * @return This {@link Property} as a {@link String} */ default String toProperty() { return getKey() + Delimiter.PROPERTY.getChar() + getValue(); }
/** * Produces an HTTP Query-String form the herein contain HTTP query fields. * * @return The HTTP Query-String representation of this {@link FormFields} * instance or null if this instance is empty. */ default String toUrlQueryString() { if ( isEmpty() ) return null; return Delimiter.URL_QUERY.getChar() + toBodyFormFields(); }
/** * Creates a {@link Map} from the provided command line arguments using the * {@link CommandArgPrefix#toPrefixes()} prefixes to identify the keys (and * the values) from the provided arguments. * * @param aArgs The command line arguments to convert to properties. * * @return The {@link Map} containing the determined properties. */ public static Map<String, String> toProperties( String[] aArgs ) { return toProperties( aArgs, CommandArgPrefix.toPrefixes(), Delimiter.INDEX.getChar() ); }