|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.prowidesoftware.swift.model.field.Field
public abstract class Field
Base class implemented by classes that provide a general access to field components.
Field Summary | |
---|---|
protected java.util.List<java.lang.String> |
components
Zero based list of field components in String format. For example: for field content ":FOO//EUR1234 will be components[0]=FOO, components[1]=EUR and components[1]=1234 |
Constructor Summary | |
---|---|
protected |
Field()
Deprecated. usar Field(int) |
protected |
Field(int components)
|
Method Summary | |
---|---|
protected void |
appendInLines(java.lang.StringBuilder sb,
int componentStart,
int componentEnd)
Append each component between componentStart and componentEnd in a new lines, empty components are ignored |
protected void |
appendInLines(java.lang.StringBuilder sb,
java.lang.String... lines)
Append each lines in a new lines, empty lines are ignored |
boolean |
equals(java.lang.Object obj)
Implementation of equals using EqualsBuilder from commons-lang |
java.lang.String |
findComponentStartingWith(java.lang.String prefix)
Returns the first component starting with the given prefix value or null if not found. |
protected static java.lang.String |
format(java.util.Calendar d)
|
protected static java.lang.String |
formatAccount(java.lang.String a)
A formatted amount with a fixed format nnnn-nnnnn-nnn-n |
protected static java.lang.String |
formatNumber(java.lang.Object aValue)
Format the given object as a money number without currency information in format |
static java.math.BigDecimal |
getAsBigDecimal(java.lang.Number number)
Gets a BigDecimal from a generic Number argument |
java.lang.String |
getComponent(int number)
Gets a specific component from the components list. |
protected java.lang.Object |
getComponentAs(int component,
java.lang.Class c)
|
java.util.List<java.lang.String> |
getComponents()
|
java.lang.String |
getConditionalQualifier()
Deprecated. |
java.lang.String |
getDSS()
Deprecated. |
static Field |
getField(Tag t)
Creates a Field instance for the given Tag object, using reflection. |
java.lang.String |
getLabel()
Returns the field business description using the default locale for the resource bundle. |
java.lang.String |
getLabel(java.util.Locale locale)
Returns the field business description name, using resource bundle from pw_swift_labels property files. |
static java.lang.String |
getLabel(java.lang.String fieldName,
java.util.Locale locale)
|
static java.lang.String |
getLabel(java.lang.String fieldName,
java.lang.String mt,
java.lang.String sequence,
java.util.Locale locale)
Returns the field business description name, using resource bundle from pw_swift_labels property files. |
java.lang.String |
getName()
Returns the field's name composed by the field number and the letter option (if any) |
java.lang.String |
getValue()
Serializes the fields' components into the single string value (SWIFT format). |
java.lang.String |
getValueByCodeword(java.lang.String codeword)
Finds the first component starting with the given codeword between slashes, and returns the component subvalue. |
java.lang.String |
getValueDisplay()
Get a localized, suitable for showing to humans string of the field values |
int |
hashCode()
Implementation of hashCode using HashCodeBuilder from commons-lang |
boolean |
isDSSPresent()
Deprecated. |
boolean |
isEmpty()
Returns true if all field's components are blank or null |
abstract boolean |
isGeneric()
|
abstract boolean |
isOptional(int component)
|
java.lang.String |
joinComponents()
Returns a string with all field's components joined. |
java.lang.String |
joinComponents(boolean skipLast)
Returns a string with all field's components joined. |
java.lang.String |
joinComponents(int start)
Returns a string with all field's components joined |
java.lang.String |
joinComponents(int start,
boolean skipLast)
Returns a string with joined components values. |
void |
setComponent(int number,
java.lang.String value)
Inserts a component String value into the list of components, using the component number to position the value into the List. |
void |
setComponents(java.util.List<java.lang.String> components)
|
java.lang.String |
toString()
Implementation of toString using ToStringBuilder from commons-lang |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.prowidesoftware.swift.model.field.PatternContainer |
---|
componentsPattern, parserPattern |
Field Detail |
---|
protected java.util.List<java.lang.String> components
Constructor Detail |
---|
protected Field()
Field(int)
protected Field(int components)
components
- Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected static java.lang.String formatNumber(java.lang.Object aValue)
aValue
-
protected static java.lang.String format(java.util.Calendar d)
d
- Date object to format
protected static java.lang.String formatAccount(java.lang.String a)
a
- string with an account number or null
null
protected void appendInLines(java.lang.StringBuilder sb, java.lang.String... lines)
sb
- must not be null, target bufferlines
- may be null or empty, nothing is done in this caseprotected void appendInLines(java.lang.StringBuilder sb, int componentStart, int componentEnd)
sb
- must not be null, target buffercomponentStart
- starting component number to addcomponentEnd
- ending component number to addpublic java.util.List<java.lang.String> getComponents()
public void setComponents(java.util.List<java.lang.String> components)
components
- list to setpublic void setComponent(int number, java.lang.String value)
number
- component number, first component of a field should be number onevalue
- String value of the parsed component (without component separators ':', '/', '//')public java.lang.String getComponent(int number)
number
- number component number, first component of a field should be number one
null
public java.lang.String getValueDisplay()
protected java.lang.Object getComponentAs(int component, java.lang.Class c)
component
- c
-
public java.lang.String joinComponents(int start, boolean skipLast)
start
- starting index of components to join (zero based)skipLast
- if true the last component will not be included in the join, and where
the "last" component is understood as the last not empty component (this is not necessary
the last component of the field's component list.
public java.lang.String joinComponents(boolean skipLast)
skipLast
-
joinComponents(int, boolean)
public java.lang.String joinComponents(int start)
start
-
joinComponents(int, boolean)
public java.lang.String joinComponents()
joinComponents(int, boolean)
public static java.math.BigDecimal getAsBigDecimal(java.lang.Number number)
number
-
public java.lang.String findComponentStartingWith(java.lang.String prefix)
null
if not found.
prefix
-
public java.lang.String getValueByCodeword(java.lang.String codeword)
codeword
-
null
if not foundfindComponentStartingWith(String)
public java.lang.String getValue()
public boolean isEmpty()
public static Field getField(Tag t)
t
- a tag with proper name and value content
null
if exceptions occur during object creation.public java.lang.String getLabel()
getLabel(Locale)
public java.lang.String getLabel(java.util.Locale locale)
locale
- the locale for which a resource bundle is desired
public static java.lang.String getLabel(java.lang.String fieldName, java.util.Locale locale)
getLabel(String, String, String, Locale)
public static java.lang.String getLabel(java.lang.String fieldName, java.lang.String mt, java.lang.String sequence, java.util.Locale locale)
fieldName
- field name of the field to retrieve its label, if the combination of number and letter option
is provided then a specific label is returned; is the letter option is omitted then a more generic label is returned.mt
- optional indication of message type or null
.sequence
- optional indication of sequence or null
.locale
- the locale for which a resource bundle is desired
public java.lang.String getName()
public abstract boolean isOptional(int component)
public abstract boolean isGeneric()
@Deprecated public java.lang.String getDSS()
@Deprecated public boolean isDSSPresent()
@Deprecated public java.lang.String getConditionalQualifier()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |