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

@param <T>
tag class type. (i.e. Div.class, Span.class...)
@param target
objects for scan
@param resultList
usually, pass new ArrayList
@param tagType
tag class
@return
556360
public static <T extends AbstractJaxb> List<T> getDescendants(T target,
            List<T> resultList, Class<T> tagType) {
        return execute(target, resultList, tagType, null);
    }
923892
public <T extends AbstractJaxb> T copyNoException(Class<T> tagType) {
        T copy = null;
        try {
            copy = (T) this.copy(tagType);
        } catch (final TagTypeUnmatchException e) {
            return null;
        }
        return copy;
    }
137594
public static <T extends TOP> Collection<T> selectFromAllViews(JCas jCas, Class<T> type)
    {
        Collection<T> result = new ArrayList<T>();

        try {
            Iterator<JCas> viewIterator = jCas.getViewIterator();
            while (viewIterator.hasNext()) {
                JCas next = viewIterator.next();

                result.addAll(JCasUtil.select(next, type));
            }

            return result;
        }
        catch (CASException ex) {
            throw new RuntimeException(ex);
        }
    }
1315839
public static <T> List<T> query(Class<T> targetClass, final Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        return query(targetClass, uri, projection, selection, selectionArgs, sortOrder, null);
    }
72037
public void setTagList(java.util.Collection<Tag> tagList) {
        if (tagList == null) {
            this.tagList = null;
            return;
        }

        this.tagList = new java.util.ArrayList<Tag>(tagList);
    }
1310698
public static Specification<JpaTarget> hasTag(final Long tagId) {

        return (targetRoot, query, cb) -> {
            final SetJoin<JpaTarget, JpaTargetTag> tags = targetRoot.join(JpaTarget_.tags, JoinType.LEFT);
            return cb.equal(tags.get(JpaTargetTag_.id), tagId);
        };
    }
549550
public ScanResultPage<T> scanPage(DynamoDBScanExpression scanExpression) {
        return mapper.<T>scanPage(model.targetType(), scanExpression);
    }
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;
    }
1154476
@java.lang.SuppressWarnings({ "UnnecessaryBoxing" })
    public boolean containsTag(int tagType)
    {
        return _tagMap.containsKey(Integer.valueOf(tagType));
    }
1335200
public Tag use(String tagClassName, String fullname, int attrType) throws PageException {
	return use(tagClassName, null, null, fullname, attrType, null);
    }
798985
public static <T extends AbstractJaxb> List<T> getDescendants(T target,
            List<T> resultList, String clazz) {
        return execute(target, resultList, null, clazz);
    }
1019231
public static <T> T convertIfNecessary(Object target, Class<T> type) {
        if (type.isInstance(target)) {
            return type.cast(target);
        }

        if (Source.class.isAssignableFrom(type)) {
            if (target.getClass().isAssignableFrom(String.class)) {
                return (T) new StringSource(String.valueOf(target));
            } else if (target.getClass().isAssignableFrom(Node.class)) {
                return (T) new DOMSource((Node) target);
            } else if (target.getClass().isAssignableFrom(InputStreamSource.class)) {
                try {
                    return (T) new StreamSource(((InputStreamSource)target).getInputStream());
                } catch (IOException e) {
                    log.warn("Failed to create stream source from object", e);
                }
            }
        }

        if (MultiValueMap.class.isAssignableFrom(type)) {
            String mapString = String.valueOf(target);

            Properties props = new Properties();
            try {
                props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replaceAll("\\]\\s*", "]\n")));
            } catch (IOException e) {
                throw new CitrusRuntimeException("Failed to reconstruct object of type map", e);
            }
            MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
            for (Map.Entry<Object, Object> entry : props.entrySet()) {
                String arrayString = String.valueOf(entry.getValue()).replaceAll("^\\[", "").replaceAll("\\]$", "").replaceAll(",\\s", ",");
                map.add(entry.getKey().toString(), StringUtils.commaDelimitedListToStringArray(String.valueOf(arrayString)));
            }

            return (T) map;
        }

        if (Map.class.isAssignableFrom(type)) {
            String mapString = String.valueOf(target);

            Properties props = new Properties();
            try {
                props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replaceAll(",\\s*", "\n")));
            } catch (IOException e) {
                throw new CitrusRuntimeException("Failed to reconstruct object of type map", e);
            }
            Map<String, Object> map = new LinkedHashMap<>();
            for (Map.Entry<Object, Object> entry : props.entrySet()) {
                map.put(entry.getKey().toString(), entry.getValue());
            }

            return (T) map;
        }

        if (String[].class.isAssignableFrom(type)) {
            String arrayString = String.valueOf(target).replaceAll("^\\[", "").replaceAll("\\]$", "").replaceAll(",\\s", ",");
            return (T) StringUtils.commaDelimitedListToStringArray(String.valueOf(arrayString));
        }

        if (List.class.isAssignableFrom(type)) {
            String listString = String.valueOf(target).replaceAll("^\\[", "").replaceAll("\\]$", "").replaceAll(",\\s", ",");
            return (T) Arrays.asList(StringUtils.commaDelimitedListToStringArray(String.valueOf(listString)));
        }

        if (byte[].class.isAssignableFrom(type)) {
            if (target instanceof String) {
                try {
                    return (T) String.valueOf(target).getBytes(Citrus.CITRUS_FILE_ENCODING);
                } catch (UnsupportedEncodingException e) {
                    return (T) String.valueOf(target).getBytes();
                }
            } else if (target instanceof ByteBuffer) {
                return (T) ((ByteBuffer) target).array();
            } else if (target instanceof ByteArrayInputStream) {
                try {
                    return (T) StreamUtils.copyToByteArray((ByteArrayInputStream) target);
                } catch (IOException e) {
                    throw new CitrusRuntimeException("Failed to convert input stream to byte[]");
                }
            }
        }

        if (InputStream.class.isAssignableFrom(type)) {
            if (target instanceof InputStream) {
                return (T) target;
            } else if (target instanceof byte[]) {
                return (T) new ByteArrayInputStream((byte[]) target);
            } else if (target instanceof String) {
                try {
                    return (T) new ByteArrayInputStream(String.valueOf(target).getBytes(Citrus.CITRUS_FILE_ENCODING));
                } catch (UnsupportedEncodingException e) {
                    return (T) new ByteArrayInputStream(String.valueOf(target).getBytes());
                }
            } else {
                try {
                    return (T) new ByteArrayInputStream(target.toString().getBytes(Citrus.CITRUS_FILE_ENCODING));
                } catch (UnsupportedEncodingException e) {
                    return (T) new ByteArrayInputStream(target.toString().getBytes());
                }
            }
        }
680988
public void writeTag(int tagClass, boolean primitive, int tag) throws AsnException {
		
		if (tag < 0)
			throw new AsnException("Tag must not be negative");

		if (tag <= 30) {
			
			int toEncode = (tagClass & 0x03) << 6;
			toEncode |= (primitive ? 0 : 1) << 5;
			toEncode |= tag & 0x1F;
			this.write(toEncode);
		} else {
			
			int toEncode = (tagClass & 0x03) << 6;
			toEncode |= (primitive ? 0 : 1) << 5;
			toEncode |= 0x1F;
			this.write(toEncode);

			int byteArr = 8;
			byte[] buf = new byte[byteArr];
			int pos = byteArr;
			while (true) {
				int dd;
				if (tag <= 0x7F) {
					dd = tag;
					if (pos != byteArr)
						dd = dd | 0x80;
					buf[--pos] = (byte) dd;
					break;
				} else {
					dd = (tag & 0x7F);
					tag >>= 7;
					if (pos != byteArr)
						dd = dd | 0x80;
					buf[--pos] = (byte) dd;
				}
			}
			this.write(buf, pos, byteArr - pos);
		}
	}
155443
public boolean containsOfType(final Class<? extends Tag> type) {
	read.lock();
	try {
	    return tags.containsKey(type);
	} finally {
	    read.unlock();
	}
    }
244648
@Nullable
    protected String getBitFlagDescription(final int tagType, @NotNull final Object... labels)
    {
        Integer value = _directory.getInteger(tagType);

        if (value == null)
            return null;

        List<String> parts = new ArrayList<String>();

        int bitIndex = 0;
        while (labels.length > bitIndex) {
            Object labelObj = labels[bitIndex];
            if (labelObj != null) {
                boolean isBitSet = (value & 1) == 1;
                if (labelObj instanceof String[]) {
                    String[] labelPair = (String[])labelObj;
                    assert(labelPair.length == 2);
                    parts.add(labelPair[isBitSet ? 1 : 0]);
                } else if (isBitSet && labelObj instanceof String) {
                    parts.add((String)labelObj);
                }
            }
            value >>= 1;
            bitIndex++;
        }

        return StringUtil.join(parts, ", ");
    }
1344835
public static <T extends AbstractJaxb> void removeDescendants(T target,
            String clazz, Class<T> tagType) {
        execute(target, tagType, clazz);
    }
634489
@Around(value = "execution(* *(..)) && (@annotation(tagReturnValue))")
	public Object doTagging(ProceedingJoinPoint pjp, TagReturnValue tagReturnValue) throws Throwable {
		Object result = pjp.proceed();
		MoSKitoContext.addTag(tagReturnValue.name(), result == null ? null : result.toString(), TagType.ANNOTATED, pjp.getSignature().toShortString());
		return result;
	}