Package org.xwiki.rendering.wikimodel
Class WikiFormat
- java.lang.Object
-
- org.xwiki.rendering.wikimodel.WikiFormat
-
public class WikiFormat extends Object
An immutable set of styles.- Since:
- 4.0M1
- Version:
- $Id: 19761654def5f0c27655741f383b88aaaf34e9f7 $
-
-
Field Summary
Fields Modifier and Type Field Description static WikiFormatEMPTY
-
Constructor Summary
Constructors Constructor Description WikiFormat()WikiFormat(Collection<WikiParameter> params)WikiFormat(Set<WikiStyle> styles)WikiFormat(Set<WikiStyle> styles, Collection<WikiParameter> params)WikiFormat(WikiStyle style)WikiFormat(WikiStyle[] styles)WikiFormat(WikiStyle style, Collection<WikiParameter> params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WikiFormataddStyle(WikiStyle style)Creates a new style set and adds the given style to it.booleanequals(Object obj)protected WikiFormatgetClone()List<WikiParameter>getParams()List<WikiStyle>getStyles()StringgetTags(boolean open)Returns opening or closing tags corresponding to the given format(it depends on the given flag).inthashCode()booleanhasStyle(WikiStyle style)WikiFormatremoveStyle(WikiStyle style)Creates a new style set which does not contain the specified style.WikiFormatsetParameters(Collection<WikiParameter> params)WikiFormatswitchStyle(WikiStyle wikiStyle)Creates a new format object where the specified style is switched: if this format contains the given style then the resulting format does not and vice versa.StringtoString()
-
-
-
Field Detail
-
EMPTY
public static WikiFormat EMPTY
-
-
Constructor Detail
-
WikiFormat
public WikiFormat()
-
WikiFormat
public WikiFormat(Set<WikiStyle> styles, Collection<WikiParameter> params)
-
WikiFormat
public WikiFormat(Collection<WikiParameter> params)
-
WikiFormat
public WikiFormat(WikiStyle style)
-
WikiFormat
public WikiFormat(WikiStyle style, Collection<WikiParameter> params)
-
WikiFormat
public WikiFormat(WikiStyle[] styles)
-
-
Method Detail
-
setParameters
public WikiFormat setParameters(Collection<WikiParameter> params)
-
addStyle
public WikiFormat addStyle(WikiStyle style)
Creates a new style set and adds the given style to it.- Parameters:
style- the style to add- Returns:
- a new copy of the style set containing the given style
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classObject- See Also:
Object.equals(java.lang.Object)
-
getClone
protected WikiFormat getClone()
- Returns:
- a new clone of this format object
-
getTags
public String getTags(boolean open)
Returns opening or closing tags corresponding to the given format(it depends on the given flag).- Parameters:
open- if this flag istruethen this method returns opening tags for this format- Returns:
- opening or closing tags corresponding to the given format(it depends on the given flag)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- See Also:
Object.hashCode()
-
hasStyle
public boolean hasStyle(WikiStyle style)
- Parameters:
style- the style to check- Returns:
trueif this format has the specified style
-
removeStyle
public WikiFormat removeStyle(WikiStyle style)
Creates a new style set which does not contain the specified style.- Parameters:
style- the style to add- Returns:
- a new copy of the style set containing the given style
-
switchStyle
public WikiFormat switchStyle(WikiStyle wikiStyle)
Creates a new format object where the specified style is switched: if this format contains the given style then the resulting format does not and vice versa.- Parameters:
wikiStyle- the style to switch- Returns:
- a format object where the given style is inverted relatively to this format
-
getStyles
public List<WikiStyle> getStyles()
- Returns:
- the list of styles in the order in which they were created
-
getParams
public List<WikiParameter> getParams()
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
-