繰り返されたアノテーションかどうか判定する。
<p>属性「value」に、繰り返しのアノテーション{@link Repeatable}が付与されている
アノテーションの配列を保持しているかどうかで判定する。</p>
@param targetAnno
@return
354422
private boolean isRepeated(final Annotation targetAnno) {
        
        try {
            final Method method = targetAnno.getClass().getMethod("value");
            
            // 値のクラスタイプがアノテーションの配列かどうかのチェック
            final Class<?> returnType = method.getReturnType();
            if(!(returnType.isArray() && Annotation.class.isAssignableFrom(returnType.getComponentType()))) {
                return false;
            }
            
            final Annotation[] annos = (Annotation[]) method.invoke(targetAnno);
            if(annos.length == 0) {
                return false;
            }
            
            // @Repetableアノテーションが付与されているかどうか
            if(annos[0].annotationType().getAnnotation(Repeatable.class) != null) {
                return true;
            }
            
        } catch (Exception e) {
            
        }
        
        return false;
        
    }
409513
public AnnotationInfoList getRepeatable(final String name) {
        boolean hasNamedAnnotation = false;
        for (final AnnotationInfo ai : this) {
            if (ai.getName().equals(name)) {
                hasNamedAnnotation = true;
                break;
            }
        }
        if (!hasNamedAnnotation) {
            return AnnotationInfoList.EMPTY_LIST;
        }
        final AnnotationInfoList matchingAnnotations = new AnnotationInfoList(size());
        for (final AnnotationInfo ai : this) {
            if (ai.getName().equals(name)) {
                matchingAnnotations.add(ai);
            }
        }
        return matchingAnnotations;
    }
1323224
private static List<Map<String, Object>> getEntityAnnos(Object targetClass, String annotationName) {
		Annotation[] anno = null;
		if (targetClass instanceof Field)
			anno = ((Field) targetClass).getAnnotations();
		else
			anno = ((Class<?>) targetClass).getAnnotations();
		List<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
		for (Annotation annotation : anno) {
			Class<? extends Annotation> type = annotation.annotationType();
			String cName = type.getName();
			if (matchNameCheck(annotationName, cName)) {
				l.add(changeAnnotationValuesToMap(annotation, type));
			}
		}
		return l;
	}
945387
public static <T> List<T> repeatEach(final Collection<T> c, final int n) {
        N.checkArgNotNegative(n, "n");

        if (n == 0 || isNullOrEmpty(c)) {
            return new ArrayList<T>();
        }

        final List<T> result = new ArrayList<>(c.size() * n);

        for (T e : c) {
            for (int i = 0; i < n; i++) {
                result.add(e);
            }
        }

        return result;
    }
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());
                }
            }
        }
397969
public static <OriginObject, TargetObject> List<TargetObject> copyList(List<OriginObject> originObjects, Class<TargetObject> targetClass) {

        if (originObjects == null) {
            return null;
        }

        //参数不合法异常
        if (targetClass == null) {
            throw new IllegalArgumentException("targetClass can't be null");
        }
        List<TargetObject> targetObjects = new ArrayList<TargetObject>();
        for (OriginObject originObject : originObjects) {
            targetObjects.add(copy(originObject, targetClass));
        }
        return targetObjects;
    }
249917
@SuppressWarnings("rawtypes")
    private boolean hasGroups(final Annotation anno, final Class<?>... groups) {
        
        final Optional<Class[]> targetGroups = Utils.getAnnotationAttribute(anno, "groups", Class[].class);
        
        if(!targetGroups.isPresent()) {
            // groups属性を持たない場合
            return false;
            
        }
        
        if(groups.length == 0) {
            if(targetGroups.get().length == 0) {
                // グループの指定がない場合は、デフォルトグループとして処理。
                return true;
                
            } else {
                for(Class<?> targetGroup : targetGroups.get()) {
                    if(targetGroup.equals(DefaultGroup.class)) {
                        // デフォルトを直接指定している場合に、グループと一致。
                        return true;
                    }
                }
            }
            
        } else {
            // グループの指定がある場合
            for(Class<?> group : groups) {
                
                if(group.equals(DefaultGroup.class) && targetGroups.get().length == 0) {
                    // フィールド側にグループの指定がない場合は、デフォルトグループとして処理する。
                    return true;
                }
                
                for(Class<?> targetGroup : targetGroups.get()) {
                    // 一致するグループを持つか判定する。
                    if(targetGroup.equals(group)) {
                        return true;
                    }
                }
                
            }
            
        }
        
        return false;
        
    }
784294
public static <OriginObject, TargetObject> TargetObject copy(OriginObject originObject, Class<TargetObject> targetClass) {

        if (originObject == null) {
            return null;
        }

        //参数不合法异常
        if (targetClass == null) {
            throw new IllegalArgumentException("targetClass can't be null");
        }

        //目标返回对象
        TargetObject targetObject = null;

        try {
            targetObject = targetClass.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return setValue(originObject, targetObject, targetClass);
    }
234112
protected final Object convert(Class targetType, String value) {
        Converter converter = Stapler.lookupConverter(targetType);
        if (converter==null)
            throw new IllegalArgumentException("Unable to convert to "+targetType);

        return converter.convert(targetType,value);
    }
1000523
private String getAnnotations(String id, long component)
  {
    String result = "";
    String incoming = "", outgoing = "";
    int nri = 1, nro = 1;

    if(referentOfToken.get(id) != null)
    {
      for (long l : referentOfToken.get(id).keySet())
      {
        if (referentList.get((int) l) != null && referentList.get((int) l).component == component
          && referentList.get((int) l).annotations != null && referentList.get((int) l).annotations.size() > 0)
        {
          int num = referentOfToken.get(id).get(l);
          if (num == 0 || num == 2)
          {
            for (SerializableAnnotation an : referentList.get((int) l).annotations)
            {
              if (nri == 1)
              {
                incoming = ", &lt;b&gt;incoming Annotations&lt;/b&gt;: " + an.getName() + "=" + an.getValue();
                nri--;
              }
              else
              {
                incoming += ", " + an.getName() + "=" + an.getValue();
              }
            }
          }
          if (num == 1 || num == 2)
          {
            for (SerializableAnnotation an : referentList.get((int) (long) l).annotations)
            {
              if (nro == 1)
              {
                outgoing = ", &lt;b&gt;outgoing Annotations&lt;/b&gt;: " + an.getName() + "=" + an.getValue();
                nro--; // remove l+"- "+
              }
              else
              {
                outgoing += ", " + an.getName() + "=" + an.getValue();
              }
            }
          }
        }
      }
    }
    if (nro < 1)
    {
      result += outgoing;
    }
    if (nri < 1)
    {
      result += incoming;
    }
    return result;
  }
400578
private void validateAnnotation(final FieldAccessor accessor, final XlsLabelledArrayCells anno) {

        // 左側のとき、水平方向の配列はサポートしない
        if(anno.type().equals(LabelledCellType.Left) && anno.direction().equals(ArrayDirection.Horizon)) {
            throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.XlsLabelledArrayCell.notSupportTypeAndDirection")
                    .var("property", accessor.getNameWithClass())
                    .varWithAnno("anno", XlsLabelledArrayCells.class)
                    .varWithEnum("typeValue", anno.type())
                    .varWithEnum("directionValue", anno.direction())
                    .format());
        }

    }
1275371
public BeanMappingObject getBeanMapObject(Class src, Class target, boolean autoRegister) {
        BeanMappingObject object = autoRepository.getBeanMappingObject(src, target);
        if (object == null && autoRegister) {
            if (isMap(src)) {// 判断是否为map接口的子类
                autoRepository.registerMap(target);
            } else {
                autoRepository.registerMap(src);
            }

            object = getFromRepository(src, target, this.autoRepository);
        }
        return object;
    }
1137570
public AnnotationValueBuilder<T> value(@Nullable AnnotationValue<?> annotation) {
        return member(AnnotationMetadata.VALUE_MEMBER, annotation);
    }
259964
public void setValue(final Object targetObj, final Object value) {
        ArgUtils.notNull(targetObj, "targetObj");
        
        if(targetSetter.isPresent()) {
            try {
                targetSetter.get().invoke(targetObj, value);
            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
                throw new FieldAccessException(this, "fail setter value", e);
            }
            
        } else if(targetField.isPresent()) {
            try {
                targetField.get().set(targetObj, value);
                
            } catch (IllegalArgumentException | IllegalAccessException e) {
                throw new FieldAccessException(this, "fail setter field value", e);
            }
            
        } else {
            throw new FieldAccessException(this, "not found setter method or field.");
        }
    }
343607
private String getTargetEntity(List<? extends AnnotationMirror> annotations) {
		String fullyQualifiedTargetEntityName = null;
		for ( AnnotationMirror mirror : annotations ) {
			if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ELEMENT_COLLECTION ) ) {
				fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetClass" );
			}
			else if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_MANY )
					|| TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_MANY )
					|| TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_ONE )
					|| TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_ONE ) ) {
				fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetEntity" );
			}
			else if ( TypeUtils.isAnnotationMirrorOfType( mirror, ORG_HIBERNATE_ANNOTATIONS_TARGET ) ) {
				fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "value" );
			}
		}
		return fullyQualifiedTargetEntityName;
	}
76320
@Override
    public void visitEnum(String targetMethodName,
                          String enumerationTypeDescription,
                          String enumerationLiteral) {

        if (tc.isDebugEnabled()) {
            Tr.debug(tc, MessageFormat.format("visitEnum [ {0} ] Name [ {1} ] Description [ {2} ] Value [ {3} ]",
                                              getHashText(), targetMethodName,
                                              enumerationTypeDescription, enumerationLiteral));
        }

        Type enumerationType = Type.getType(enumerationTypeDescription);
        String enumerationClassName = enumerationType.getClassName();

        // TODO: The value stored as the class name, not as an info object.
        //       For now, let the caller obtain the value as a class info.
        //
        //       Whether to allow resolution of class values as class info
        //       objects is an open question.  No particular value is known
        //       at this time for adding a class info type access API.
        //
        // See the similar code in 'InfoVisitor_DefaultValue.visit(String, Object)'.

        // value = infoStore.getDelayableClassInfo( valueAsType.getClassName() );

        AnnotationValueImpl newAnnotationValue =
                        new AnnotationValueImpl(enumerationClassName, enumerationLiteral);

        storeAnnotationValue(targetMethodName, newAnnotationValue);
    }
541224
private static Annotation[] getAnnotations(Object targetClass) {
		if (targetClass instanceof Field)
			return ((Field) targetClass).getAnnotations();
		else if (targetClass instanceof Method)
			return ((Method) targetClass).getAnnotations();
		else if (targetClass instanceof Constructor)
			return ((Constructor<?>) targetClass).getAnnotations();
		else if (targetClass instanceof Class)
			return ((Class<?>) targetClass).getAnnotations();
		else
			return BeanBoxException.throwEX("targetClass should be Field, Method, Constructor or Class");
	}