List of usage examples for java.text NumberFormat format
public final String format(long number)
From source file:com.prowidesoftware.swift.model.field.Field71G.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8/*w w w . j av a2 s . co m*/ */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 71G"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field71H.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8//w w w . j a v a2 s . c o m */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 71H"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field71J.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8//w ww. j av a 2 s . c om */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 71J"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field71K.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8/*from w ww . j a v a 2 s .c om*/ */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 71K"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field71L.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8//from ww w .ja v a 2 s . co m */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 71L"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field33V.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8//from ww w. j a v a 2s . c o m */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 33V"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field343.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8//from w w w . j a va 2 s . co m */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 4) { throw new IllegalArgumentException("invalid component number " + component + " for field 343"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent1AsNumber(); if (n != null) { return f.format(n); } } if (component == 2) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent2AsNumber(); if (n != null) { return f.format(n); } } if (component == 3) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent3AsNumber(); if (n != null) { return f.format(n); } } if (component == 4) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent4AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field99A.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8/* w ww.j av a 2 s . c o m*/ */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 3) { throw new IllegalArgumentException("invalid component number " + component + " for field 99A"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //default format (as is) return getComponent(2); } if (component == 3) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent3AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field90L.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8// w w w . ja va 2 s . c o m */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 3) { throw new IllegalArgumentException("invalid component number " + component + " for field 90L"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //default format (as is) return getComponent(2); } if (component == 3) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent3AsNumber(); if (n != null) { return f.format(n); } } return null; }
From source file:com.prowidesoftware.swift.model.field.Field13K.java
/** * Returns a localized suitable for showing to humans string of a field component.<br> * * @param component number of the component to display * @param locale optional locale to format date and amounts, if null, the default locale is used * @return formatted component value or null if component number is invalid or not present * @throws IllegalArgumentException if component number is invalid for the field * @since 7.8/*from w w w .j ava2 s. co m*/ */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 3) { throw new IllegalArgumentException("invalid component number " + component + " for field 13K"); } if (locale == null) { locale = Locale.getDefault(); } if (component == 1) { //default format (as is) return getComponent(1); } if (component == 2) { //default format (as is) return getComponent(2); } if (component == 3) { //number or amount java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(locale); Number n = getComponent3AsNumber(); if (n != null) { return f.format(n); } } return null; }