Gets all validation warnings of a given component.
@param componentClass the component (e.g. {@code VEvent.class})
@return the validation warnings
7754
public List<WarningsGroup> getByComponent(Class<? extends ICalComponent> componentClass) {
		List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
		for (WarningsGroup group : this.warnings) {
			ICalComponent component = group.getComponent();
			if (component == null) {
				continue;
			}

			if (componentClass == component.getClass()) {
				warnings.add(group);
			}
		}
		return warnings;
	}
286562
@SuppressWarnings("unchecked")
	public <T> T getInstance(Class<T> beanClass) {
		String[] beanNames = applicationContext.getBeanNamesForType(beanClass);
		if (beanNames.length == 0) {
			return null;
		}
		return (T) applicationContext.getBean(beanNames[0]);
	}
431699
public Set<PackageResourceReferenceWrapper> getPackageResourceReference(
		final Class<?> componentClass)
	{
		Set<PackageResourceReferenceWrapper> packageResourceReference = PackageResourceReferences
			.getInstance().getPackageResourceReferenceMap().get(componentClass);
		packageResourceReference = addPackageResourceReferenceFromInterfaces(
			packageResourceReference, componentClass);
		return packageResourceReference;
	}
156757
public List<SystemEventListener> getListenersForEventClass(Class<? extends SystemEvent> facesEventClass) {

        if (null == listener) {
            List<SystemEventListener> list = new ArrayList<SystemEventListener>(1);
            list.add(context.getExceptionHandler());
            listener = Collections.unmodifiableList(list);
        }
        return listener;

    }
1228153
public static ValidationResult validateClassName(String className)
   {
      if (Strings.isNullOrEmpty(className))
         return new ValidationResult(ERROR, Messages.notNullOrEmpty(CLASS_NAME));
      int indexOfDot = className.lastIndexOf(".");
      if (indexOfDot == -1)
      {
         return validateIdentifier(className, CLASS_NAME);
      }
      else
      {
         String packageSequence = className.substring(0, indexOfDot);
         ValidationResult result = validatePackageName(packageSequence);
         if (!result.getType().equals(ResultType.INFO))
         {
            return result;
         }
         String classSequence = className.substring(indexOfDot + 1);
         return validateIdentifier(classSequence, CLASS_NAME);
      }
   }
569799
@SuppressWarnings("unchecked")
    private Map<String, Object> getViewComponentIds()
    {
        Map<Object, Object> attributes = _facesContext.getAttributes();
        Map<String, Object> viewComponentIds;

        if (_parent == null)
        {
            // top level _componentInstance
            viewComponentIds = new HashMap<String, Object>();
            attributes.put(VIEW_IDS, viewComponentIds);
        }
        else
        {
            viewComponentIds = (Map<String, Object>) attributes.get(VIEW_IDS);
            
            // Check if null, this can happen if someone programatically tries to do an include of a 
            // JSP fragment. This code will prevent NullPointerException from happening in such cases.
            if (viewComponentIds == null)
            {
                viewComponentIds = new HashMap<String, Object>();
                attributes.put(VIEW_IDS, viewComponentIds);
            }
        }

        return viewComponentIds;
    }
283488
@SuppressWarnings({"unchecked"})
  public final ArrayList<ConstraintViolation<?>> getValidationErrorSet(final Object pclass) {
    return new ArrayList<>(validationErrorSet.stream()
        .map(violation -> ConstraintViolationImpl.forBeanValidation( //
            violation.getMessageTemplate(), //
            Collections.emptyMap(), //
            Collections.emptyMap(), //
            violation.getMessage(), //
            ((SerializeableConstraintValidationImpl<Object>) violation).getRootBeanClass(), //
            pclass, //
            violation.getLeafBean(), //
            null, //
            violation.getPropertyPath(), //
            violation.getConstraintDescriptor(), //
            null, //
            null))
        .collect(Collectors.toList()));
  }
873958
public String getLabel(JComponent component) {
        String label = component2LabelMap.get(component);
        if (label != null) {
            return label;
        } else {
            return "";
        }
    }
942859
private boolean checkValidClass(Class<?> clazz) {
        return clazz.isAnnotationPresent(Entity.class) || clazz.isAnnotationPresent(MappedSuperclass.class)
            || clazz.isAnnotationPresent(Embeddable.class);

    }
843522
public static List<Field> getClassFields(Class<?> beanClass) {
		Map<String, Field> resultMap = new HashMap<>();
		LinkedList<Field> results = new LinkedList<>();

		Class<?> currentClass = beanClass;
		while (currentClass != null && currentClass != Object.class) {
			for (Field field : currentClass.getDeclaredFields()) {
				if (!field.isSynthetic()) {
					Field v = resultMap.get(field.getName());
					if (v == null) {
						resultMap.put(field.getName(), field);
						results.add(field);
					}
				}
			}
			currentClass = currentClass.getSuperclass();
		}

		return results;
	}
1053653
<T extends Component> List<T> getFormRowChildren(AbstractComponentContainer container, final Class<T> cls) {

        final List<T> result = Lists.newArrayList();
        CmsVaadinUtils.visitDescendants(container, new Predicate<Component>() {

            public boolean apply(Component comp) {

                if (cls.isAssignableFrom(comp.getClass())) {
                    result.add(cls.cast(comp));
                }
                return true;
            }
        });
        return result;
    }
229239
public static List<Object> asList(final Object object, final Class<?> componentType) {
        ArgUtils.notNull(componentType, "componentType");

        if(object == null) {
            return new ArrayList<>();
        }

        if(!object.getClass().isArray()) {
            throw new IllegalArgumentException(String.format("args0 is not arrays : %s.", object.getClass().getName()));
        }

        if(!componentType.isPrimitive()) {
            return Arrays.asList((Object[])object);
        }

        if(componentType.equals(boolean.class)) {
            boolean[] array = (boolean[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(boolean v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(char.class)) {
            char[] array = (char[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(char v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(byte.class)) {
            byte[] array = (byte[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(byte v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(short.class)) {
            short[] array = (short[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(short v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(int.class)) {
            int[] array = (int[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(int v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(long.class)) {
            long[] array = (long[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(long v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(float.class)) {
            float[] array = (float[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(float v : array) {
                list.add(v);
            }
            return list;

        } else if(componentType.equals(double.class)) {
            double[] array = (double[])object;
            List<Object> list = new ArrayList<>(array.length);
            for(double v : array) {
                list.add(v);
            }
            return list;

        }

        throw new IllegalArgumentException(String.format("not support primitive type : %s.", componentType.getName()));

    }
665132
@Override
	protected void validateComponent(final List<Diagnostic> diags) {
		super.validateComponent(diags);

		String[] values = getValue();

		if (values != null) {
			int max = getMaxLength();
			int min = getMinLength();
			Pattern pattern = getComponentModel().pattern;

			for (String value : values) {
				boolean invalid = false;

				if (Util.empty(value)) {
					continue;
				}

				// Minimum Length
				if (min > 0 && value.length() < min) {
					diags.add(createErrorDiagnostic(
							InternalMessages.DEFAULT_VALIDATION_ERROR_MIN_LENGTH, this,
							String.valueOf(min)));
					invalid = true;
				}

				// Maximum Length
				if (max > 0 && value.length() > max) {
					diags.add(createErrorDiagnostic(
							InternalMessages.DEFAULT_VALIDATION_ERROR_MAX_LENGTH, this,
							String.valueOf(max)));
					invalid = true;
				}

				// Pattern
				if (pattern != null) {
					Matcher matcher = pattern.matcher(value);
					if (!matcher.matches()) {
						diags.add(createErrorDiagnostic(
								InternalMessages.DEFAULT_VALIDATION_ERROR_INVALID_PATTERN, this));
						invalid = true;
					}
				}

				// Only report the first invalid item
				if (invalid) {
					break;
				}
			}
		}
	}
216733
public List<WarningsGroup> getByProperty(Class<? extends ICalProperty> propertyClass) {
		List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
		for (WarningsGroup group : this.warnings) {
			ICalProperty property = group.getProperty();
			if (property == null) {
				continue;
			}

			if (propertyClass == property.getClass()) {
				warnings.add(group);
			}
		}
		return warnings;
	}
103238
public static Component findParentByClassname(final Component childComponent,
		final Class<? extends Component> parentClass)
	{
		Component parent = childComponent.getParent();
		while (parent != null)
		{
			if (ClassExtensions.equalsByClassName(parentClass, parent.getClass()))
			{
				break;
			}
			parent = parent.getParent();
		}
		return parent;
	}
1105250
@SuppressWarnings("unchecked")
    @SafeVarargs
    public final boolean containsAnnotations(Class<? extends Annotation>... annotationClass) {
        if (ArrayUtils.isEmpty(annotationClass)) {
            return false;
        }

        for (Object anno : getAnnotations()) {
            for (Class cls : annotationClass) {
                if (((Annotation) anno).annotationType().equals(cls)) {
                    return true;
                }
            }
        }
        return false;
    }
113102
public Component getComponent(int componentIndex)
    {
        if (componentList != null)
            if (componentIndex < componentList.length)
                return componentList[componentIndex];
        return null;
    }