List of usage examples for java.text NumberFormat format
public final String format(long number)
From source file:com.prowidesoftware.swift.model.field.Field32B.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 www.ja 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 32B"); } 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.Field32G.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 2 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 32G"); } 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.Field32M.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// ww w. j a va 2s . com */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 32M"); } 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.Field32U.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 ava 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 32U"); } 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.Field33E.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 . jav 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 33E"); } 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.Field33F.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/* ww w .java 2 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 33F"); } 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.Field33H.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 . ja 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 33H"); } 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.Field34B.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 .ja v a 2 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 34B"); } 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.Field39D.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 o m*/ */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 39D"); } 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.Field71F.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 a 2s . com*/ */ @Override public String getValueDisplay(int component, Locale locale) { if (component < 1 || component > 2) { throw new IllegalArgumentException("invalid component number " + component + " for field 71F"); } 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; }