Apache MyFaces
Documentation
Foundation

CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
org/apache/myfaces/commons/converter/ConverterBase.java146
org/apache/myfaces/commons/converter/DateTimeConverter.java241
    }
    
    // --------------------- borrowed from UIComponentBase ------------

    private Map _valueBindingMap = null;

    public ValueBinding getValueBinding(String name)
    {
        if (name == null) throw new NullPointerException("name");
        if (_valueBindingMap == null)
        {
            return null;
        }
        else
        {
            return (ValueBinding)_valueBindingMap.get(name);
        }
    }

    public void setValueBinding(String name,
                                ValueBinding binding)
    {
        if (name == null) throw new NullPointerException("name");
        if (_valueBindingMap == null)
        {
            _valueBindingMap = new HashMap();
        }
        _valueBindingMap.put(name, binding);
    }

    private Object saveValueBindingMap(FacesContext context)
    {
        if (_valueBindingMap != null)
        {
            int initCapacity = (_valueBindingMap.size() * 4 + 3) / 3;
            HashMap stateMap = new HashMap(initCapacity);
            for (Iterator it = _valueBindingMap.entrySet().iterator(); it.hasNext(); )
            {
                Map.Entry entry = (Map.Entry)it.next();
                stateMap.put(entry.getKey(),
FileLine
org/apache/myfaces/commons/converter/_LocaleRule.java32
org/apache/myfaces/commons/converter/_TimeZoneRule.java32
final class _TimeZoneRule extends MetaRule {

    final static class ValueBindingMetadata extends Metadata {

        private final String name;

        private final TagAttribute attr;

        private final Class type;

        public ValueBindingMetadata(String name, Class type,
                TagAttribute attr) {
            this.name = name;
            this.attr = attr;
            this.type = type;
        }

        public void applyMetadata(FaceletContext ctx, Object instance) {
            ((ConverterBase) instance).setValueBinding(this.name, new LegacyValueBinding(this.attr
                    .getValueExpression(ctx, this.type)));
        }

    }
    
    final static class LiteralPropertyMetadata extends Metadata
    {

        private final Method method;

        private final TagAttribute attribute;

        private Object[] value;

        public LiteralPropertyMetadata(Method method, TagAttribute attribute)
        {
            this.method = method;
            this.attribute = attribute;
        }

        public void applyMetadata(FaceletContext ctx, Object instance)
        {
            if (value == null)
            {
                String str = this.attribute.getValue();
                value = new Object[] { java.util.TimeZone.getTimeZone( str ) };
FileLine
org/apache/myfaces/commons/converter/ConverterBase.java186
org/apache/myfaces/commons/converter/DateTimeConverter.java281
                             ConverterBase.saveAttachedState(context, entry.getValue()));
            }
            return stateMap;
        }
        else
        {
            return null;
        }
    }

    private void restoreValueBindingMap(FacesContext context, Object stateObj)
    {
        if (stateObj != null)
        {
            Map stateMap = (Map)stateObj;
            int initCapacity = (stateMap.size() * 4 + 3) / 3;
            _valueBindingMap = new HashMap(initCapacity);
            for (Iterator it = stateMap.entrySet().iterator(); it.hasNext(); )
            {
                Map.Entry entry = (Map.Entry)it.next();
                _valueBindingMap.put(entry.getKey(),
FileLine
org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java462
org/apache/myfaces/commons/converter/DateTimeConverter.java365
    public Locale getLocale()
    {        
        if (_locale != null)
        {
            return _locale;
        }
        ValueBinding vb = getValueBinding("locale");
        if (vb != null)
        {
            Object _localeValue = vb.getValue(getFacesContext());
            if (_localeValue instanceof String)
            {
                _localeValue = org.apache.myfaces.commons.util.TagUtils.getLocale((String)_localeValue);
            }
            return (java.util.Locale)_localeValue;
        }
        FacesContext context = FacesContext.getCurrentInstance();
        return context.getViewRoot().getLocale();
    }

    public void setLocale(Locale locale)
    {
        _locale = locale;
    }

    /**
     * A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.
     * 
     */
    @JSFProperty(inheritedTag = false)