The following document contains the results of PMD's CPD 3.7.
File | Line |
---|---|
org/apache/shale/validator/converter/DoubleConverter.java | 42 |
org/apache/shale/validator/converter/ShortConverter.java | 42 |
FloatValidator.getInstance(); // -------------------------------------------------------------- Properties /** * <p>The <code>Locale</code> to apply to this conversion, if any.</p> */ private Locale locale = null; /** * <p>Return the <code>Locale</code> to apply to this conversion, or * <code>null</code> to use the <code>Locale</code> for the current view.</p> */ public Locale getLocale() { return this.locale; } /** * <p>Set the <code>Locale</code> to apply to this conversion, or * <code>null</code> to use the <code>Locale</code> for the current view.</p> * * @param locale The new Locale */ public void setLocale(Locale locale) { this.locale = locale; } /** * <p>The formatting pattern to apply to this conversion, if any.</p> */ private String pattern = null; /** * <p>Return the <code>java.text.NumberFormat</code> pattern to apply * to this conversion, or <code>null</code> for using no pattern.</p> */ public String getPattern() { return this.pattern; } /** * <p>Set the <code>java.text.NumberFormat</code> pattern to apply to * this conversion, or <code>null</code> for using no pattern.</p> * * @param pattern The new formatting pattern */ public void setPattern(String pattern) { this.pattern = null; } // ------------------------------------------------------- Converter Methods /** {@inheritDoc} */ public Object getAsObject(FacesContext context, UIComponent component, String value) { if ((context == null) || (component == null)) { throw new NullPointerException(message(context, "common.null")); } try { if (locale == null) { return INSTANCE.validate(value, pattern, context.getViewRoot().getLocale()); } else { return INSTANCE.validate(value, pattern, locale); } } catch (Exception e) { throw new ConverterException(e); } } /** {@inheritDoc} */ public String getAsString(FacesContext context, UIComponent component, Object value) { if ((context == null) || (component == null)) { throw new NullPointerException(message(context, "common.null")); } try { if (locale == null) { return INSTANCE.format(value, pattern, context.getViewRoot().getLocale()); } else { return INSTANCE.format(value, pattern, locale); } } catch (Exception e) { throw new ConverterException(e); } } // ----------------------------------------------------- StateHolder Methods /** {@inheritDoc} */ public void restoreState(FacesContext context, Object state) { Object[] values = (Object[]) state; super.restoreState(context, values[0]); this.locale = (Locale) values[1]; this.pattern = (String) values[2]; } /** {@inheritDoc} */ public Object saveState(FacesContext context) { Object[] values = new Object[3]; values[0] = super.saveState(context); values[1] = this.locale; values[2] = this.pattern; return values; } } |
File | Line |
---|---|
org/apache/shale/validator/tag/IntegerConverterTag.java | 99 |
org/apache/shale/validator/tag/ShortConverterTag.java | 101 |
DoubleConverter converter = new DoubleConverter(); if (locale != null) { Locale value = null; if (UIComponentTag.isValueReference(locale)) { ValueBinding vb = context.getApplication().createValueBinding(locale); value = (Locale) vb.getValue(context); } else { value = (Locale) HELPER.asObject(context, Locale.class, locale); } converter.setLocale(value); } if (pattern != null) { String value = null; if (UIComponentTag.isValueReference(message)) { ValueBinding vb = context.getApplication().createValueBinding(pattern); value = (String) vb.getValue(context); } else { value = pattern; } converter.setPattern(value); } return converter; } } |
File | Line |
---|---|
org/apache/shale/validator/tag/IntegerValidatorTag.java | 31 |
org/apache/shale/validator/tag/FloatValidatorTag.java | 31 |
public final class DoubleValidatorTag extends ValidatorTag { // -------------------------------------------------------- Static Variables /** * Serial version UID. */ private static final long serialVersionUID = 1L; /** * <p>Helper object for performing conversions.</p> */ private static final ConverterHelper HELPER = new ConverterHelper(); // -------------------------------------------------------------- Properties private String client = null; public void setClient(String client) { this.client = client; } private String maximum = null; public void setMaximum(String maximum) { this.maximum = maximum; } private String message = null; public void setMessage(String message) { this.message = message; } private String minimum = null; public void setMinimum(String minimum) { this.minimum = minimum; } // ------------------------------------------------------------- Tag Methods /** * <p>Release resources allocated for this instance.</p> */ public void release() { client = null; maximum = null; message = null; minimum = null; super.release(); } // ---------------------------------------------------- ValidatorTag Methods /** * <p>Create and return a new <code>Validator</code> instance to be * registered on our corresponding <code>UIComponent</code>.</p> */ protected Validator createValidator() { FacesContext context = FacesContext.getCurrentInstance(); |
File | Line |
---|---|
org/apache/shale/validator/tag/IntegerConverterTag.java | 32 |
org/apache/shale/validator/tag/LongConverterTag.java | 34 |
public final class DoubleConverterTag extends ConverterTag { // -------------------------------------------------------- Static Variables /** * Serial version UID. */ private static final long serialVersionUID = 1L; /** * <p>Helper object for performing conversions.</p> */ private static final ConverterHelper HELPER = new ConverterHelper(); // -------------------------------------------------------------- Properties private String locale = null; public void setLocale(String locale) { this.locale = locale; } private String message = null; public void setMessage(String message) { this.message = message; } private String pattern = null; public void setPattern(String pattern) { this.pattern = pattern; } // ------------------------------------------------------------- Tag Methods /** * <p>Release resources allocated for this instance.</p> */ public void release() { locale = null; message = null; pattern = null; super.release(); } // ---------------------------------------------------- ConverterTag Methods /** * <p>Create and return a new <code>Converter</code> instance to be * registered on our corresponding <code>UIComponent</code>.</p> */ protected Converter createConverter() { FacesContext context = FacesContext.getCurrentInstance(); |