Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SizeAwareVisitor |
|
| 1.0;1 |
1 | /* | |
2 | * #%L | |
3 | * Visitor.java - mongodb-async-driver - Allanbank Consulting, Inc. | |
4 | * %% | |
5 | * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc. | |
6 | * %% | |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | * you may not use this file except in compliance with the License. | |
9 | * You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, software | |
14 | * distributed under the License is distributed on an "AS IS" BASIS, | |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | * See the License for the specific language governing permissions and | |
17 | * limitations under the License. | |
18 | * #L% | |
19 | */ | |
20 | package com.allanbank.mongodb.bson.element; | |
21 | ||
22 | import java.util.List; | |
23 | ||
24 | import com.allanbank.mongodb.bson.Element; | |
25 | import com.allanbank.mongodb.bson.Visitor; | |
26 | ||
27 | /** | |
28 | * Extension for visitors that could benefit from knowledge of the size of the | |
29 | * array and document elements. | |
30 | * | |
31 | * @api.yes This interface is part of the driver's API. Public and protected | |
32 | * members will be deprecated for at least 1 non-bugfix release | |
33 | * (version numbers are <major>.<minor>.<bugfix>) | |
34 | * before being removed or modified. | |
35 | * @copyright 2011-2013, Allanbank Consulting, Inc., All Rights Reserved | |
36 | */ | |
37 | public interface SizeAwareVisitor extends Visitor { | |
38 | ||
39 | /** | |
40 | * Visits an array of elements. | |
41 | * <p> | |
42 | * The {@link com.allanbank.mongodb.bson.element.ArrayElement} | |
43 | * implementation ensures that the list of elements is always the same list. | |
44 | * Visitors may use this fact to cache intermediate results. | |
45 | * </p> | |
46 | * | |
47 | * @param name | |
48 | * The name of the element. | |
49 | * @param elements | |
50 | * The elements in the array. | |
51 | * @param totalSize | |
52 | * The total size of the | |
53 | * {@link com.allanbank.mongodb.bson.element.ArrayElement}. | |
54 | */ | |
55 | public void visitArray(String name, List<Element> elements, long totalSize); | |
56 | ||
57 | /** | |
58 | * Visits a sub-document element. | |
59 | * <p> | |
60 | * The {@link com.allanbank.mongodb.bson.element.DocumentElement} | |
61 | * implementation ensures that the list of elements is always the same list. | |
62 | * Visitors may use this fact to cache intermediate results. | |
63 | * </p> | |
64 | * | |
65 | * @param name | |
66 | * The name of the element. | |
67 | * @param elements | |
68 | * The sub elements of the document. | |
69 | * @param totalSize | |
70 | * The total size of the | |
71 | * {@link com.allanbank.mongodb.bson.element.DocumentElement}. | |
72 | */ | |
73 | public void visitDocument(String name, List<Element> elements, | |
74 | long totalSize); | |
75 | } |