StyleFactory styleFactory = StyleFactory.createStyleFactory();<br /> Style style = styleFactory.getDefaultStyle();<br />//Feature type style 1<br />FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();<br /> fts.setFeatureTypeName("feature-type-1");<br /> style.addFeatureTypeStyle(fts);</p><p>//Feature type style 2<br /> FeatureTypeStyle fts2 = styleFactory.createFeatureTypeStyle();<br /> fts2.setFeatureTypeName("feature-type-2");<br />//creating the rule 1<br /> Rule rule1 = styleFactory.createRule();<br /> rule1.setName("rule1");<br />FilterFactory filterFactory = FilterFactory.createFilterFactory();<br />Filter aFilter = filterFactory.createFidFilter("FID");<br />rule1.setFilter(aFilter);<br /> fts2.addRule(rule1);<br />//creating the rule 2<br />Rule rule2 = styleFactory.createRule();<br />rule2.setIsElseFilter(true);<br />rule2.setName("rule2");<br /> fts2.addRule(rule2);<br /> style.addFeatureTypeStyle(fts2);