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.getAttributionValue()

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

Bài viết này tổ chức Javauk.co.real_logic.sbe.xml.XmlSchemaParser.getAttributionValue()Một số mã ví dụ về các phương thức, hiển thịXmlSchemaParser.getAttributionValue()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.getAttributionValue()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: getAttributionValue

Giới thiệu về XmlSchemaParser.getAttributionValue

[Tiếng Anh]Hàm trợ giúp đưa ra ngoại lệ khi thuộc tính không được đặt.
[Trung bình] Hàm trợ giúp đưa ra ngoại lệ khi thuộc tính không được đặt.

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

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

/** * Xây dựng một CompositeType mới từ nút XML Schema từ Phân tích cú pháp lược đồ XML * @param GivenName cho nút này * @param referencedName của loại khi được tạo từ một ref trong một composite. với đường dẫn của các vật liệu tổng hợp đại diện cho các cấp độ thành phần * @throws XPathExpressionException nếu XPath không hợp lệ */ public CompositeType(nút Nút cuối cùng, Chuỗi cuối cùng được cung cấp, chuỗi cuối cùng được tham chiếuName, Danh sách cuối cùng compositesPath) ném XPathExpressionException { super(node, GivenName, referencedName); XPath cuối cùng xPath = XPathFactory.newInstance().newXPath(); danh sách NodeList cuối cùng = (NodeList)xPath.compile(SUB_TYPES_EXP).evaluate(node, NODESET); for (int i = 0, size = list.getLength(); i < size; i++) { Final Node subTypeNode = list.item(i); Chuỗi cuối cùng subTypeName = XmlSchemaParser.getAttributionValue(subTypeNode, "name"); subTypeName, null, null); } checkForValidOffsets(node);

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

chuỗi cuối cùng EncodingTypeStr = getAttributionValue(node, "encodingType"); else if (Integer.parseInt(getAttributionValue(encodingTypeNode, "length", "1")) != 1) EncodingType = PrimitiveType.get(getAttributionValue(encodingTypeNode, "primitiveType" ));

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

Chuỗi cuối cùng refName = XmlSchemaParser.getAttributionValue(subTypeNode, "name"); Chuỗi cuối cùng refTypeName = XmlSchemaParser.getAttributionValue(subTypeNode, "type"); Chuỗi cuối cùng refOffset = Integer.parseInt ( 1")); Nút cuối cùng refTypeNode = (Node)xPath.compile( "/*[local-name() = 'messageSchema']/types/*[@name='" + refTypeName + "']")

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

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

riêng tư Trường phân tích cú phápDataField(cuối cùng NodeList nodeList, int cuối cùng nodeIndex) cuối cùng Chuỗi typeName = getAttributionValue(node, "type"); cuối cùng Loại fieldType = typeByNameMap.get(typeName); "tên")) .description(getAttributionValueOrNull(nút, "mô tả")) .id(Integer.parseInt(getAttributionValue(node, "id"))) .offset(Integer.parseInt(getAttributionValue(node, "offset", "0"))) .semanticType(getAttributionValueOrNull(node, "semanticType")) .presence(Presence.get(getAttributionValue(nút, "hiện diện", "bắt buộc"))) .sinceVersion(Integer.parseInt(getAttributionValue(node, "sinceVersion", "0"))) .deprecated(Integer.parseInt(getAttributionValue(node, "deprecated", "0"))) .epoch (getAttributionValue(nút, "epoch", "unix")) .timeUnit(getAttributionValue(node, "timeUnit", "nanosecond")) .type(fieldType) .variableLength(true)

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ápGroupField(cuối cùng NodeList nodeList, int cuối cùng nodeIndex) ném XPathExpressionException chuỗi cuối cùng DimensionTypeName = getAttributionValue(node, "dimensionType", "groupSizeEncoding"); (getAttributionValue(nút, "tên")) .description(getAttributionValueOrNull(node, "description")) .id(Integer.parseInt(getAttributionValue(node, "id"))) .blockLength(Integer.parseInt(getAttributionValue(node, "blockLength", "0"))) .sinceVersion(Integer.parseInt(getAttributionValue(node, "sinceVersion", "0"))) .deprecated(Integer.parseInt(getAttributionValue(node, "không dùng nữa", "0"))) .dimensionType((CompositeType)dimensionType) .build();

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

nguyên thủyType = PrimitiveType.get(getAttributionValue(node, "primitiveType")); Chuỗi cuối cùng lengthAttr = getAttributionValueOrNull(node, "length"); length = Integer.parseInt(null == lengthAttr ? "1" : lengthAttr); .parseBoolean(getAttributionValue(nút, "độ dài biến", "false")); valueRef = getAttributionValueOrNull(node, "valueRef"); characterEncoding = getAttributionValue(node, "characterEncoding", "US-ASCII").trim().toUpperCase();

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

chuỗi mã hóa cuối cùngTypeStr = getAttributionValue(node, "encodingType"); EncodedDataType mã hóaDataType cuối cùng;

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-all

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: uk.co.real-logic/sbe-tool

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: uk.co.real-logic/sbe

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: 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);

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

/** * 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"));
27 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