Package org.apache.poi.ooxml
Class POIXMLFactory
java.lang.Object
org.apache.poi.ooxml.POIXMLFactory
- Direct Known Subclasses:
XDGFFactory
,XSLFFactory
,XSSFFactory
,XWPFFactory
Defines a factory API that enables sub-classes to create instances of
POIXMLDocumentPart
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract POIXMLDocumentPart
createDocumentPart
(Class<? extends POIXMLDocumentPart> cls, Class<?>[] classes, Object[] values) Need to delegate instantiation to sub class because of constructor visibilitycreateDocumentPart
(POIXMLDocumentPart parent, PackagePart part) Create a POIXMLDocumentPart from existing package part and relation.protected abstract POIXMLRelation
getDescriptor
(String relationshipType) returns the descriptor for the given relationship typeprotected PackageRelationship
getPackageRelationship
(POIXMLDocumentPart parent, PackagePart part) Retrieves the package relationship of the child part within the parentnewDocumentPart
(POIXMLRelation descriptor) Create a new POIXMLDocumentPart using the supplied descriptor.
-
Constructor Details
-
POIXMLFactory
public POIXMLFactory()
-
-
Method Details
-
createDocumentPart
Create a POIXMLDocumentPart from existing package part and relation. This method is called fromPOIXMLDocument.load(POIXMLFactory)
when parsing a document- Parameters:
parent
- parent partpart
- the PackagePart representing the created instance- Returns:
- A new instance of a POIXMLDocumentPart.
- Since:
- by POI 3.14-Beta1
-
createDocumentPart
protected abstract POIXMLDocumentPart createDocumentPart(Class<? extends POIXMLDocumentPart> cls, Class<?>[] classes, Object[] values) throws SecurityException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException Need to delegate instantiation to sub class because of constructor visibility- Parameters:
cls
- the document class to be instantiatedclasses
- the classes of the constructor argumentsvalues
- the values of the constructor arguments- Returns:
- the new document / part
- Throws:
SecurityException
- thrown if the object can't be instantiatedNoSuchMethodException
- thrown if there is no constructor found for the given argumentsInstantiationException
- thrown if the object can't be instantiatedIllegalAccessException
- thrown if the object can't be instantiatedInvocationTargetException
- thrown if the object can't be instantiated- Since:
- POI 3.14-Beta1
-
getDescriptor
returns the descriptor for the given relationship type- Parameters:
relationshipType
- the relationship type of the descriptor- Returns:
- the descriptor or null if type is unknown
- Since:
- POI 3.14-Beta1
-
newDocumentPart
Create a new POIXMLDocumentPart using the supplied descriptor. This method is used when adding new parts to a document, for example, when adding a sheet to a workbook, slide to a presentation, etc.- Parameters:
descriptor
- describes the object to create- Returns:
- A new instance of a POIXMLDocumentPart.
-
getPackageRelationship
Retrieves the package relationship of the child part within the parent- Parameters:
parent
- the parent to search for the partpart
- the part to look for- Returns:
- the relationship
- Throws:
POIXMLException
- if the relations are erroneous or the part is not related- Since:
- POI 3.14-Beta1
-