Revision: 17516
http://sourceforge.net/p/gate/code/17516
Author: markagreenwood
Date: 2014-03-03 18:18:22 +0000 (Mon, 03 Mar 2014)
Log Message:
-----------
tided up the generics and removedthe namespace from the serialized state as it
is only needed during the reading of an XML schema file, so now it is just
passed through the method chain as a param, which should fix the final findbugs
warning which would mean there shouldn't be a single build warning left in
jenkins :)
Modified Paths:
--------------
gate/trunk/src/main/gate/creole/AnnotationSchema.java
Modified: gate/trunk/src/main/gate/creole/AnnotationSchema.java
===================================================================
--- gate/trunk/src/main/gate/creole/AnnotationSchema.java 2014-03-03
18:05:30 UTC (rev 17515)
+++ gate/trunk/src/main/gate/creole/AnnotationSchema.java 2014-03-03
18:18:22 UTC (rev 17516)
@@ -41,11 +41,11 @@
*/
@CreoleResource(name="Annotation Schema", comment="An annotation type and its
features.", helpURL="http://gate.ac.uk/userguide/sec:corpora:schemas")
public class AnnotationSchema extends AbstractLanguageResource{
+
+ private static final long serialVersionUID = 3499202938128514949L;
+
public static final String FILE_URL_PARAM_NAME = "xmlFileUrl";
- /** Debug flag */
- private static final boolean DEBUG = false;
-
/** A map between XSchema types and Java Types */
private static Map<String, Class<?>> xSchema2JavaMap;
@@ -147,11 +147,6 @@
/** The xml file URL of the resource */
protected URL xmlFileUrl;
-
- /**
- * The namepsace used in the xml file
- */
- protected Namespace namespace;
private transient AnnotationSchema lastIncluded = null;
@@ -210,19 +205,19 @@
private void workWithJDom(org.jdom.Document jDom) throws
ResourceInstantiationException {
// Use the jDom structure the way we want
org.jdom.Element rootElement = jDom.getRootElement();
- namespace = rootElement.getNamespace();
+ Namespace namespace = rootElement.getNamespace();
// get all children elements from the rootElement
- List rootElementChildrenList =
+ List<?> rootElementChildrenList =
rootElement.getChildren("element", namespace);
if(rootElementChildrenList.size() > 1)
throw new ResourceInstantiationException(
"Each Annotation must be defined in a separate XML Schema file");
- Iterator rootElementChildrenIterator = rootElementChildrenList.iterator();
+ Iterator<?> rootElementChildrenIterator =
rootElementChildrenList.iterator();
while(rootElementChildrenIterator.hasNext()) {
org.jdom.Element childElement =
(org.jdom.Element)rootElementChildrenIterator.next();
- createAnnotationSchemaObject(childElement);
+ createAnnotationSchemaObject(childElement, namespace);
}// end while
rootElementChildrenList = rootElement.getChildren("include", namespace);
@@ -248,7 +243,7 @@
/** This method creates an AnnotationSchema object fom an org.jdom.Element
* @param anElement is an XSchema element element
*/
- private void createAnnotationSchemaObject(org.jdom.Element anElement){
+ private void createAnnotationSchemaObject(org.jdom.Element anElement,
Namespace namespace){
// Get the value of the name attribute. If this attribute doesn't exists
// then it will receive a default one.
annotationName = anElement.getAttributeValue("name");
@@ -258,15 +253,15 @@
org.jdom.Element complexTypeElement = anElement.getChild("complexType",
namespace);
if (complexTypeElement != null){
- List complexTypeCildrenList = complexTypeElement.getChildren("attribute",
+ List<?> complexTypeCildrenList =
complexTypeElement.getChildren("attribute",
namespace);
- Iterator complexTypeCildrenIterator = complexTypeCildrenList.iterator();
+ Iterator<?> complexTypeCildrenIterator =
complexTypeCildrenList.iterator();
if (complexTypeCildrenIterator.hasNext())
featureSchemaSet = new LinkedHashSet<FeatureSchema>();
while (complexTypeCildrenIterator.hasNext()) {
org.jdom.Element childElement =
(org.jdom.Element) complexTypeCildrenIterator.next();
- createAndAddFeatureSchemaObject(childElement);
+ createAndAddFeatureSchemaObject(childElement, namespace);
}// end while
}// end if
} // createAnnoatationSchemaObject
@@ -276,12 +271,12 @@
* @param anAttributeElement is an XSchema attribute element
*/
public void createAndAddFeatureSchemaObject(org.jdom.Element
- anAttributeElement) {
+ anAttributeElement,
Namespace namespace) {
String featureName = null;
Class<?> featureType = null;
String featureUse = null;
String featureValue = null;
- Set featurePermittedValuesSet = null;
+ Set<String> featurePermittedValuesSet = null;
// Get the value of the name attribute. If this attribute doesn't exists
// then it will receive a default one.
@@ -324,15 +319,15 @@
featureType = xSchema2JavaMap.get(featureTypeName);
// Check to see if there are any enumeration elements inside
- List enumerationElementChildrenList =
+ List<?> enumerationElementChildrenList =
restrictionElement.getChildren("enumeration",
namespace);
- Iterator enumerationChildrenIterator =
+ Iterator<?> enumerationChildrenIterator =
enumerationElementChildrenList.iterator();
// Check if there is any enumeration element in the list
if (enumerationChildrenIterator.hasNext())
- featurePermittedValuesSet = new HashSet();
+ featurePermittedValuesSet = new HashSet<String>();
while (enumerationChildrenIterator.hasNext()) {
org.jdom.Element enumerationElement =
(org.jdom.Element) enumerationChildrenIterator.next();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs