タグとclass指定で子孫要素を返す

@param <T>
tag class type. (i.e. Div.class, Span.class...)
@param target
objects for scan
@param resultList
usually, pass new ArrayList
@param clazz
class property of tag
@param tagType
tag class
@return
423907
public static <T extends AbstractJaxb> List<T> getDescendants(T target,
            List<T> resultList, String clazz, Class<T> tagType) {
        return execute(target, resultList, tagType, clazz);
    }
198570
public static Class<? extends Tag> getClassFor(int id) {
        if(!idToTag.containsKey(id)) {
            return null;
        }

        return idToTag.get(id);
    }
1329878
public static <E extends HTMLElement> TextContentBuilder<E> textElement(String tag, Class<E> type) {
        return new TextContentBuilder<>(createElement(tag, type));
    }
161966
@SuppressWarnings("unchecked")
    public <T extends AbstractJaxb> void removeDescendants(String clazz,
            Class<T> tagType) {
        RemoveDescendantsUtil.removeDescendants((T) this, clazz, tagType);
    }
566404
public static String openTagClassHtmlContent(String tag, String clazz, String... content) {
		return openTagHtmlContent(tag, clazz, null, content);
	}
155443
public boolean containsOfType(final Class<? extends Tag> type) {
	read.lock();
	try {
	    return tags.containsKey(type);
	} finally {
	    read.unlock();
	}
    }
10275
@DefaultVisibilityForTesting
  static TagsComponent loadTagsComponent(@Nullable ClassLoader classLoader) {
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName(
              "io.opencensus.impl.tags.TagsComponentImpl", /*initialize=*/ true, classLoader),
          TagsComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load full implementation for TagsComponent, now trying to load lite "
              + "implementation.",
          e);
    }
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName(
              "io.opencensus.impllite.tags.TagsComponentImplLite",
              /*initialize=*/ true,
              classLoader),
          TagsComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load lite implementation for TagsComponent, now using "
              + "default implementation for TagsComponent.",
          e);
    }
    return NoopTags.newNoopTagsComponent();
  }
214504
def tag(self, tag, child='', enclose=0, newline=True, **kwargs):
        
        kw = kwargs.copy()
        _class = ''
        if '_class' in kw:
            _class = kw.pop('_class')
        if 'class' in kw:
            _class += ' ' + kw.pop('class')
        tag_class = self.tag_class.get(tag, '')
        if tag_class:
            #if tag_class definition starts with '+', and combine it with original value
            if tag_class.startswith('+'):
                kw['class'] = tag_class[1:] + ' ' + _class.lstrip()
            else:
                kw['class'] = tag_class.lstrip()
        else:
            kw['class'] = _class.lstrip()
            
        #process inner and outter link
        if tag == 'a':
            print ('------', kw)
            href = kw.get('href', '#')
            if href and (href.startswith('http:') or href.startswith('https:') or href.startswith('ftp:')):
                _cls = 'outter'
            else:
                _cls = 'inner'
                kw['href'] = href
            if kw.get('class'):
                kw['class'] = kw['class'] + ' ' + _cls
            else:
                kw['class'] = _cls
            
        attrs = ' '.join(['%s="%s"' % (x, y) for x, y in sorted(kw.items()) if y])
        if attrs:
            attrs = ' ' + attrs
        nline = '\n' if newline else ''
        if child:
            enclose = 2
        if enclose == 1:
            return '<%s%s/>%s' % (tag, attrs, nline)
        elif enclose == 2:
            return '<%s%s>%s</%s>%s' % (tag, attrs, child, tag, nline)
        else:
            return '<%s%s>%s' % (tag, attrs, nline)
305758
public static <T extends AbstractJaxb> void replaceDescendants(T target,
            String clazz, T replace) throws TagTypeUnmatchException {
        execute(target, null, clazz, replace);
    }
239065
@Deprecated
    public static <T> BiRecordGetter<T, RuntimeException> createBiRecordGetterByTargetClass(final Class<? extends T> targetClass) {
        if (Object[].class.isAssignableFrom(targetClass)) {
            return new BiRecordGetter<T, RuntimeException>() {
                @Override
                public T apply(ResultSet rs, List<String> columnLabelList) throws SQLException {
                    final int columnCount = columnLabelList.size();
                    final Object[] a = Array.newInstance(targetClass.getComponentType(), columnCount);

                    for (int i = 0; i < columnCount; i++) {
                        a[i] = JdbcUtil.getColumnValue(rs, i + 1);
                    }

                    return (T) a;
                }
            };
        } else if (List.class.isAssignableFrom(targetClass)) {
            return new BiRecordGetter<T, RuntimeException>() {

                private final boolean isListOrArrayList = targetClass.equals(List.class) || targetClass.equals(ArrayList.class);

                @Override
                public T apply(ResultSet rs, List<String> columnLabelList) throws SQLException {
                    final int columnCount = columnLabelList.size();
                    final List<Object> c = isListOrArrayList ? new ArrayList<Object>(columnCount) : (List<Object>) N.newInstance(targetClass);

                    for (int i = 0; i < columnCount; i++) {
                        c.add(JdbcUtil.getColumnValue(rs, i + 1));
                    }

                    return (T) c;
                }
            };
        } else if (Map.class.isAssignableFrom(targetClass)) {
            return new BiRecordGetter<T, RuntimeException>() {
                private final boolean isMapOrHashMap = targetClass.equals(Map.class) || targetClass.equals(HashMap.class);
                private final boolean isLinkedHashMap = targetClass.equals(LinkedHashMap.class);

                @Override
                public T apply(ResultSet rs, List<String> columnLabelList) throws SQLException {
                    final int columnCount = columnLabelList.size();
                    final Map<String, Object> m = isMapOrHashMap ? new HashMap<String, Object>(columnCount)
                            : (isLinkedHashMap ? new LinkedHashMap<String, Object>(columnCount) : (Map<String, Object>) N.newInstance(targetClass));

                    for (int i = 0; i < columnCount; i++) {
                        m.put(columnLabelList.get(i), JdbcUtil.getColumnValue(rs, i + 1));
                    }

                    return (T) m;
                }
            };
        } else if (N.isEntity(targetClass)) {
            return new BiRecordGetter<T, RuntimeException>() {
                private final boolean isDirtyMarker = N.isDirtyMarker(targetClass);
                private volatile String[] columnLabels = null;
                private volatile Method[] propSetters;
                private volatile Type<?>[] columnTypes = null;

                @Override
                public T apply(ResultSet rs, List<String> columnLabelList) throws SQLException {
                    final int columnCount = columnLabelList.size();

                    String[] columnLabels = this.columnLabels;
                    Method[] propSetters = this.propSetters;
                    Type<?>[] columnTypes = this.columnTypes;

                    if (columnLabels == null) {
                        columnLabels = columnLabelList.toArray(new String[columnLabelList.size()]);
                        this.columnLabels = columnLabels;
                    }

                    if (columnTypes == null || propSetters == null) {
                        final EntityInfo entityInfo = ParserUtil.getEntityInfo(targetClass);
                        final Map<String, String> column2FieldNameMap = getField2ColumnNameMap(targetClass);

                        propSetters = new Method[columnCount];
                        columnTypes = new Type[columnCount];

                        for (int i = 0; i < columnCount; i++) {
                            propSetters[i] = ClassUtil.getPropSetMethod(targetClass, columnLabels[i]);

                            if (propSetters[i] == null) {
                                String fieldName = column2FieldNameMap.get(columnLabels[i]);

                                if (N.isNullOrEmpty(fieldName)) {
                                    fieldName = column2FieldNameMap.get(columnLabels[i].toLowerCase());
                                }

                                if (N.notNullOrEmpty(fieldName)) {
                                    propSetters[i] = ClassUtil.getPropSetMethod(targetClass, fieldName);
                                }
                            }

                            if (propSetters[i] == null) {
                                columnLabels[i] = null;
                                throw new IllegalArgumentException(
                                        "No property in class: " + ClassUtil.getCanonicalClassName(targetClass) + " mapping to column: " + columnLabels[i]);
                            } else {
                                columnTypes[i] = entityInfo.getPropInfo(columnLabels[i]).type;
                            }
                        }

                        this.propSetters = propSetters;
                        this.columnTypes = columnTypes;
                    }

                    final Object entity = N.newInstance(targetClass);

                    for (int i = 0; i < columnCount; i++) {
                        if (columnLabels[i] == null) {
                            continue;
                        }

                        ClassUtil.setPropValue(entity, propSetters[i], columnTypes[i].get(rs, i + 1));
                    }

                    if (isDirtyMarker) {
                        ((DirtyMarker) entity).markDirty(false);
                    }

                    return (T) entity;
                }
            };
        } else {
            throw new IllegalArgumentException(targetClass.getCanonicalName() + " is not an Array/List/Map/Entity class");
        }
    }
580623
@SuppressWarnings("unchecked")
    public <T extends AbstractJaxb> void replaceDescendants(String clazz,
            Class<T> tagType, T replacement) throws TagTypeUnmatchException {
        ReplaceDescendantsUtil.replaceDescendants((T) this, tagType, clazz,
                replacement);
    }
891092
public static ResultDescriptor ofResult(final Class<? extends AnalyzerResult> resultClass) {
        ResultDescriptor resultDescriptor = _resultDescriptors.get(resultClass);
        if (resultDescriptor == null) {
            resultDescriptor = new ResultDescriptorImpl(resultClass);
            _resultDescriptors.put(resultClass, resultDescriptor);
        }
        return resultDescriptor;
    }
531635
public <T> List<T> parse(Class<T> clazz) {
        List<T> resultList = null;
        try {
            Sheet sheet = workbook.getSheet(this.sheetName);
            if (null != sheet) {
                resultList = new ArrayList<T>(sheet.getLastRowNum() - 1);
                Row row = sheet.getRow(this.startRow);

                Map<String, Field> fieldMap = new HashMap<String, Field>();
                Map<String, String> titleMap = new HashMap<String, String>();

                Field[] fields = clazz.getDeclaredFields();
                //这里开始处理映射类型里的注解
                for (Field field : fields) {
                    if (field.isAnnotationPresent(TitleCell.class)) {
                        TitleCell mapperCell = field.getAnnotation(TitleCell.class);
                        fieldMap.put(mapperCell.name(), field);
                    }
                }

                for (Cell title : row) {
                    CellReference cellRef = new CellReference(title);
                    titleMap.put(cellRef.getCellRefParts()[2], title.getRichStringCellValue().getString());
                }

                for (int i = this.startRow + 1; i <= sheet.getLastRowNum(); i++) {
                    T t = clazz.newInstance();
                    Row dataRow = sheet.getRow(i);
                    for (Cell data : dataRow) {
                        CellReference cellRef = new CellReference(data);
                        String cellTag = cellRef.getCellRefParts()[2];
                        String name = titleMap.get(cellTag);
                        Field field = fieldMap.get(name);
                        if (null != field) {
                            field.setAccessible(true);
                            getCellValue(data, t, field);
                        }
                    }
                    resultList.add(t);
                }
            } else {
                throw new RuntimeException("sheetName:" + this.sheetName + " is not exist");
            }
        } catch (InstantiationException e) {
            LOG.error("初始化异常", e);
        } catch (IllegalAccessException e) {
            LOG.error("初始化异常", e);
        } catch (ParseException e) {
            LOG.error("时间格式化异常:{}", e);
        } catch (Exception e) {
            LOG.error("其他异常", e);
        }
        return resultList;
    }
309708
public void setTargetTags(java.util.Collection<String> targetTags) {
        if (targetTags == null) {
            this.targetTags = null;
            return;
        }

        this.targetTags = new java.util.ArrayList<String>(targetTags);
    }
509928
@Override
    public Map<Field, GenContainer> scan(final Class t) {
        final Map<Field, GenContainer> populateAnnotationMap = new LinkedHashMap<>();

        // Check if class is auto generative
        final boolean isAutoGen = Arrays.stream(t.getDeclaredAnnotations())
                .anyMatch(a -> a.annotationType().equals(GenAuto.class));

        for (final Field field : t.getDeclaredFields()) {
            GenContainer genContainer = findGenAnnotation(field);

            // Create auto gen container class is auto generative
            if (genContainer == null && isAutoGen) {
                Class<? extends IGenerator> generator = getAutoGenerator(field.getType());
                if (generator.equals(NullGenerator.class)) {
                    // Try to treat field as embedded object, when no suitable generator
                    generator = EmbeddedGenerator.class;
                }

                genContainer = GenContainer.asAuto(generator, isComplex(field));
            }

            if (genContainer != null) {
                populateAnnotationMap.put(field, genContainer);
            }
        }

        return populateAnnotationMap;
    }
1043546
public static <E extends HTMLElement> HtmlContentBuilder<E> htmlElement(String tag, Class<E> type) {
        return new HtmlContentBuilder<>(createElement(tag, type));
    }
606421
private Set<String> getTags(RoxableTest methodAnnotation, RoxableTestClass classAnnotation) {
		Set<String> tags = CollectionHelper.getTags(configuration.getTags(), methodAnnotation, classAnnotation);
		
		if (!tags.contains(DEFAULT_TAG)) {
			tags.add(DEFAULT_TAG);
		}
		
		return tags;
	}