remove some deprecated code

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2020-07-15 21:53:21 +00:00
parent 6508360899
commit eaf9f147d3
5 changed files with 11 additions and 168 deletions

View File

@ -273,21 +273,6 @@ public final class ExtractorFactory {
return (T)OLE2ExtractorFactory.createExtractor(poifsDir); return (T)OLE2ExtractorFactory.createExtractor(poifsDir);
} }
/**
* Returns an array of text extractors, one for each of
* the embedded documents in the file (if there are any).
* If there are no embedded documents, you'll get back an
* empty array. Otherwise, you'll get one open
* {@link POITextExtractor} for each embedded file.
*
* @deprecated Use the method with correct "embedded"
*/
@Deprecated
@Removal(version="4.2")
public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext) throws IOException, OpenXML4JException, XmlException {
return getEmbeddedDocsTextExtractors(ext);
}
/** /**
* Returns an array of text extractors, one for each of * Returns an array of text extractors, one for each of
* the embedded documents in the file (if there are any). * the embedded documents in the file (if there are any).
@ -351,23 +336,6 @@ public final class ExtractorFactory {
return textExtractors.toArray(new POITextExtractor[0]); return textExtractors.toArray(new POITextExtractor[0]);
} }
/**
* Returns an array of text extractors, one for each of
* the embedded documents in the file (if there are any).
* If there are no embedded documents, you'll get back an
* empty array. Otherwise, you'll get one open
* {@link POITextExtractor} for each embedded file.
*
* @deprecated Use the method with correct "embedded"
*/
@Deprecated
@Removal(version="4.2")
@NotImplemented
@SuppressWarnings({"UnusedParameters", "UnusedReturnValue"})
public static POITextExtractor[] getEmbededDocsTextExtractors(POIXMLTextExtractor ext) {
return getEmbeddedDocsTextExtractors(ext);
}
/** /**
* Returns an array of text extractors, one for each of * Returns an array of text extractors, one for each of
* the embedded documents in the file (if there are any). * the embedded documents in the file (if there are any).

View File

@ -1,77 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.openxml4j.util;
import org.apache.poi.util.Removal;
/**
* An immutable object that could be defined as null.
*
* @author Julien Chable
* @version 0.9
* @deprecated No longer used in POI code base, use {@link java.util.Optional} instead
*/
@Removal(version = "4.2")
@Deprecated
public final class Nullable<E> {
private E value;
/**
* Constructor.
*/
public Nullable() {
// Do nothing
}
/**
* Constructor.
*
* @param value
* The value to set to this nullable.
*/
public Nullable(E value) {
this.value = value;
}
/**
* Get the store value if any.
*
* @return the store value
*/
public E getValue() {
return value;
}
/**
* Get the status of this nullable.
*
* @return <b>true</b> if the nullable store a value (empty string is
* considered to be a value) else <b>false</>.
*/
public boolean hasValue() {
return value != null;
}
/**
* Set the stored value to <i>null</i>.
*/
public void nullify() {
value = null;
}
}

View File

@ -29,7 +29,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.util.Removal;
import org.apache.poi.util.XMLHelper; import org.apache.poi.util.XMLHelper;
import org.apache.poi.xssf.model.SharedStrings; import org.apache.poi.xssf.model.SharedStrings;
import org.apache.poi.xssf.usermodel.XSSFRelation; import org.apache.poi.xssf.usermodel.XSSFRelation;
@ -204,36 +203,9 @@ public class ReadOnlySharedStringsTable extends DefaultHandler implements Shared
return this.uniqueCount; return this.uniqueCount;
} }
/**
* Return the string at a given index.
* Formatting is ignored.
*
* @param idx index of item to return.
* @return the item at the specified position in this Shared String table.
* @deprecated use <code>getItemAt</code> instead
*/
@Removal(version = "4.2")
@Deprecated
public String getEntryAt(int idx) {
return strings.get(idx);
}
/**
* Returns all the strings.
* Formatting is ignored.
*
* @return a list with all the strings
* @deprecated use <code>getItemAt</code> instead
*/
@Removal(version = "4.2")
@Deprecated
public List<String> getItems() {
return strings;
}
@Override @Override
public RichTextString getItemAt(int idx) { public RichTextString getItemAt(int idx) {
return new XSSFRichTextString(getEntryAt(idx)); return new XSSFRichTextString(strings.get(idx));
} }
//// ContentHandler methods //// //// ContentHandler methods ////

View File

@ -139,18 +139,6 @@ public class SharedStringsTable extends POIXMLDocumentPart implements SharedStri
return st.xmlText(options); return st.xmlText(options);
} }
/**
* Return a string item by index
*
* @param idx index of item to return.
* @return the item at the specified position in this Shared String table.
* @deprecated use <code>getItemAt(int idx)</code> instead
*/
@Removal(version = "4.2")
public CTRst getEntryAt(int idx) {
return strings.get(idx);
}
/** /**
* Return a string item by index * Return a string item by index
* *
@ -197,8 +185,7 @@ public class SharedStringsTable extends POIXMLDocumentPart implements SharedStri
* @return index the index of added entry * @return index the index of added entry
* @deprecated use <code>addSharedStringItem(RichTextString string)</code> instead * @deprecated use <code>addSharedStringItem(RichTextString string)</code> instead
*/ */
@Removal(version = "4.2") //make private in 4.2 private int addEntry(CTRst st) {
public int addEntry(CTRst st) {
String s = xmlText(st); String s = xmlText(st);
count++; count++;
if (stmap.containsKey(s)) { if (stmap.containsKey(s)) {
@ -234,17 +221,6 @@ public class SharedStringsTable extends POIXMLDocumentPart implements SharedStri
return addEntry(((XSSFRichTextString) string).getCTRst()); return addEntry(((XSSFRichTextString) string).getCTRst());
} }
/**
* Provide low-level access to the underlying array of CTRst beans
*
* @return array of CTRst beans
* @deprecated use <code>getSharedStringItems</code> instead
*/
@Removal(version = "4.2")
public List<CTRst> getItems() {
return Collections.unmodifiableList(strings);
}
/** /**
* Provide access to the strings in the SharedStringsTable * Provide access to the strings in the SharedStringsTable
* *

View File

@ -376,7 +376,7 @@ public final class XSSFCell extends CellBase {
if (_cell.isSetV()) { if (_cell.isSetV()) {
try { try {
int idx = Integer.parseInt(_cell.getV()); int idx = Integer.parseInt(_cell.getV());
rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(idx)); rt = (XSSFRichTextString)_sharedStringSource.getItemAt(idx);
} catch(Throwable t) { } catch(Throwable t) {
rt = new XSSFRichTextString(""); rt = new XSSFRichTextString("");
} }
@ -1156,7 +1156,7 @@ public final class XSSFCell extends CellBase {
return TRUE_AS_STRING.equals(_cell.getV()); return TRUE_AS_STRING.equals(_cell.getV());
case STRING: case STRING:
int sstIndex = Integer.parseInt(_cell.getV()); int sstIndex = Integer.parseInt(_cell.getV());
XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex)); RichTextString rt = _sharedStringSource.getItemAt(sstIndex);
String text = rt.getString(); String text = rt.getString();
return Boolean.parseBoolean(text); return Boolean.parseBoolean(text);
case NUMERIC: case NUMERIC:
@ -1181,9 +1181,13 @@ public final class XSSFCell extends CellBase {
case BOOLEAN: case BOOLEAN:
return TRUE_AS_STRING.equals(_cell.getV()) ? TRUE : FALSE; return TRUE_AS_STRING.equals(_cell.getV()) ? TRUE : FALSE;
case STRING: case STRING:
int sstIndex = Integer.parseInt(_cell.getV()); try {
XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex)); int sstIndex = Integer.parseInt(_cell.getV());
return rt.getString(); RichTextString rt = _sharedStringSource.getItemAt(sstIndex);
return rt.getString();
} catch (Throwable t) {
return "";
}
case NUMERIC: case NUMERIC:
case ERROR: case ERROR:
return _cell.getV(); return _cell.getV();