Package com.helger.html.meta
Class MetaElement
- java.lang.Object
-
- com.helger.html.meta.MetaElement
-
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<MetaElement>,com.helger.commons.name.IHasName,IMetaElement,IMetaElementDeclaration,IMutableMetaElement,Serializable
@NotThreadSafe public class MetaElement extends Object implements IMutableMetaElement, com.helger.commons.lang.ICloneable<MetaElement>
Represents a single HTML meta element.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMetaElement(EMetaElementType eType, String sName, String sScheme, Locale aContentLocale, String sContent)MetaElement(IMetaElement aOther)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.helger.xml.microdom.IMicroNodeconvertToNode(IHCConversionSettingsToNode aConversionSettings)Convert this meta element to anIMicroNodestatic MetaElementcreateMeta(String sName, String sValue)static MetaElementcreateMetaCharset(Charset aCharset)static MetaElementcreateMetaHttpEquiv(String sName, String sValue)booleanequals(Object o)com.helger.commons.collection.impl.ICommonsOrderedSet<Locale>getAllLocales()com.helger.commons.collection.impl.ICommonsList<IMetaElementValue>getAsMetaElementValueList()Get the contents of this meta tag as a self contained list of meta tag values.MetaElementgetClone()Iterable<Map.Entry<Locale,String>>getContent()StringgetContentLanguageIndependent()com.helger.commons.collection.impl.ICommonsOrderedMap<Locale,String>getContentMap()StringgetName()protected StringgetNamespaceURI(IHCConversionSettingsToNode aConversionSettings)static LocalegetRealContentLocale(Locale aContentLocale)StringgetScheme()Get the optional meta element scheme.EMetaElementTypegetType()inthashCode()booleanisLanguageIndependent()Check if the meta tag is language independent.com.helger.commons.state.EChangeremoveContent(Locale aContentLocale)Remove the value of the given locale.com.helger.commons.state.EChangesetContent(Locale aContentLocale, String sContent)Set the value of the meta element in the given locale.com.helger.commons.state.EChangesetName(String sName)Set the name of the meta element.com.helger.commons.state.EChangesetScheme(String sScheme)com.helger.commons.state.EChangesetType(EMetaElementType eType)Set the type of the meta element.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.html.meta.IMetaElementDeclaration
isHttpEquiv
-
Methods inherited from interface com.helger.html.meta.IMutableMetaElement
removeContent, setContent
-
-
-
-
Method Detail
-
getType
@Nonnull public EMetaElementType getType()
- Specified by:
getTypein interfaceIMetaElementDeclaration- Returns:
- The meta element type. Never
null.
-
setType
@Nonnull public final com.helger.commons.state.EChange setType(@Nonnull EMetaElementType eType)
Description copied from interface:IMutableMetaElementSet the type of the meta element.- Specified by:
setTypein interfaceIMutableMetaElement- Parameters:
eType- The type to use. May not benull.- Returns:
EChange
-
getName
@Nonnull public String getName()
- Specified by:
getNamein interfacecom.helger.commons.name.IHasName
-
setName
@Nonnull public final com.helger.commons.state.EChange setName(@Nonnull String sName)
Description copied from interface:IMutableMetaElementSet the name of the meta element. May usually neither benullnor empty, except forEMetaElementType.CHARSETwhere the name does not matter.- Specified by:
setNamein interfaceIMutableMetaElement- Parameters:
sName- The name to use. May not benull.- Returns:
EChange.
-
getScheme
@Nullable public String getScheme()
Description copied from interface:IMetaElementDeclarationGet the optional meta element scheme.- Specified by:
getSchemein interfaceIMetaElementDeclaration- Returns:
- the optional meta element scheme - can be
null
-
isLanguageIndependent
public boolean isLanguageIndependent()
Description copied from interface:IMetaElementCheck if the meta tag is language independent.- Specified by:
isLanguageIndependentin interfaceIMetaElement- Returns:
trueif the meta tag is language independent,falseif it is not
-
getAllLocales
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedSet<Locale> getAllLocales()
- Specified by:
getAllLocalesin interfaceIMetaElement- Returns:
- A set with all locales a value is present
-
getContentLanguageIndependent
@Nullable public String getContentLanguageIndependent()
- Specified by:
getContentLanguageIndependentin interfaceIMetaElement- Returns:
- The content which was specified locale independent.
-
getContentMap
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<Locale,String> getContentMap()
- Specified by:
getContentMapin interfaceIMetaElement- Returns:
- A non-
nullmap from language to value.
-
getContent
@Nonnull @ReturnsMutableCopy public Iterable<Map.Entry<Locale,String>> getContent()
- Specified by:
getContentin interfaceIMetaElement- Returns:
- A non-
nullmap from language to value.
-
getRealContentLocale
@Nonnull public static Locale getRealContentLocale(@Nullable Locale aContentLocale)
-
setContent
@Nonnull public com.helger.commons.state.EChange setContent(@Nullable Locale aContentLocale, @Nullable String sContent)
Description copied from interface:IMutableMetaElementSet the value of the meta element in the given locale.- Specified by:
setContentin interfaceIMutableMetaElement- Parameters:
aContentLocale- The locale to set. May benull.sContent- The value to be set. If the content isnullthe value is removed.- Returns:
EChange
-
removeContent
@Nonnull public com.helger.commons.state.EChange removeContent(@Nullable Locale aContentLocale)
Description copied from interface:IMutableMetaElementRemove the value of the given locale.- Specified by:
removeContentin interfaceIMutableMetaElement- Parameters:
aContentLocale- The locale to be removed. May not benull.- Returns:
EChange
-
getAsMetaElementValueList
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<IMetaElementValue> getAsMetaElementValueList()
Description copied from interface:IMetaElementGet the contents of this meta tag as a self contained list of meta tag values.- Specified by:
getAsMetaElementValueListin interfaceIMetaElement- Returns:
- A non-
nullmodifiable list of meta tags.
-
getNamespaceURI
@Nonnull @Nonempty @OverrideOnDemand protected String getNamespaceURI(@Nonnull IHCConversionSettingsToNode aConversionSettings)
-
convertToNode
@Nullable public com.helger.xml.microdom.IMicroNode convertToNode(@Nonnull IHCConversionSettingsToNode aConversionSettings)
Description copied from interface:IMetaElementConvert this meta element to anIMicroNode- Specified by:
convertToNodein interfaceIMetaElement- Parameters:
aConversionSettings- The conversion settings to be used. May not benull.- Returns:
nullif this meta element contains no content.
-
getClone
@Nonnull @ReturnsMutableCopy public MetaElement getClone()
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<MetaElement>
-
createMeta
@Nonnull public static MetaElement createMeta(@Nonnull String sName, @Nonnull String sValue)
-
createMetaHttpEquiv
@Nonnull public static MetaElement createMetaHttpEquiv(@Nonnull String sName, @Nonnull String sValue)
-
createMetaCharset
@Nonnull public static MetaElement createMetaCharset(@Nonnull Charset aCharset)
-
-