@Override
    @SuppressWarnings("PMD")
    protected String doRender(final RenderConfiguration config, final AbstractAttributes entity) {

        // Collect all non-null properties into a SortedMap using reflection.
        final SortedMap<String, String> dotAttributes = new TreeMap<>();

        for (Class<?> current = entity.getClass();
             current != null && current != Object.class;
             current = current.getSuperclass()) {

            for (Field currentField : current.getDeclaredFields()) {
                if (isConfigurationField(currentField)) {

                    String key = null;
                    Object value = null;

                    try {

                        // #1) Do we have a non-null value in the Field?
                        value = currentField.get(entity);
                        if (value == null) {
                            continue;
                        }

                        // #2) Do we have @DotProperty annotation on the Field?
                        final DotProperty dotPropertyAnnotation = currentField.getAnnotation(DotProperty.class);
                        if (dotPropertyAnnotation == null) {
                            continue;
                        }

                        // #3) Does this field need special treatment?
                        if (dotPropertyAnnotation.specialTreatment()) {

                            if ("labelSize".equals(currentField.getName())
                                    && PointOrRectangle.class.equals(currentField.getType())) {

                                final PointOrRectangle rect = (PointOrRectangle) value;
                                dotAttributes.put(quote("lwidth"),
                                        BigDecimal.valueOf(rect.getxOrWidth()).toPlainString());
                                dotAttributes.put(quote("lheight"),
                                        BigDecimal.valueOf(rect.getyOrHeight()).toPlainString());

                                // All Done for this Field.
                                continue;
                            }
                        }

                        // #4) Use the DotProperty "name" attribute, or fallback to the field name.
                        key = dotPropertyAnnotation.name();
                        if (key.isEmpty() || "##default".equalsIgnoreCase(key)) {
                            key = currentField.getName();
                        }

                        // #5) Transform the value if required, and add the key/value pair to the outbound Map.
                        dotAttributes.put(key, getDotConfigValueFor(value));

                    } catch (Exception e) {
                        throw new IllegalArgumentException("Could not add configuration for field ["
                                + currentField + "] --> [" + key + "] in class ["
                                + entity.getClass().getSimpleName() + "]", e);
                    }
                }
            }
        }

        // Check sanity
        if (dotAttributes.isEmpty()) {
            return "";
        }

        // Synthesize the required attribute List form.
        final StringBuilder builder = new StringBuilder(START_TOKEN);
        for (Map.Entry<String, String> current : dotAttributes.entrySet()) {
            builder.append(current.getKey() + SEPARATOR + "\"" + current.getValue() + "\"" + DELIMITER);
        }

        // Remove the last delimiter
        builder.delete(builder.length() - DELIMITER.length(), builder.length());

        // All Done.
        builder.append(END_TOKEN);
        return builder.toString();
    }
@Override
    @SuppressWarnings("PMD")
    protected String doRender(final RenderConfiguration config, final AbstractAttributes entity) {

        
        final SortedMap<String, String> dotAttributes = new TreeMap<>();

        for (Class<?> current = entity.getClass();
             current != null && current != Object.class;
             current = current.getSuperclass()) {

            for (Field currentField : current.getDeclaredFields()) {
                if (isConfigurationField(currentField)) {

                    String key = null;
                    Object value = null;

                    try {

                        
                        value = currentField.get(entity);
                        if (value == null) {
                            continue;
                        }

                        
                        final DotProperty dotPropertyAnnotation = currentField.getAnnotation(DotProperty.class);
                        if (dotPropertyAnnotation == null) {
                            continue;
                        }

                        
                        if (dotPropertyAnnotation.specialTreatment()) {

                            if ("labelSize".equals(currentField.getName())
                                    && PointOrRectangle.class.equals(currentField.getType())) {

                                final PointOrRectangle rect = (PointOrRectangle) value;
                                dotAttributes.put(quote("lwidth"),
                                        BigDecimal.valueOf(rect.getxOrWidth()).toPlainString());
                                dotAttributes.put(quote("lheight"),
                                        BigDecimal.valueOf(rect.getyOrHeight()).toPlainString());

                                
                                continue;
                            }
                        }

                        
                        key = dotPropertyAnnotation.name();
                        if (key.isEmpty() || "##default".equalsIgnoreCase(key)) {
                            key = currentField.getName();
                        }

                        
                        dotAttributes.put(key, getDotConfigValueFor(value));

                    } catch (Exception e) {
                        throw new IllegalArgumentException("Could not add configuration for field ["
                                + currentField + "] --> [" + key + "] in class ["
                                + entity.getClass().getSimpleName() + "]", e);
                    }
                }
            }
        }

        
        if (dotAttributes.isEmpty()) {
            return "";
        }

        
        final StringBuilder builder = new StringBuilder(START_TOKEN);
        for (Map.Entry<String, String> current : dotAttributes.entrySet()) {
            builder.append(current.getKey() + SEPARATOR + "\"" + current.getValue() + "\"" + DELIMITER);
        }

        
        builder.delete(builder.length() - DELIMITER.length(), builder.length());

        
        builder.append(END_TOKEN);
        return builder.toString();
    }
@ Override @ SuppressWarnings ( "PMD" ) protected String doRender ( final RenderConfiguration config , final AbstractAttributes entity ) { // Collect all non-null properties into a SortedMap using reflection. final SortedMap < String , String > dotAttributes = new TreeMap <> ( ) ; for ( Class < ? > current = entity . getClass ( ) ; current != null && current != Object . class ; current = current . getSuperclass ( ) ) { for ( Field currentField : current . getDeclaredFields ( ) ) { if ( isConfigurationField ( currentField ) ) { String key = null ; Object value = null ; try { // #1) Do we have a non-null value in the Field? value = currentField . get ( entity ) ; if ( value == null ) { continue ; } // #2) Do we have @DotProperty annotation on the Field? final DotProperty dotPropertyAnnotation = currentField . getAnnotation ( DotProperty . class ) ; if ( dotPropertyAnnotation == null ) { continue ; } // #3) Does this field need special treatment? if ( dotPropertyAnnotation . specialTreatment ( ) ) { if ( "labelSize" . equals ( currentField . getName ( ) ) && PointOrRectangle . class . equals ( currentField . getType ( ) ) ) { final PointOrRectangle rect = ( PointOrRectangle ) value ; dotAttributes . put ( quote ( "lwidth" ) , BigDecimal . valueOf ( rect . getxOrWidth ( ) ) . toPlainString ( ) ) ; dotAttributes . put ( quote ( "lheight" ) , BigDecimal . valueOf ( rect . getyOrHeight ( ) ) . toPlainString ( ) ) ; // All Done for this Field. continue ; } } // #4) Use the DotProperty "name" attribute, or fallback to the field name. key = dotPropertyAnnotation . name ( ) ; if ( key . isEmpty ( ) || "##default" . equalsIgnoreCase ( key ) ) { key = currentField . getName ( ) ; } // #5) Transform the value if required, and add the key/value pair to the outbound Map. dotAttributes . put ( key , getDotConfigValueFor ( value ) ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Could not add configuration for field [" + currentField + "] --> [" + key + "] in class [" + entity . getClass ( ) . getSimpleName ( ) + "]" , e ) ; } } } } // Check sanity if ( dotAttributes . isEmpty ( ) ) { return "" ; } // Synthesize the required attribute List form. final StringBuilder builder = new StringBuilder ( START_TOKEN ) ; for ( Map . Entry < String , String > current : dotAttributes . entrySet ( ) ) { builder . append ( current . getKey ( ) + SEPARATOR + "\"" + current . getValue ( ) + "\"" + DELIMITER ) ; } // Remove the last delimiter builder . delete ( builder . length ( ) - DELIMITER . length ( ) , builder . length ( ) ) ; // All Done. builder . append ( END_TOKEN ) ; return builder . toString ( ) ; }
{@inheritDoc}
{