Jeff Sharkey | d85b5c8 | 2017-04-19 23:14:30 -0600 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.google.doclava; |
| 18 | |
| 19 | import com.google.clearsilver.jsilver.data.Data; |
| 20 | |
Jeff Sharkey | aa80d60 | 2017-04-21 15:52:31 -0600 | [diff] [blame] | 21 | import java.util.Map; |
Jeff Sharkey | d85b5c8 | 2017-04-19 23:14:30 -0600 | [diff] [blame] | 22 | |
Jeff Sharkey | aa80d60 | 2017-04-21 15:52:31 -0600 | [diff] [blame] | 23 | public 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 Sharkey | d85b5c8 | 2017-04-19 23:14:30 -0600 | [diff] [blame] | 28 | } |
| 29 | |
Jeff Sharkey | aa80d60 | 2017-04-21 15:52:31 -0600 | [diff] [blame] | 30 | private Map<String, String> mArgs; |
Jeff Sharkey | d85b5c8 | 2017-04-19 23:14:30 -0600 | [diff] [blame] | 31 | private TagInfo[] mValues; |
| 32 | |
Jeff Sharkey | aa80d60 | 2017-04-21 15:52:31 -0600 | [diff] [blame] | 33 | AuxTagInfo(String name, String kind, SourcePositionInfo position, Map<String, String> args, |
| 34 | TagInfo[] values) { |
| 35 | super(name, kind, "", position); |
| 36 | mArgs = args; |
Jeff Sharkey | d85b5c8 | 2017-04-19 23:14:30 -0600 | [diff] [blame] | 37 | 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 Sharkey | aa80d60 | 2017-04-21 15:52:31 -0600 | [diff] [blame] | 47 | for (Map.Entry<String, String> entry : mArgs.entrySet()) { |
| 48 | data.setValue(base + "." + entry.getKey(), entry.getValue()); |
Jeff Sharkey | d85b5c8 | 2017-04-19 23:14:30 -0600 | [diff] [blame] | 49 | } |
| 50 | TagInfo.makeHDF(data, base + ".values", valuesTags()); |
| 51 | } |
| 52 | } |