cuốn sách gpt4 ai đã làm

Ví dụ về cách sử dụng và mã của phương thức uk.co.real_logic.sbe.xml.XmlSchemaParser.getAttributionValueOrNull()

In lại Tác giả: Người biết Thời gian cập nhật: 24-03-2024 03:37:05 28 4
mua khóa gpt4 Nike

Bài viết này tổ chức Javauk.co.real_logic.sbe.xml.XmlSchemaParser.getAttributionValueOrNull()Một số mã ví dụ về các phương thức, hiển thịXmlSchemaParser.getAttributionValueOrNull()cách sử dụng cụ thể. Các ví dụ mã này chủ yếu đến từGithub/tràn ngăn xếp/MavenCác nền tảng như thế này là các mã được trích xuất từ ​​một số dự án được chọn. Chúng có ý nghĩa tham khảo mạnh mẽ và có thể giúp bạn ở một mức độ nhất định.XmlSchemaParser.getAttributionValueOrNull()Chi tiết cụ thể của phương pháp như sau:
Đường dẫn gói: uk.co.real_logic.sbe.xml.XmlSchemaParser
Tên lớp: XmlSchemaParser
Tên phương thức: getAttributionValueOrNull

Giới thiệu về XmlSchemaParser.getAttributionValueOrNull

[Tiếng Anh]Hàm trợ giúp ẩn kết quả trả về null từ org.w3c.dom.NamedNodeMap#getNamedItem(String)
[Trung bình]Hàm trợ giúp, được sử dụng để ẩn giá trị null được tổ chức trả về. w3c. Dom. NamedNodeMap#getNamedItem(Chuỗi)

ví dụ về mã

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

riêng tư tĩnh Định dạng chuỗiLocationInfo(nút nút cuối cùng) { Nút cuối cùng parentNode = node.getParentNode(); return "at " + "<" + parentNode.getNodeName() + (getAttributionValueOrNull(parentNode, "name") == null ? "> " : (" name=\"" + getAttributionValueOrNull(parentNode, "name") + "\"> ")) + "<" + node.getNodeName() + (getAttributionValueOrNull(node, "name") == null ? ">" : (" name=\"" + getAttributionValueOrNull(node, "name") + "\"> ") }

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

public MessageSchema( nút cuối cùng lược đồNode, bản đồ cuối cùng typeByNameMap, bản đồ cuối cùng messageByIdMap) { this.packageName = getAttributionValue(schemaNode, "package"); ); cái này.id = Integer.parseInt(getAttributionValue(schemaNode, "id")); this.version = Integer.parseInt(getAttributionValue(schemaNode, "version", "0")); this.semanticVersion = getAttributionValueOrNull(schemaNode, "semanticVersion"); .byteOrder = getByteOrder(getAttributionValue(schemaNode, "byteOrder", "littleEndian")); this.typeByNameMap = typeByNameMap; this.messageByIdMap = messageByIdMap; Chuỗi cuối cùng headerType = getAttributionValueOrNull(schemaNode, "headerType"); hiện tại(typeByNameMap, this.headerType, "Tiêu đề thư"); ((CompositeType)typeByNameMap.get(this.headerType)).checkForWellFormedMessageHeader(schemaNode);

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

Sự hiện diện tĩnh riêng tư getPresence(nút Nút cuối cùng, Loại trường cuối cùng) { Chuỗi hiện diện cuối cùngStr = getAttributionValueOrNull(node, "presence"); if (null != fieldType) { hiện diện = fieldType.presence(); } else { hiện diện = Hiện diện.REQUIRED; } trả lại sự hiện diện }

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

/** * Xây dựng một Giá trị hợp lệ dựa trên nút XML và nút mã hóa Loại mã hóa có chứa giá trị hợp lệ * @param mã hóa cho enum */ public ValidValue(nút nút cuối cùng, kiểu mã hóa PrimitiveType cuối cùng) { name = getAttributionValue(node) , "tên"); mô tả = getAttributionValueOrNull(nút, giá trị "mô tả"); PrimitiveValue.parse(node.getFirstChild().getNodeValue(), EncodingType); kể từVersion = Integer.parseInt(getAttributionValue(node, "sinceVersion", "0")); không dùng nữa = Integer.parseInt(getAttributionValue(node, "không dùng nữa" , "0")); checkForValidName(nút, tên);

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

/** * Xây dựng một Loại mới từ Lược đồ XML Được gọi bởi các lớp con để đặt hầu hết các trường chung * * @param nút từ Phân tích cú pháp Lược đồ XML * @param GivenName của nút này, nếu null thì tên được phân bổ sẽ được sử dụng. param referencedName của loại khi được tạo từ một ref trong một tổ hợp */ public Type(nút Node cuối cùng, Chuỗi cuối cùng được đưa ra, Chuỗi cuối cùng được tham chiếu) { if (null == GivenName) { name = getAttributionValue(node, "name"); } else { name = GivenName; } this.referencedName = referencedName; sự hiện diện = Presence.get(getAttributionValue(node, "hiện diện", "bắt buộc") mô tả = getAttributionValueOrNull(node, " description"); kể từ đóVersion = Integer.parseInt(getAttributionValue(node, "sinceVersion", "0")); không dùng nữa = Integer.parseInt(getAttributionValue(node, "không dùng nữa", "0")); ngữ nghĩaType = getAttributionValueOrNull(node, "semanticType"); , "-1")); }

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

/** * Xây dựng một thông báo mới từ Lược đồ XML String, Type> typeByNameMap) ném XPathExpressionException { id = Integer.parseInt(getAttributionValue(messageNode, "id")); // tên bắt buộc = getAttributionValue(messageNode, "name"); // mô tả bắt buộc = getAttributionValueOrNull(messageNode, "description"); // tùy chọn blockLength = Integer.parseInt (getAttributionValue(messageNode, "blockLength", "0")); // 0 có nghĩa là không được đặt kể từVersion = Integer.parseInt(getAttributionValue(messageNode, "sinceVersion", "0")); không dùng nữa = Integer.parseInt(getAttributionValue(messageNode, "deprecated", "0")); ngữ nghĩaType = getAttributionValueOrNull(messageNode, " ngữ nghĩaType"); // tùy chọn this.typeByNameMap = typeByNameMap; fieldList = parseMembers(messageNode); tínhAndValidateOffsets(messageNode, fieldList, blockLength);

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

/** * Xây dựng một Lựa chọn dựa trên nút XML và Loại mã hóa * * nút @param chứa giá trị hợp lệ * @param mã hóa Loại cho enum */ public Choice(nút Nút cuối cùng, Loại mã hóa PrimitiveType cuối cùng) { name = getAttributionValue(node, "tên"); mô tả = getAttributionValueOrNull(nút, "mô tả"); PrimitiveValue.parse(node.getFirstChild().getNodeValue(), EncodingType); kể từVersion = Integer.parseInt(getAttributionValue(node, "sinceVersion", "0")); không dùng nữa = Integer.parseInt(getAttributionValue(node, "không dùng nữa" , "0")); // giá trị lựa chọn là vị trí bit (0, 1, 2, 3, 4, v.v.) từ LSB sang MSB if (value.longValue() >= (encodingType.size() * 8)) { ném IllegalArgumentException mới("Giá trị lựa chọn ngoài giới hạn: " + value.longValue()) ; } checkForValidName(nút, tên });

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

chuỗi cuối cùng lengthAttr = getAttributionValueOrNull(node, "length"); length = Integer.parseInt(null == lengthAttr ? "1" : lengthAttr); varLen = Boolean.parseBoolean(getAttributionValue(node, "variableLength", "false")) ; valueRef = getAttributionValueOrNull(node, "valueRef"); characterEncoding = getAttributionValueOrNull(node, "characterEncoding"); this.characterEncoding = characterEncoding == null : characterEncoding.trim().toUpperCase(); Chuỗi cuối cùng minValStr = getAttributionValueOrNull(node, "minValue"); null ? PrimitiveValue.parse(minValStr, PrimitiveType): Chuỗi cuối cùng maxValStr = getAttributionValueOrNull(node, "maxValue"); maxValue = maxValStr != null ? PrimitiveValue.parse(maxValStr,primitiveType): null; Chuỗi cuối cùng nullValStr = getAttributionValueOrNull(node, "nullValue");

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

riêng tư Trường phân tích cú pháp (cuối cùng NodeList nodeList, cuối cùng int nodeIndex) { nút cuối cùng = nodeList.item(nodeIndex); Chuỗi cuối cùng typeName = getAttributionValue(node, "type"); fieldType == null) { handError(node, "không thể tìm thấy loại: " + typeName); } Trường trường cuối cùng = Field.Builder() mới .name(getAttributionValue(node, "name")) .description(getAttributionValueOrNull(node, "description")) .id(Integer.parseInt(getAttributionValue(node, "id"))) .offset(Integer.parseInt(getAttributionValue( nút, "bù", "0"))) .semanticType(getAttributionValueOrNull(node, "semanticType")) .presence(getPresence(node, fieldType)) .valueRef(getAttributionValueOrNull(node, "valueRef")) .sinceVersion(Integer.parseInt(getAttributionValue(node, "sinceVersion", " 0"))) .deprecated(Integer.parseInt(getAttributionValue(node, "không dùng nữa", "0"))) .epoch(getAttributionValueOrNull(node, "epoch")) .timeUnit(getAttributionValueOrNull(node, "timeUnit")) .type(fieldType) .build(); field.validate(node, typeByNameMap); cánh đồng; }

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

if ("tùy chọn".equals(getAttributionValueOrNull(nút, "hiện diện")))

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

Chuỗi cuối cùng nullValueStr = getAttributionValueOrNull(node, "nullValue"); if (null != nullValueStr)

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

.description(getAttributionValueOrNull(node, "description")) .id(Integer.parseInt(getAttributionValue(node, "id"))) .blockLength(Integer.parseInt(getAttributionValue(node, "blockLength", "0")))

Nguồn mẫu mã:nguồn gốc: logic thực/mã hóa nhị phân đơn giản

.description(getAttributionValueOrNull(node, "description")) .id(Integer.parseInt(getAttributionValue(node, "id"))) .offset(Integer.parseInt(getAttributionValue(node, "offset", "0"))) .semanticType(getAttributionValueOrNull(node, "semanticType")) .presence(Presence.get(getAttributionValue(node, "presence", "required"))) .sinceVersion(Integer.parseInt(getAttributionValue(node, "sinceVersion", "0")))

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe-all

riêng tư tĩnh Định dạng chuỗiLocationInfo(nút nút cuối cùng) { Nút cuối cùng parentNode = node.getParentNode(); return "at " + "<" + parentNode.getNodeName() + (getAttributionValueOrNull(parentNode, "name") == null ? "> " : (" name=\"" + getAttributionValueOrNull(parentNode, "name") + "\"> ")) + "<" + node.getNodeName() + (getAttributionValueOrNull(node, "name") == null ? ">" : (" name=\"" + getAttributionValueOrNull(node, "name") + "\"> ") }

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe

riêng tư tĩnh Định dạng chuỗiLocationInfo(nút nút cuối cùng) { Nút cuối cùng parentNode = node.getParentNode(); return "at " + "<" + parentNode.getNodeName() + (getAttributionValueOrNull(parentNode, "name") == null ? "> " : (" name=\"" + getAttributionValueOrNull(parentNode, "name") + "\"> ")) + "<" + node.getNodeName() + (getAttributionValueOrNull(node, "name") == null ? ">" : (" name=\"" + getAttributionValueOrNull(node, "name") + "\"> ") }

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe-tool

riêng tư tĩnh Định dạng chuỗiLocationInfo(nút nút cuối cùng) { Nút cuối cùng parentNode = node.getParentNode(); return "at " + "<" + parentNode.getNodeName() + (getAttributionValueOrNull(parentNode, "name") == null ? "> " : (" name=\"" + getAttributionValueOrNull(parentNode, "name") + "\"> ")) + "<" + node.getNodeName() + (getAttributionValueOrNull(node, "name") == null ? ">" : (" name=\"" + getAttributionValueOrNull(node, "name") + "\"> ") }

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe

/** * Xây dựng một Loại mới từ Lược đồ XML Được các lớp con gọi để thiết lập hầu hết các trường chung * * nút @param từ Phân tích cú pháp Lược đồ XML */ Loại công khai (nút nút cuối cùng) { name = getAttributionValue(node, "name") ; hiện diện = Hiện diện.get(getAttributionValue(nút, "hiện diện", "bắt buộc")); mô tả = getAttributionValueOrNull(nút, "mô tả"); ngữ nghĩaType = getAttributionValueOrNull(node, "semanticType");

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe

/** * Xây dựng một Giá trị hợp lệ dựa trên nút XML và nút mã hóa Loại mã hóa có chứa giá trị hợp lệ * @param mã hóa cho enum */ public ValidValue(nút nút cuối cùng, kiểu mã hóa PrimitiveType cuối cùng) { name = getAttributionValue(node) , "tên"); mô tả = getAttributionValueOrNull(nút, giá trị "mô tả"); PrimitiveValue.parse(node.getFirstChild().getNodeValue(), EncodingType); kể từVersion = Integer.parseInt(getAttributionValue(node, "sinceVersion", "0"));

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe-all

/** * Xây dựng một Giá trị hợp lệ dựa trên nút XML và nút mã hóa Loại mã hóa có chứa giá trị hợp lệ * @param mã hóa cho enum */ public ValidValue(nút nút cuối cùng, kiểu mã hóa PrimitiveType cuối cùng) { name = getAttributionValue(node) , "tên"); mô tả = getAttributionValueOrNull(nút, giá trị "mô tả"); PrimitiveValue.parse(node.getFirstChild().getNodeValue(), EncodingType); kể từVersion = Integer.parseInt(getAttributionValue(node, "sinceVersion", "0")); không dùng nữa = Integer.parseInt(getAttributionValue(node, "không dùng nữa" , "0")); checkForValidName(nút, tên);

Nguồn mẫu mã:nguồn gốc: uk.co.real-logic/sbe-tool

/** * Xây dựng một Giá trị hợp lệ dựa trên nút XML và nút mã hóa Loại mã hóa có chứa giá trị hợp lệ * @param mã hóa cho enum */ public ValidValue(nút nút cuối cùng, kiểu mã hóa PrimitiveType cuối cùng) { name = getAttributionValue(node) , "tên"); mô tả = getAttributionValueOrNull(nút, giá trị "mô tả"); PrimitiveValue.parse(node.getFirstChild().getNodeValue(), EncodingType); kể từVersion = Integer.parseInt(getAttributionValue(node, "sinceVersion", "0")); không dùng nữa = Integer.parseInt(getAttributionValue(node, "không dùng nữa" , "0")); checkForValidName(nút, tên);
28 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress