com.ancientprogramming.fixedformat4j.annotation
Enum Align

java.lang.Object
  extended by java.lang.Enum<Align>
      extended by com.ancientprogramming.fixedformat4j.annotation.Align
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Align>

public enum Align
extends java.lang.Enum<Align>

Capable of pad or chop data in a given direction

Since:
1.0.0
Author:
Jacob von Eyben- http://www.ancientprogramming.com

Enum Constant Summary
LEFT
          Pad or chop data to the right, so the text is aligned to the left
RIGHT
          Pad or chop data to the left, so the text is aligned to the right
 
Method Summary
abstract  java.lang.String apply(java.lang.String data, int length, char paddingChar)
          Pads the data in the length specified with the given padding char.
abstract  java.lang.String remove(java.lang.String data, char paddingChar)
          Remove the padding chars from the data.
static Align valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Align[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

RIGHT

public static final Align RIGHT
Pad or chop data to the left, so the text is aligned to the right


LEFT

public static final Align LEFT
Pad or chop data to the right, so the text is aligned to the left

Method Detail

values

public static final Align[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Align c : Align.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Align valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

apply

public abstract java.lang.String apply(java.lang.String data,
                                       int length,
                                       char paddingChar)
Pads the data in the length specified with the given padding char. No padding will be applied if the length of the data is longer than the given length.

Parameters:
data - the data to pad.
length - the minimum length after the padding is applied.
paddingChar - the char the data is padded with.
Returns:
the data after padding is applied.

remove

public abstract java.lang.String remove(java.lang.String data,
                                        char paddingChar)
Remove the padding chars from the data.

Parameters:
data - the data including padding chars
paddingChar - the padding char to remove
Returns:
the data after padding is removed.


Copyright © 2008 ancientprogramming.com. All Rights Reserved.