/** Base constructor */ public PropertyUtilsBean() { descriptorsCache = new WeakFastHashMap<Class<?>, BeanIntrospectionData>(); descriptorsCache.setFast(true); mappedDescriptorsCache = new WeakFastHashMap<Class<?>, FastHashMap>(); mappedDescriptorsCache.setFast(true); introspectors = new CopyOnWriteArrayList<BeanIntrospector>(); resetBeanIntrospectors(); }
/** * <p>Return the mapped property descriptors for this bean class.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param beanClass Bean class to be introspected * @return the mapped property descriptors * @deprecated This method should not be exposed */ @Deprecated public FastHashMap getMappedPropertyDescriptors(final Class<?> beanClass) { if (beanClass == null) { return null; } // Look up any cached descriptors for this bean class return mappedDescriptorsCache.get(beanClass); }
/** * <p>Return the mapped property descriptors for this bean.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param bean Bean to be introspected * @return the mapped property descriptors * @deprecated This method should not be exposed */ @Deprecated public FastHashMap getMappedPropertyDescriptors(final Object bean) { if (bean == null) { return null; } return (getMappedPropertyDescriptors(bean.getClass())); }
/** Base constructor */ public QPropertyUtilsBean() { descriptorsCache = new WeakFastHashMap<Class<?>, BeanIntrospectionData>(); descriptorsCache.setFast(true); mappedDescriptorsCache = new WeakFastHashMap<Class<?>, FastHashMap>(); mappedDescriptorsCache.setFast(true); introspectors = new CopyOnWriteArrayList<BeanIntrospector>(); resetBeanIntrospectors(); }
protected AbstractManageableCaptchaService(CaptchaStore captchaStore, com.octo.captcha.engine.CaptchaEngine captchaEngine, int minGuarantedStorageDelayInSeconds, int maxCaptchaStoreSize) { super(captchaStore, captchaEngine); this.setCaptchaStoreMaxSize(maxCaptchaStoreSize); this.setMinGuarantedStorageDelayInSeconds(minGuarantedStorageDelayInSeconds); this.setCaptchaStoreSizeBeforeGarbageCollection((int) Math.round(0.8 * maxCaptchaStoreSize)); times = new FastHashMap(); }
/** * Empty the Store */ public void emptyCaptchaStore() { //empty the store this.store.empty(); //And the timestamps this.times = new FastHashMap(); }
/** * Merges the given form into this one. For any field in <code>depends</code> * not present in this form, include it. <code>depends</code> has precedence * in the way the fields are ordered. * * @param depends the form we want to merge * @since Validator 1.2.0 */ protected void merge(Form depends) { List<Field> templFields = new ArrayList<Field>(); @SuppressWarnings("unchecked") // FastHashMap is not generic Map<String, Field> temphFields = new FastHashMap(); Iterator<Field> dependsIt = depends.getFields().iterator(); while (dependsIt.hasNext()) { Field defaultField = dependsIt.next(); if (defaultField != null) { String fieldKey = defaultField.getKey(); if (!this.containsField(fieldKey)) { templFields.add(defaultField); temphFields.put(fieldKey, defaultField); } else { Field old = getField(fieldKey); getFieldMap().remove(fieldKey); lFields.remove(old); templFields.add(old); temphFields.put(fieldKey, old); } } } lFields.addAll(0, templFields); getFieldMap().putAll(temphFields); }
/** * Makes a deep copy of a <code>FastHashMap</code> if the values * are <code>Msg</code>, <code>Arg</code>, * or <code>Var</code>. Otherwise it is a shallow copy. * * @param map <code>FastHashMap</code> to copy. * @return FastHashMap A copy of the <code>FastHashMap</code> that was * passed in. * @deprecated This method is not part of Validator's public API. Validator * will use it internally until FastHashMap references are removed. Use * copyMap() instead. */ @GwtIncompatible("incompatible method") @Deprecated public static FastHashMap copyFastHashMap(FastHashMap map) { FastHashMap results = new FastHashMap(); @SuppressWarnings("unchecked") // FastHashMap is not generic Iterator<Entry<String, ?>> i = map.entrySet().iterator(); while (i.hasNext()) { Entry<String, ?> entry = i.next(); String key = entry.getKey(); Object value = entry.getValue(); if (value instanceof Msg) { results.put(key, ((Msg) value).clone()); } else if (value instanceof Arg) { results.put(key, ((Arg) value).clone()); } else if (value instanceof Var) { results.put(key, ((Var) value).clone()); } else { results.put(key, value); } } results.setFast(true); return results; }
/** * Create all {@link LocaleConverter} types for specified locale. * * @param locale The Locale * @return The FastHashMap instance contains the all {@link LocaleConverter} types * for the specified locale. * @deprecated This method will be modified to return a Map in the next release. */ @Deprecated protected FastHashMap create(final Locale locale) { final FastHashMap converter = new DelegateFastHashMap(BeanUtils.createCache()); converter.setFast(false); converter.put(BigDecimal.class, new BigDecimalLocaleConverter(locale, applyLocalized)); converter.put(BigInteger.class, new BigIntegerLocaleConverter(locale, applyLocalized)); converter.put(Byte.class, new ByteLocaleConverter(locale, applyLocalized)); converter.put(Byte.TYPE, new ByteLocaleConverter(locale, applyLocalized)); converter.put(Double.class, new DoubleLocaleConverter(locale, applyLocalized)); converter.put(Double.TYPE, new DoubleLocaleConverter(locale, applyLocalized)); converter.put(Float.class, new FloatLocaleConverter(locale, applyLocalized)); converter.put(Float.TYPE, new FloatLocaleConverter(locale, applyLocalized)); converter.put(Integer.class, new IntegerLocaleConverter(locale, applyLocalized)); converter.put(Integer.TYPE, new IntegerLocaleConverter(locale, applyLocalized)); converter.put(Long.class, new LongLocaleConverter(locale, applyLocalized)); converter.put(Long.TYPE, new LongLocaleConverter(locale, applyLocalized)); converter.put(Short.class, new ShortLocaleConverter(locale, applyLocalized)); converter.put(Short.TYPE, new ShortLocaleConverter(locale, applyLocalized)); converter.put(String.class, new StringLocaleConverter(locale, applyLocalized)); // conversion format patterns of java.sql.* types should correspond to default // behaviour of toString and valueOf methods of these classes converter.put(java.sql.Date.class, new SqlDateLocaleConverter(locale, "yyyy-MM-dd")); converter.put(java.sql.Time.class, new SqlTimeLocaleConverter(locale, "HH:mm:ss")); converter.put( java.sql.Timestamp.class, new SqlTimestampLocaleConverter(locale, "yyyy-MM-dd HH:mm:ss.S") ); converter.setFast(true); return converter; }
public FastHashMapCaptchaStore() { this.store = new FastHashMap(); }
/** * Remove any registered {@link LocaleConverter}. */ public void deregister() { final FastHashMap defaultConverter = lookup(defaultLocale); mapConverters.setFast(false); mapConverters.clear(); mapConverters.put(defaultLocale, defaultConverter); mapConverters.setFast(true); }
/** * <p> * Return the mapped property descriptors for this bean class. * </p> * * <p> * <strong>FIXME</strong> - Does not work with DynaBeans. * </p> * * @param beanClass * Bean class to be introspected * @return the mapped property descriptors * @deprecated This method should not be exposed */ @Deprecated public FastHashMap getMappedPropertyDescriptors(final Class<?> beanClass) { if (beanClass == null) { return null; } // Look up any cached descriptors for this bean class return mappedDescriptorsCache.get(beanClass); }
/** * <p> * Return the mapped property descriptors for this bean. * </p> * * <p> * <strong>FIXME</strong> - Does not work with DynaBeans. * </p> * * @param bean * Bean to be introspected * @return the mapped property descriptors * @deprecated This method should not be exposed */ @Deprecated public FastHashMap getMappedPropertyDescriptors(final Object bean) { if (bean == null) { return null; } return getMappedPropertyDescriptors(bean.getClass()); }
/** * <p>Look up and return any registered FastHashMap instance for the specified locale.</p> * * <p>For more details see <code>LocaleConvertUtilsBean</code></p> * * @param locale The Locale * @return The FastHashMap instance contains the all {@link LocaleConverter} types for * the specified locale. * @see LocaleConvertUtilsBean#lookup(Locale) * @deprecated This method will be modified to return a Map in the next release. */ @Deprecated protected static FastHashMap lookup(final Locale locale) { return LocaleConvertUtilsBean.getInstance().lookup(locale); }
/** * <p>Create all {@link LocaleConverter} types for specified locale.</p> * * <p>For more details see <code>LocaleConvertUtilsBean</code></p> * * @param locale The Locale * @return The FastHashMap instance contains the all {@link LocaleConverter} types * for the specified locale. * @see LocaleConvertUtilsBean#create(Locale) * @deprecated This method will be modified to return a Map in the next release. */ @Deprecated protected static FastHashMap create(final Locale locale) { return LocaleConvertUtilsBean.getInstance().create(locale); }
/** * <p>Return the mapped property descriptors for this bean class.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param beanClass Bean class to be introspected * @return the mapped property descriptors * @see PropertyUtilsBean#getMappedPropertyDescriptors(Class) * @deprecated This method should not be exposed */ @Deprecated public static FastHashMap getMappedPropertyDescriptors(final Class<?> beanClass) { return PropertyUtilsBean.getInstance().getMappedPropertyDescriptors(beanClass); }
/** * <p>Return the mapped property descriptors for this bean.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param bean Bean to be introspected * @return the mapped property descriptors * @see PropertyUtilsBean#getMappedPropertyDescriptors(Object) * @deprecated This method should not be exposed */ @Deprecated public static FastHashMap getMappedPropertyDescriptors(final Object bean) { return PropertyUtilsBean.getInstance().getMappedPropertyDescriptors(bean); }