java.lang.Object
org.miaixz.bus.extra.pinyin.PinyinFactory
Simple Pinyin engine factory that automatically creates the corresponding Pinyin engine object based on the Pinyin
library JARs introduced by the user. It uses the Simple Factory pattern.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PinyinProvidercreate()Creates a newPinyinProviderinstance.static PinyinProviderCreates a custom Pinyin engine by name.static PinyinProviderget()Retrieves a singleton instance ofPinyinProvider.
-
Constructor Details
-
PinyinFactory
public PinyinFactory()
-
-
Method Details
-
get
Retrieves a singleton instance ofPinyinProvider. The first available Pinyin provider found via SPI will be used.- Returns:
- A singleton instance of
PinyinProvider.
-
create
Creates a newPinyinProviderinstance. This method returns a new engine instance each time it is called.- Returns:
- A new
PinyinProviderinstance.
-
create
public static PinyinProvider create(String name) throws org.miaixz.bus.core.lang.exception.InternalException Creates a custom Pinyin engine by name.- Parameters:
name- The name of the engine (case-insensitive), e.g., `Bopomofo4j`, `Houbb`, `JPinyin`, `Pinyin4j`, `TinyPinyin`.- Returns:
- The
PinyinProviderinstance corresponding to the given name. - Throws:
org.miaixz.bus.core.lang.exception.InternalException- if no engine with the specified name is found.
-