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 WikiFormat
EMPTY
-
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 WikiFormat
addStyle(WikiStyle style)
Creates a new style set and adds the given style to it.boolean
equals(Object obj)
protected WikiFormat
getClone()
List<WikiParameter>
getParams()
List<WikiStyle>
getStyles()
String
getTags(boolean open)
Returns opening or closing tags corresponding to the given format(it depends on the given flag).int
hashCode()
boolean
hasStyle(WikiStyle style)
WikiFormat
removeStyle(WikiStyle style)
Creates a new style set which does not contain the specified style.WikiFormat
setParameters(Collection<WikiParameter> params)
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.String
toString()
-
-
-
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:
equals
in 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 istrue
then 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:
hashCode
in classObject
- See Also:
Object.hashCode()
-
hasStyle
public boolean hasStyle(WikiStyle style)
- Parameters:
style
- the style to check- Returns:
true
if 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:
toString
in classObject
- See Also:
Object.toString()
-
-