Search in sources :

Example 1 with BooleanProperty

use of net.sourceforge.pmd.properties.BooleanProperty in project pmd by pmd.

the class CSVRenderer method booleanPropertyFor.

private static BooleanProperty booleanPropertyFor(String id, String label) {
    BooleanProperty prop = PROPERTY_DESCRIPTORS_BY_ID.get(id);
    if (prop != null) {
        return prop;
    }
    prop = new BooleanProperty(id, "Include " + label + " column", true, 1.0f);
    PROPERTY_DESCRIPTORS_BY_ID.put(id, prop);
    return prop;
}
Also used : BooleanProperty(net.sourceforge.pmd.properties.BooleanProperty)

Example 2 with BooleanProperty

use of net.sourceforge.pmd.properties.BooleanProperty in project pmd by pmd.

the class EcmascriptParserOptionsTest method testEqualsHashcode.

@Test
public void testEqualsHashcode() throws Exception {
    BooleanProperty[] properties = { EcmascriptParserOptions.RECORDING_COMMENTS_DESCRIPTOR, EcmascriptParserOptions.RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR };
    for (int i = 0; i < properties.length; i++) {
        BooleanProperty property = properties[i];
        MyRule rule = new MyRule();
        rule.setProperty(property, true);
        ParserOptions options1 = rule.getParserOptions();
        rule.setProperty(property, false);
        ParserOptions options2 = rule.getParserOptions();
        rule.setProperty(property, true);
        ParserOptions options3 = rule.getParserOptions();
        rule.setProperty(property, false);
        ParserOptions options4 = rule.getParserOptions();
        verifyOptionsEqualsHashcode(options1, options2, options3, options4);
    }
    EcmascriptParserOptions options1 = new EcmascriptParserOptions();
    options1.setSuppressMarker("foo");
    EcmascriptParserOptions options2 = new EcmascriptParserOptions();
    options2.setSuppressMarker("bar");
    EcmascriptParserOptions options3 = new EcmascriptParserOptions();
    options3.setSuppressMarker("foo");
    EcmascriptParserOptions options4 = new EcmascriptParserOptions();
    options4.setSuppressMarker("bar");
    verifyOptionsEqualsHashcode(options1, options2, options3, options4);
    options1 = new EcmascriptParserOptions();
    options1.setRhinoLanguageVersion(EcmascriptParserOptions.Version.VERSION_DEFAULT);
    options2 = new EcmascriptParserOptions();
    options2.setRhinoLanguageVersion(EcmascriptParserOptions.Version.VERSION_1_8);
    options3 = new EcmascriptParserOptions();
    options3.setRhinoLanguageVersion(EcmascriptParserOptions.Version.VERSION_DEFAULT);
    options4 = new EcmascriptParserOptions();
    options4.setRhinoLanguageVersion(EcmascriptParserOptions.Version.VERSION_1_8);
    verifyOptionsEqualsHashcode(options1, options2, options3, options4);
}
Also used : ParserOptions(net.sourceforge.pmd.lang.ParserOptions) BooleanProperty(net.sourceforge.pmd.properties.BooleanProperty) Test(org.junit.Test)

Example 3 with BooleanProperty

use of net.sourceforge.pmd.properties.BooleanProperty in project pmd by pmd.

the class XmlParserOptionsTest method testEqualsHashcode.

@Test
public void testEqualsHashcode() throws Exception {
    BooleanProperty[] properties = new BooleanProperty[] { XmlParserOptions.COALESCING_DESCRIPTOR, XmlParserOptions.EXPAND_ENTITY_REFERENCES_DESCRIPTOR, XmlParserOptions.IGNORING_COMMENTS_DESCRIPTOR, XmlParserOptions.IGNORING_ELEMENT_CONTENT_WHITESPACE_DESCRIPTOR, XmlParserOptions.NAMESPACE_AWARE_DESCRIPTOR, XmlParserOptions.VALIDATING_DESCRIPTOR, XmlParserOptions.XINCLUDE_AWARE_DESCRIPTOR };
    for (int i = 0; i < properties.length; i++) {
        BooleanProperty property = properties[i];
        MyRule rule = new MyRule();
        rule.setProperty(property, true);
        ParserOptions options1 = rule.getParserOptions();
        rule.setProperty(property, false);
        ParserOptions options2 = rule.getParserOptions();
        rule.setProperty(property, true);
        ParserOptions options3 = rule.getParserOptions();
        rule.setProperty(property, false);
        ParserOptions options4 = rule.getParserOptions();
        verifyOptionsEqualsHashcode(options1, options2, options3, options4);
    }
    XmlParserOptions options1 = new XmlParserOptions();
    options1.setSuppressMarker("foo");
    XmlParserOptions options2 = new XmlParserOptions();
    options2.setSuppressMarker("bar");
    XmlParserOptions options3 = new XmlParserOptions();
    options3.setSuppressMarker("foo");
    XmlParserOptions options4 = new XmlParserOptions();
    options4.setSuppressMarker("bar");
    verifyOptionsEqualsHashcode(options1, options2, options3, options4);
}
Also used : ParserOptions(net.sourceforge.pmd.lang.ParserOptions) BooleanProperty(net.sourceforge.pmd.properties.BooleanProperty) Test(org.junit.Test)

Aggregations

BooleanProperty (net.sourceforge.pmd.properties.BooleanProperty)3 ParserOptions (net.sourceforge.pmd.lang.ParserOptions)2 Test (org.junit.Test)2