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.java250
    }
    
    // --------------------- borrowed from UIComponentBase ------------

    private Map _valueExpressionMap = null;

    public ValueExpression getValueExpression(String name)
    {
        if (name == null) throw new NullPointerException("name");
        if (_valueExpressionMap == null)
        {
            return null;
        }
        else
        {
            return (ValueExpression)_valueExpressionMap.get(name);
        }
    }

    public void setValueExpression(String name,
                                ValueExpression binding)
    {
        if (name == null) throw new NullPointerException("name");
        if (_valueExpressionMap == null)
        {
            _valueExpressionMap = new HashMap();
        }
        _valueExpressionMap.put(name, binding);
    }

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

    final static class ValueExpressionMetadata extends Metadata {

        private final String name;

        private final TagAttribute attr;

        private final Class type;

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

        public void applyMetadata(FaceletContext ctx, Object instance) {
            ((ConverterBase) instance).setValueExpression(this.name, 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/AbstractTypedNumberConverter.java478
org/apache/myfaces/commons/converter/DateTimeConverter.java373
    @JSFProperty(inheritedTag = false,deferredValueType="java.lang.Object")
    public Locale getLocale()
    {        
        if (_locale != null)
        {
            return _locale;
        }
        ValueExpression vb = getValueExpression("locale");
        if (vb != null)
        {
            Object _localeValue = vb.getValue(getFacesContext().getELContext());
            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)
FileLine
org/apache/myfaces/commons/converter/ConverterBase.java186
org/apache/myfaces/commons/converter/DateTimeConverter.java290
                             ConverterBase.saveAttachedState(context, entry.getValue()));
            }
            return stateMap;
        }
        else
        {
            return null;
        }
    }

    private void restoreValueExpressionMap(FacesContext context, Object stateObj)
    {
        if (stateObj != null)
        {
            Map stateMap = (Map)stateObj;
            int initCapacity = (stateMap.size() * 4 + 3) / 3;
            _valueExpressionMap = new HashMap(initCapacity);
            for (Iterator it = stateMap.entrySet().iterator(); it.hasNext(); )
            {
                Map.Entry entry = (Map.Entry)it.next();
                _valueExpressionMap.put(entry.getKey(),