private void populateAnnotation(Class<? extends Annotation> constraint,
            AnnotationSource<JavaClassSource> annotation)
   {
      for (Method m : constraint.getDeclaredMethods())
      {
         String name = m.getName();
         Class<?> returnType = m.getReturnType();
         InputComponent<?, ?> inputComponent = inputs.get(name);
         Object componentValue = InputComponents.getValueFor(inputComponent);
         if (componentValue == null)
         {
            continue;
         }
         try
         {
            Object defaultValue = m.getDefaultValue();
            if (defaultValue != null)
            {
               if (returnType.isArray())
               {
                  Class<?> componentType = returnType.getComponentType();
                  List<Object> defaultValues = toList(componentType, defaultValue);
                  Collection<Object> values = (Collection<Object>) componentValue;
                  if (values.containsAll(defaultValues))
                  {
                     continue;
                  }
               }
               else
               {
                  if (returnType == Class.class && ((Class<?>) defaultValue).getName().equals(componentValue))
                  {
                     continue;
                  }
                  else if (componentValue.toString().equals(defaultValue.toString()))
                  {
                     continue;
                  }
               }
            }
         }
         catch (TypeNotPresentException tnpe)
         {
            // No default value is present
         }
         if (inputComponent instanceof ManyValued)
         {
            returnType = returnType.getComponentType();
            Collection<Object> values = (Collection<Object>) componentValue;
            setArrayValue(annotation, name, returnType, values, returnType == Class.class);
         }
         else
         {
            if (returnType == Class.class)
            {
               annotation.setLiteralValue(name, componentValue + ".class");
            }
            else if (returnType == String.class)
            {
               annotation.setStringValue(name, componentValue.toString());
            }
            else
            {
               annotation.setLiteralValue(name, componentValue.toString());
            }
         }
      }

   }
private void populateAnnotation ( Class < ? extends Annotation > constraint , AnnotationSource < JavaClassSource > annotation ) { for ( Method m : constraint . getDeclaredMethods ( ) ) { String name = m . getName ( ) ; Class < ? > returnType = m . getReturnType ( ) ; InputComponent < ? , ? > inputComponent = inputs . get ( name ) ; Object componentValue = InputComponents . getValueFor ( inputComponent ) ; if ( componentValue == null ) { continue ; } try { Object defaultValue = m . getDefaultValue ( ) ; if ( defaultValue != null ) { if ( returnType . isArray ( ) ) { Class < ? > componentType = returnType . getComponentType ( ) ; List < Object > defaultValues = toList ( componentType , defaultValue ) ; Collection < Object > values = ( Collection < Object > ) componentValue ; if ( values . containsAll ( defaultValues ) ) { continue ; } } else { if ( returnType == Class . class && ( ( Class < ? > ) defaultValue ) . getName ( ) . equals ( componentValue ) ) { continue ; } else if ( componentValue . toString ( ) . equals ( defaultValue . toString ( ) ) ) { continue ; } } } } catch ( TypeNotPresentException tnpe ) { } if ( inputComponent instanceof ManyValued ) { returnType = returnType . getComponentType ( ) ; Collection < Object > values = ( Collection < Object > ) componentValue ; setArrayValue ( annotation , name , returnType , values , returnType == Class . class ) ; } else { if ( returnType == Class . class ) { annotation . setLiteralValue ( name , componentValue + ".class" ) ; } else if ( returnType == String . class ) { annotation . setStringValue ( name , componentValue . toString ( ) ) ; } else { annotation . setLiteralValue ( name , componentValue . toString ( ) ) ; } } } }
@param annotation