blob: d2555d7a9354b92eea3da8b4a378c8dfd4446968 [file] [log] [blame]
Jeff Sharkeyd85b5c82017-04-19 23:14:30 -06001/*
2 * Copyright (C) 2017 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.doclava;
18
19import com.google.clearsilver.jsilver.data.Data;
20
Jeff Sharkeyaa80d602017-04-21 15:52:31 -060021import java.util.Map;
Jeff Sharkeyd85b5c82017-04-19 23:14:30 -060022
Jeff Sharkeyaa80d602017-04-21 15:52:31 -060023public class AuxTagInfo extends TagInfo {
24 public static final AuxTagInfo[] EMPTY_ARRAY = new AuxTagInfo[0];
25
26 public static AuxTagInfo[] getArray(int size) {
27 return size == 0 ? EMPTY_ARRAY : new AuxTagInfo[size];
Jeff Sharkeyd85b5c82017-04-19 23:14:30 -060028 }
29
Jeff Sharkeyaa80d602017-04-21 15:52:31 -060030 private Map<String, String> mArgs;
Jeff Sharkeyd85b5c82017-04-19 23:14:30 -060031 private TagInfo[] mValues;
32
Jeff Sharkeyaa80d602017-04-21 15:52:31 -060033 AuxTagInfo(String name, String kind, SourcePositionInfo position, Map<String, String> args,
34 TagInfo[] values) {
35 super(name, kind, "", position);
36 mArgs = args;
Jeff Sharkeyd85b5c82017-04-19 23:14:30 -060037 mValues = values;
38 }
39
40 private TagInfo[] valuesTags() {
41 return mValues;
42 }
43
44 @Override
45 public void makeHDF(Data data, String base) {
46 super.makeHDF(data, base);
Jeff Sharkeyaa80d602017-04-21 15:52:31 -060047 for (Map.Entry<String, String> entry : mArgs.entrySet()) {
48 data.setValue(base + "." + entry.getKey(), entry.getValue());
Jeff Sharkeyd85b5c82017-04-19 23:14:30 -060049 }
50 TagInfo.makeHDF(data, base + ".values", valuesTags());
51 }
52}