LocaleBeanUtils.java

  1. /*
  2.  * Licensed to the Apache Software Foundation (ASF) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * The ASF licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.apache.commons.beanutils2.locale;

  18. import java.lang.reflect.InvocationTargetException;
  19. import java.util.Locale;

  20. /**
  21.  * <p>
  22.  * Utility methods for populating JavaBeans properties via reflection in a locale-dependent manner.
  23.  * </p>
  24.  *
  25.  * <p>
  26.  * The implementations for these methods are provided by {@code LocaleBeanUtilsBean}. For more details see {@link LocaleBeanUtilsBean}.
  27.  * </p>
  28.  */
  29. public final class LocaleBeanUtils {

  30.     /**
  31.      * <p>
  32.      * Converts the specified value to the required type.
  33.      * </p>
  34.      *
  35.      * <p>
  36.      * For more details see {@code LocaleBeanUtilsBean}
  37.      * </p>
  38.      *
  39.      * @param type  The Java type of target property
  40.      * @param index The indexed subscript value (if any)
  41.      * @param value The value to be converted
  42.      * @return The converted value
  43.      * @see LocaleBeanUtilsBean#convert(Class, int, Object)
  44.      */
  45.     protected static Object convert(final Class<?> type, final int index, final Object value) {
  46.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().convert(type, index, value);
  47.     }

  48.     /**
  49.      * <p>
  50.      * Converts the specified value to the required type using the specified conversion pattern.
  51.      * </p>
  52.      *
  53.      * <p>
  54.      * For more details see {@code LocaleBeanUtilsBean}
  55.      * </p>
  56.      *
  57.      * @param type    The Java type of target property
  58.      * @param index   The indexed subscript value (if any)
  59.      * @param value   The value to be converted
  60.      * @param pattern The conversion pattern
  61.      * @return The converted value
  62.      * @see LocaleBeanUtilsBean#convert(Class, int, Object, String)
  63.      */
  64.     protected static Object convert(final Class<?> type, final int index, final Object value, final String pattern) {
  65.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().convert(type, index, value, pattern);
  66.     }

  67.     /**
  68.      * <p>
  69.      * Calculate the property type.
  70.      * </p>
  71.      *
  72.      * <p>
  73.      * For more details see {@code LocaleBeanUtilsBean}
  74.      * </p>
  75.      *
  76.      * @param target   The bean
  77.      * @param name     The property name
  78.      * @param propName The Simple name of target property
  79.      * @return The property's type
  80.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  81.      * @throws InvocationTargetException if the property accessor method throws an exception
  82.      * @see LocaleBeanUtilsBean#definePropertyType(Object, String, String)
  83.      */
  84.     protected static Class<?> definePropertyType(final Object target, final String name, final String propName)
  85.             throws IllegalAccessException, InvocationTargetException {
  86.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().definePropertyType(target, name, propName);
  87.     }

  88.     /**
  89.      * <p>
  90.      * Gets whether the pattern is localized or not.
  91.      * </p>
  92.      *
  93.      * <p>
  94.      * For more details see {@code LocaleBeanUtilsBean}
  95.      * </p>
  96.      *
  97.      * @return {@code true} if pattern is localized, otherwise {@code false}
  98.      * @see LocaleBeanUtilsBean#getApplyLocalized()
  99.      */
  100.     public static boolean getApplyLocalized() {
  101.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getApplyLocalized();
  102.     }

  103.     /**
  104.      * <p>
  105.      * Gets the locale used when no locale is passed.
  106.      * </p>
  107.      *
  108.      * <p>
  109.      * For more details see {@code LocaleBeanUtilsBean}
  110.      * </p>
  111.      *
  112.      * @return the default locale
  113.      * @see LocaleBeanUtilsBean#getDefaultLocale()
  114.      */
  115.     public static Locale getDefaultLocale() {
  116.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getDefaultLocale();
  117.     }

  118.     /**
  119.      * Gets the value of the specified locale-sensitive indexed property of the specified bean, as a String using the default conversion pattern of the
  120.      * corresponding {@link LocaleConverter}.
  121.      *
  122.      * <p>
  123.      * For more details see {@code LocaleBeanUtilsBean}
  124.      * </p>
  125.      *
  126.      * @param bean Bean whose property is to be extracted
  127.      * @param name {@code propertyname[index]} of the property value to be extracted
  128.      * @return The indexed property's value, converted to a String
  129.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  130.      * @throws InvocationTargetException if the property accessor method throws an exception
  131.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  132.      * @see LocaleBeanUtilsBean#getIndexedProperty(Object, String)
  133.      */
  134.     public static String getIndexedProperty(final Object bean, final String name)
  135.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  136.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getIndexedProperty(bean, name);
  137.     }

  138.     /**
  139.      * <p>
  140.      * Return the value of the specified locale-sensitive indexed property of the specified bean, as a String using the default conversion pattern of the
  141.      * corresponding {@link LocaleConverter}.
  142.      * </p>
  143.      *
  144.      * <p>
  145.      * For more details see {@code LocaleBeanUtilsBean}
  146.      * </p>
  147.      *
  148.      * @param bean  Bean whose property is to be extracted
  149.      * @param name  Simple property name of the property value to be extracted
  150.      * @param index Index of the property value to be extracted
  151.      * @return The indexed property's value, converted to a String
  152.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  153.      * @throws InvocationTargetException if the property accessor method throws an exception
  154.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  155.      * @see LocaleBeanUtilsBean#getIndexedProperty(Object, String, int)
  156.      */
  157.     public static String getIndexedProperty(final Object bean, final String name, final int index)
  158.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  159.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getIndexedProperty(bean, name, index);
  160.     }

  161.     /**
  162.      * <p>
  163.      * Return the value of the specified locale-sensitive indexed property of the specified bean, as a String using the specified conversion pattern.
  164.      * </p>
  165.      *
  166.      * <p>
  167.      * For more details see {@code LocaleBeanUtilsBean}
  168.      * </p>
  169.      *
  170.      * @param bean    Bean whose property is to be extracted
  171.      * @param name    Simple property name of the property value to be extracted
  172.      * @param index   Index of the property value to be extracted
  173.      * @param pattern The conversion pattern
  174.      * @return The indexed property's value, converted to a String
  175.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  176.      * @throws InvocationTargetException if the property accessor method throws an exception
  177.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  178.      * @see LocaleBeanUtilsBean#getIndexedProperty(Object, String, int, String)
  179.      */
  180.     public static String getIndexedProperty(final Object bean, final String name, final int index, final String pattern)
  181.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  182.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getIndexedProperty(bean, name, index, pattern);
  183.     }

  184.     /**
  185.      * <p>
  186.      * Return the value of the specified locale-sensitive indexed property of the specified bean, as a String.
  187.      * </p>
  188.      *
  189.      * <p>
  190.      * For more details see {@code LocaleBeanUtilsBean}
  191.      * </p>
  192.      *
  193.      * @param bean    Bean whose property is to be extracted
  194.      * @param name    {@code propertyname[index]} of the property value to be extracted
  195.      * @param pattern The conversion pattern
  196.      * @return The indexed property's value, converted to a String
  197.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  198.      * @throws InvocationTargetException if the property accessor method throws an exception
  199.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  200.      * @see LocaleBeanUtilsBean#getIndexedProperty(Object, String, String)
  201.      */
  202.     public static String getIndexedProperty(final Object bean, final String name, final String pattern)
  203.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  204.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getIndexedProperty(bean, name, pattern);
  205.     }

  206.     /**
  207.      * <p>
  208.      * Return the value of the specified locale-sensitive mapped property of the specified bean, as a String using the default conversion pattern of the
  209.      * corresponding {@link LocaleConverter}.
  210.      * </p>
  211.      *
  212.      * <p>
  213.      * For more details see {@code LocaleBeanUtilsBean}
  214.      * </p>
  215.      *
  216.      * @param bean Bean whose property is to be extracted
  217.      * @param name {@code propertyname(index)} of the property value to be extracted
  218.      * @return The mapped property's value, converted to a String
  219.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  220.      * @throws InvocationTargetException if the property accessor method throws an exception
  221.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  222.      * @see LocaleBeanUtilsBean#getMappedProperty(Object, String)
  223.      */
  224.     public static String getMappedProperty(final Object bean, final String name)
  225.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  226.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getMappedProperty(bean, name);
  227.     }

  228.     /**
  229.      * <p>
  230.      * Return the value of the specified mapped locale-sensitive property of the specified bean, as a String The key is specified as a method parameter and must
  231.      * *not* be included in the property name expression.
  232.      * </p>
  233.      *
  234.      * <p>
  235.      * For more details see {@code LocaleBeanUtilsBean}
  236.      * </p>
  237.      *
  238.      * @param bean Bean whose property is to be extracted
  239.      * @param name Simple property name of the property value to be extracted
  240.      * @param key  Lookup key of the property value to be extracted
  241.      * @return The mapped property's value, converted to a String
  242.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  243.      * @throws InvocationTargetException if the property accessor method throws an exception
  244.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  245.      * @see LocaleBeanUtilsBean#getMappedProperty(Object, String, String)
  246.      */
  247.     public static String getMappedProperty(final Object bean, final String name, final String key)
  248.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  249.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getMappedProperty(bean, name, key);
  250.     }

  251.     /**
  252.      * <p>
  253.      * Return the value of the specified mapped locale-sensitive property of the specified bean, as a String using the specified conversion pattern.
  254.      * </p>
  255.      *
  256.      * <p>
  257.      * For more details see {@code LocaleBeanUtilsBean}
  258.      * </p>
  259.      *
  260.      * @param bean    Bean whose property is to be extracted
  261.      * @param name    Simple property name of the property value to be extracted
  262.      * @param key     Lookup key of the property value to be extracted
  263.      * @param pattern The conversion pattern
  264.      * @return The mapped property's value, converted to a String
  265.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  266.      * @throws InvocationTargetException if the property accessor method throws an exception
  267.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  268.      * @see LocaleBeanUtilsBean#getMappedProperty(Object, String, String, String)
  269.      */
  270.     public static String getMappedProperty(final Object bean, final String name, final String key, final String pattern)
  271.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  272.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getMappedProperty(bean, name, key, pattern);
  273.     }

  274.     /**
  275.      * <p>
  276.      * Return the value of the specified locale-sensitive mapped property of the specified bean, as a String using the specified pattern.
  277.      * </p>
  278.      *
  279.      * <p>
  280.      * For more details see {@code LocaleBeanUtilsBean}
  281.      * </p>
  282.      *
  283.      * @param bean    Bean whose property is to be extracted
  284.      * @param name    {@code propertyname(index)} of the property value to be extracted
  285.      * @param pattern The conversion pattern
  286.      * @return The mapped property's value, converted to a String
  287.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  288.      * @throws InvocationTargetException if the property accessor method throws an exception
  289.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  290.      * @see LocaleBeanUtilsBean#getMappedPropertyLocale(Object, String, String)
  291.      */
  292.     public static String getMappedPropertyLocale(final Object bean, final String name, final String pattern)
  293.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  294.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getMappedPropertyLocale(bean, name, pattern);
  295.     }

  296.     /**
  297.      * <p>
  298.      * Return the value of the (possibly nested) locale-sensitive property of the specified name.
  299.      * </p>
  300.      *
  301.      * <p>
  302.      * For more details see {@code LocaleBeanUtilsBean}
  303.      * </p>
  304.      *
  305.      * @param bean Bean whose property is to be extracted
  306.      * @param name Possibly nested name of the property to be extracted
  307.      * @return The nested property's value, converted to a String
  308.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  309.      * @throws InvocationTargetException if the property accessor method throws an exception
  310.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  311.      * @see LocaleBeanUtilsBean#getNestedProperty(Object, String)
  312.      */
  313.     public static String getNestedProperty(final Object bean, final String name)
  314.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  315.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getNestedProperty(bean, name);
  316.     }

  317.     /**
  318.      * <p>
  319.      * Return the value of the (possibly nested) locale-sensitive property of the specified name, for the specified bean, as a String using the specified
  320.      * pattern.
  321.      * </p>
  322.      *
  323.      * <p>
  324.      * For more details see {@code LocaleBeanUtilsBean}
  325.      * </p>
  326.      *
  327.      * @param bean    Bean whose property is to be extracted
  328.      * @param name    Possibly nested name of the property to be extracted
  329.      * @param pattern The conversion pattern
  330.      * @return The nested property's value, converted to a String
  331.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  332.      * @throws InvocationTargetException if the property accessor method throws an exception
  333.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  334.      * @see LocaleBeanUtilsBean#getNestedProperty(Object, String, String)
  335.      */
  336.     public static String getNestedProperty(final Object bean, final String name, final String pattern)
  337.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  338.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getNestedProperty(bean, name, pattern);
  339.     }

  340.     /**
  341.      * <p>
  342.      * Return the value of the specified locale-sensitive property of the specified bean.
  343.      * </p>
  344.      *
  345.      * <p>
  346.      * For more details see {@code LocaleBeanUtilsBean}
  347.      * </p>
  348.      *
  349.      * @param bean Bean whose property is to be extracted
  350.      * @param name Possibly indexed and/or nested name of the property to be extracted
  351.      * @return The property's value, converted to a String
  352.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  353.      * @throws InvocationTargetException if the property accessor method throws an exception
  354.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  355.      * @see LocaleBeanUtilsBean#getProperty(Object, String)
  356.      */
  357.     public static String getProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  358.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getProperty(bean, name);
  359.     }

  360.     /**
  361.      * <p>
  362.      * Return the value of the specified locale-sensitive property of the specified bean.
  363.      * </p>
  364.      *
  365.      * <p>
  366.      * For more details see {@code LocaleBeanUtilsBean}
  367.      * </p>
  368.      *
  369.      * @param bean    Bean whose property is to be extracted
  370.      * @param name    Possibly indexed and/or nested name of the property to be extracted
  371.      * @param pattern The conversion pattern
  372.      * @return The nested property's value, converted to a String
  373.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  374.      * @throws InvocationTargetException if the property accessor method throws an exception
  375.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  376.      * @see LocaleBeanUtilsBean#getProperty(Object, String, String)
  377.      */
  378.     public static String getProperty(final Object bean, final String name, final String pattern)
  379.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  380.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getProperty(bean, name, pattern);
  381.     }

  382.     /**
  383.      * <p>
  384.      * Return the value of the specified simple locale-sensitive property of the specified bean, converted to a String using the default conversion pattern of
  385.      * the corresponding {@link LocaleConverter}.
  386.      * </p>
  387.      *
  388.      * <p>
  389.      * For more details see {@code LocaleBeanUtilsBean}
  390.      * </p>
  391.      *
  392.      * @param bean Bean whose property is to be extracted
  393.      * @param name Name of the property to be extracted
  394.      * @return The property's value, converted to a String
  395.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  396.      * @throws InvocationTargetException if the property accessor method throws an exception
  397.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  398.      * @see LocaleBeanUtilsBean#getSimpleProperty(Object, String)
  399.      */
  400.     public static String getSimpleProperty(final Object bean, final String name)
  401.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  402.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getSimpleProperty(bean, name);
  403.     }

  404.     /**
  405.      * <p>
  406.      * Return the value of the specified simple locale-sensitive property of the specified bean, converted to a String using the specified conversion pattern.
  407.      * </p>
  408.      *
  409.      * <p>
  410.      * For more details see {@code LocaleBeanUtilsBean}
  411.      * </p>
  412.      *
  413.      * @param bean    Bean whose property is to be extracted
  414.      * @param name    Name of the property to be extracted
  415.      * @param pattern The conversion pattern
  416.      * @return The property's value, converted to a String
  417.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  418.      * @throws InvocationTargetException if the property accessor method throws an exception
  419.      * @throws NoSuchMethodException     if an accessor method for this property cannot be found
  420.      * @see LocaleBeanUtilsBean#getSimpleProperty(Object, String, String)
  421.      */
  422.     public static String getSimpleProperty(final Object bean, final String name, final String pattern)
  423.             throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
  424.         return LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().getSimpleProperty(bean, name, pattern);
  425.     }

  426.     /**
  427.      * <p>
  428.      * Invoke the setter method.
  429.      * </p>
  430.      *
  431.      * <p>
  432.      * For more details see {@code LocaleBeanUtilsBean}
  433.      * </p>
  434.      *
  435.      * @param target   The bean
  436.      * @param propName The Simple name of target property
  437.      * @param key      The Mapped key value (if any)
  438.      * @param index    The indexed subscript value (if any)
  439.      * @param newValue The value to be set
  440.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  441.      * @throws InvocationTargetException if the property accessor method throws an exception
  442.      * @see LocaleBeanUtilsBean#invokeSetter(Object, String, String, int, Object)
  443.      */
  444.     protected static void invokeSetter(final Object target, final String propName, final String key, final int index, final Object newValue)
  445.             throws IllegalAccessException, InvocationTargetException {
  446.         LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().invokeSetter(target, propName, key, index, newValue);
  447.     }

  448.     /**
  449.      * <p>
  450.      * Sets whether the pattern is localized or not.
  451.      * </p>
  452.      *
  453.      * <p>
  454.      * For more details see {@code LocaleBeanUtilsBean}
  455.      * </p>
  456.      *
  457.      * @param newApplyLocalized {@code true} if pattern is localized, otherwise {@code false}
  458.      * @see LocaleBeanUtilsBean#setApplyLocalized(boolean)
  459.      */
  460.     public static void setApplyLocalized(final boolean newApplyLocalized) {
  461.         LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().setApplyLocalized(newApplyLocalized);
  462.     }

  463.     /**
  464.      * <p>
  465.      * Sets the locale used when no locale is passed.
  466.      * </p>
  467.      *
  468.      * <p>
  469.      * For more details see {@code LocaleBeanUtilsBean}
  470.      * </p>
  471.      *
  472.      * @param locale the default locale
  473.      * @see LocaleBeanUtilsBean#setDefaultLocale(Locale)
  474.      */
  475.     public static void setDefaultLocale(final Locale locale) {
  476.         LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().setDefaultLocale(locale);
  477.     }

  478.     /**
  479.      * <p>
  480.      * Set the specified locale-sensitive property value, performing type conversions as required to conform to the type of the destination property using the
  481.      * default conversion pattern of the corresponding {@link LocaleConverter}.
  482.      * </p>
  483.      *
  484.      * <p>
  485.      * For more details see {@code LocaleBeanUtilsBean}
  486.      * </p>
  487.      *
  488.      * @param bean  Bean on which setting is to be performed
  489.      * @param name  Property name (can be nested/indexed/mapped/combo)
  490.      * @param value Value to be set
  491.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  492.      * @throws InvocationTargetException if the property accessor method throws an exception
  493.      * @see LocaleBeanUtilsBean#setProperty(Object, String, Object)
  494.      */
  495.     public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException {
  496.         LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().setProperty(bean, name, value);
  497.     }

  498.     /**
  499.      * <p>
  500.      * Set the specified locale-sensitive property value, performing type conversions as required to conform to the type of the destination property using the
  501.      * specified conversion pattern.
  502.      * </p>
  503.      *
  504.      * <p>
  505.      * For more details see {@code LocaleBeanUtilsBean}
  506.      * </p>
  507.      *
  508.      * @param bean    Bean on which setting is to be performed
  509.      * @param name    Property name (can be nested/indexed/mapped/combo)
  510.      * @param value   Value to be set
  511.      * @param pattern The conversion pattern
  512.      * @throws IllegalAccessException    if the caller does not have access to the property accessor method
  513.      * @throws InvocationTargetException if the property accessor method throws an exception
  514.      * @see LocaleBeanUtilsBean#setProperty(Object, String, Object, String)
  515.      */
  516.     public static void setProperty(final Object bean, final String name, final Object value, final String pattern)
  517.             throws IllegalAccessException, InvocationTargetException {
  518.         LocaleBeanUtilsBean.getLocaleBeanUtilsInstance().setProperty(bean, name, value, pattern);
  519.     }

  520.     private LocaleBeanUtils() {
  521.         // empty
  522.     }
  523. }