public Optional<XmlAttribute> getPackage() { Optional<XmlAttribute> packageAttribute = getRootNode().getAttribute(XmlNode.fromXmlName("package")); return packageAttribute.isPresent() ? packageAttribute : getRootNode().getAttribute(XmlNode.fromNSName( SdkConstants.ANDROID_URI, "android", "package")); }
private static Optional<String> checkAttributes( @NonNull XmlElement expected, @NonNull XmlElement actual) { for (XmlAttribute expectedAttr : expected.getAttributes()) { XmlAttribute.NodeName attributeName = expectedAttr.getName(); if (attributeName.isInNamespace(SdkConstants.TOOLS_URI)) { continue; } Optional<XmlAttribute> actualAttr = actual.getAttribute(attributeName); if (actualAttr.isPresent()) { if (!expectedAttr.getValue().equals(actualAttr.get().getValue())) { return Optional.of( String.format("Attribute %1$s do not match: %2$s versus %3$s at %4$s", expectedAttr.getId(), expectedAttr.getValue(), actualAttr.get().getValue(), actual.printPosition())); } } else { return Optional.of(String.format("Attribute %1$s not found at %2$s", expectedAttr.getId(), actual.printPosition())); } } return Optional.absent(); }
.getAttribute(attributeOperationTypeEntry.getKey()); switch(attributeOperationTypeEntry.getValue()) { case STRICT:
higherPriorityElement.getAttribute(getName());
Optional<XmlAttribute> myAttribute = getAttribute(attributeModel.getName()); if (myAttribute.isPresent()) { myAttribute.get().mergeWithLowerPriorityDefaultValue(
/** * Returns the minSdk version specified in the uses_sdk element if present or the * default value. */ @NonNull private String getRawMinSdkVersion() { Optional<XmlElement> usesSdk = getByTypeAndKey( ManifestModel.NodeTypes.USES_SDK, null); if (usesSdk.isPresent()) { Optional<XmlAttribute> minSdkVersion = usesSdk.get() .getAttribute(XmlNode.fromXmlName("android:minSdkVersion")); if (minSdkVersion.isPresent()) { return minSdkVersion.get().getValue(); } } return DEFAULT_SDK_VERSION; }
/** * Returns the targetSdk version specified in the uses_sdk element if present or the * default value. */ @NonNull private String getRawTargetSdkVersion() { Optional<XmlElement> usesSdk = getByTypeAndKey( ManifestModel.NodeTypes.USES_SDK, null); if (usesSdk.isPresent()) { Optional<XmlAttribute> targetSdkVersion = usesSdk.get() .getAttribute(XmlNode.fromXmlName("android:targetSdkVersion")); if (targetSdkVersion.isPresent()) { return targetSdkVersion.get().getValue(); } } return getRawMinSdkVersion(); }
AndroidManifest.ATTRIBUTE_GLESVERSION); mergingReport.getActionRecorder().recordAttributeAction( glEsVersionDeclaration.getValue().getAttribute(XmlNode.fromXmlName( "android:" + AndroidManifest.ATTRIBUTE_GLESVERSION)).get(), Actions.ActionType.REJECTED,