diff options
author | Sundong Ahn <sundongahn@google.com> | 2019-03-14 20:30:52 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-14 20:30:52 -0700 |
commit | 9a9ed5c9cc13ca3e43b4da6a02cf8946ed968ac4 (patch) | |
tree | 229015e4b485b09bdceb032823ab47964800bc5b | |
parent | 5838628760e4fef0136d04ea46b74f576bcc75e0 (diff) | |
parent | bc6ae7d8f5a9d4c00a4c439a59e326d3852c4ba6 (diff) | |
download | xsdc-9a9ed5c9cc13ca3e43b4da6a02cf8946ed968ac4.tar.gz |
Change setDeprecated to generic am: ff5e8b5b38 am: 89574573ec
am: bc6ae7d8f5
Change-Id: I97d51d58d6e85a1af9541168ffd4a16fb162211d
-rw-r--r-- | src/com/android/xsdc/XsdHandler.java | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/src/com/android/xsdc/XsdHandler.java b/src/com/android/xsdc/XsdHandler.java index aa5509b..e0b795e 100644 --- a/src/com/android/xsdc/XsdHandler.java +++ b/src/com/android/xsdc/XsdHandler.java @@ -274,8 +274,7 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdElement)setDeprecated(new XsdElement(name, ref, type, multiple), - state.deprecated); + return setDeprecated(new XsdElement(name, ref, type, multiple), state.deprecated); } private XsdAttribute makeAttribute(State state) throws XsdParserException { @@ -298,7 +297,7 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdAttribute)setDeprecated(new XsdAttribute(name, ref, type), state.deprecated); + return setDeprecated(new XsdAttribute(name, ref, type), state.deprecated); } private XsdComplexType makeComplexType(State state) throws XsdParserException { @@ -325,18 +324,17 @@ public class XsdHandler extends DefaultHandler { elements.add((XsdElement) tag); } else if (tag instanceof XsdComplexContent) { XsdComplexContent child = (XsdComplexContent) tag; - type = (XsdComplexContent)setDeprecated(new XsdComplexContent(name, - child.getBase(), child.getAttributes(), child.getElements()), - state.deprecated); + type = setDeprecated(new XsdComplexContent(name, child.getBase(), + child.getAttributes(), child.getElements()), state.deprecated); } else if (tag instanceof XsdSimpleContent) { XsdSimpleContent child = (XsdSimpleContent) tag; - type = (XsdSimpleContent)setDeprecated(new XsdSimpleContent(name, child.getBase(), - child.getAttributes()), state.deprecated); + type = setDeprecated(new XsdSimpleContent(name, child.getBase(), + child.getAttributes()), state.deprecated); } } - return (type != null) ? type : (XsdComplexContent)setDeprecated(new XsdComplexContent(name, - null, attributes, elements), state.deprecated); + return (type != null) ? type : setDeprecated(new XsdComplexContent(name, null, attributes, + elements), state.deprecated); } private XsdComplexContent makeComplexContent(State state) throws XsdParserException { @@ -367,7 +365,7 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdComplexContent)setDeprecated(content, state.deprecated); + return setDeprecated(content, state.deprecated); } private XsdSimpleContent makeSimpleContent(State state) { @@ -385,7 +383,7 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdSimpleContent)setDeprecated(content, state.deprecated); + return setDeprecated(content, state.deprecated); } private XsdGeneralRestriction makeGeneralRestriction(State state) throws XsdParserException { @@ -406,8 +404,8 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdGeneralRestriction)setDeprecated(new XsdGeneralRestriction(type, attributes, - elements), state.deprecated); + return setDeprecated(new XsdGeneralRestriction(type, attributes, elements), + state.deprecated); } private XsdGeneralExtension makeGeneralExtension(State state) throws XsdParserException { @@ -423,8 +421,8 @@ public class XsdHandler extends DefaultHandler { elements.add((XsdElement) tag); } } - return (XsdGeneralExtension)setDeprecated(new XsdGeneralExtension(new XsdType(null, base), - attributes, elements), state.deprecated); + return setDeprecated(new XsdGeneralExtension(new XsdType(null, base), attributes, elements), + state.deprecated); } private XsdSimpleType makeSimpleType(State state) throws XsdParserException { @@ -443,7 +441,7 @@ public class XsdHandler extends DefaultHandler { type = new XsdUnion(name, ((XsdUnion) tag).getMemberTypes()); } } - return (XsdSimpleType)setDeprecated(type, state.deprecated); + return setDeprecated(type, state.deprecated); } private XsdList makeSimpleTypeList(State state) throws XsdParserException { @@ -459,7 +457,7 @@ public class XsdHandler extends DefaultHandler { itemType = (XsdType) tag; } } - return (XsdList)setDeprecated(new XsdList(null, itemType), state.deprecated); + return setDeprecated(new XsdList(null, itemType), state.deprecated); } private XsdUnion makeSimpleTypeUnion(State state) throws XsdParserException { @@ -474,7 +472,7 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdUnion)setDeprecated(new XsdUnion(null, memberTypes), state.deprecated); + return setDeprecated(new XsdUnion(null, memberTypes), state.deprecated); } private static List<XsdElement> makeSequence(State state) throws XsdParserException { @@ -502,9 +500,8 @@ public class XsdHandler extends DefaultHandler { if (tag == null) continue; if (tag instanceof XsdElement) { XsdElement element = (XsdElement)tag; - elements.add((XsdChoice)setDeprecated(new XsdChoice(element.getName(), - element.getRef(), element.getType(), element.isMultiple()), - element.isDeprecated())); + elements.add(setDeprecated(new XsdChoice(element.getName(), element.getRef(), + element.getType(), element.isMultiple()), element.isDeprecated())); } } return elements; @@ -516,9 +513,8 @@ public class XsdHandler extends DefaultHandler { if (tag == null) continue; if (tag instanceof XsdElement) { XsdElement element = (XsdElement)tag; - elements.add((XsdAll)setDeprecated(new XsdAll(element.getName(), - element.getRef(), element.getType(), element.isMultiple()), - element.isDeprecated())); + elements.add(setDeprecated(new XsdAll(element.getName(), element.getRef(), + element.getType(), element.isMultiple()), element.isDeprecated())); } } return elements; @@ -526,7 +522,7 @@ public class XsdHandler extends DefaultHandler { private XsdEnumeration makeEnumeration(State state) throws XsdParserException { String value = state.attributeMap.get("value"); - return (XsdEnumeration)setDeprecated(new XsdEnumeration(value), state.deprecated); + return setDeprecated(new XsdEnumeration(value), state.deprecated); } private XsdEnumRestriction makeEnumRestriction(State state) throws XsdParserException { @@ -544,8 +540,7 @@ public class XsdHandler extends DefaultHandler { } } - return (XsdEnumRestriction)setDeprecated(new XsdEnumRestriction(type, enums), - state.deprecated); + return setDeprecated(new XsdEnumRestriction(type, enums), state.deprecated); } private boolean isDeprecated(Map<String, String> attributeMap,List<XsdTag> tags) @@ -557,7 +552,7 @@ public class XsdHandler extends DefaultHandler { return false; } - private static XsdTag setDeprecated(XsdTag tag, boolean deprecated) { + private static <T extends XsdTag> T setDeprecated(T tag, boolean deprecated) { if (tag != null) { tag.setDeprecated(deprecated); } |