/** * Get a list of all methods which the given class declares, implements, * overrides or inherits. Methods are added by adding first all methods of * the class itself and its implemented interfaces, then the super class and * its interfaces, etc. * * @param clazz the class for which to retrieve the methods * * @return set of all methods of the given class */ public static List<Method> getAllMethods(Class<?> clazz) { Contracts.assertNotNull( clazz ); List<Method> methods = newArrayList(); for ( Class<?> hierarchyClass : ClassHierarchyHelper.getHierarchy( clazz ) ) { Collections.addAll( methods, run( GetMethods.action( hierarchyClass ) ) ); } return methods; }
private List<String> getParameterNames(Parameter[] parameters) { List<String> parameterNames = newArrayList(); for ( Parameter parameter : parameters ) { // If '-parameters' is used at compile time, actual names will be returned. Otherwise, it will be arg0, arg1... parameterNames.add( parameter.getName() ); } return parameterNames; } }
private List<String> getParameterNames(Parameter[] parameters) { List<String> parameterNames = newArrayList(); for ( Parameter parameter : parameters ) { // If '-parameters' is used at compile time, actual names will be returned. Otherwise, it will be arg0, arg1... parameterNames.add( parameter.getName() ); } return parameterNames; } }
@SafeVarargs public static <T> ArrayList<T> newArrayList(Iterable<T>... iterables) { ArrayList<T> resultList = newArrayList(); for ( Iterable<T> oneIterable : iterables ) { for ( T oneElement : oneIterable ) { resultList.add( oneElement ); } } return resultList; }
@SuppressWarnings("unchecked") ConstraintDefinitionContribution<A> build() { return new ConstraintDefinitionContribution<>( annotationType, CollectionHelper.newArrayList( validatorDescriptors ), includeExistingValidators ); }
private <A extends Annotation> List<Type> findSuitableValidatorTypes(Type type, Iterable<Type> availableValidatorTypes) { List<Type> determinedSuitableTypes = newArrayList(); for ( Type validatorType : availableValidatorTypes ) { if ( TypeHelper.isAssignable( validatorType, type ) && !determinedSuitableTypes.contains( validatorType ) ) { determinedSuitableTypes.add( validatorType ); } } return determinedSuitableTypes; }
private List<String> getParameterNames(int parameterCount) { List<String> parameterNames = newArrayList(); for ( int i = 0; i < parameterCount; i++ ) { parameterNames.add( getPrefix() + i ); } return parameterNames; }
private List<String> getParameterNames(int parameterCount) { List<String> parameterNames = newArrayList(); for ( int i = 0; i < parameterCount; i++ ) { parameterNames.add( getPrefix() + i ); } return parameterNames; }
public static List<ExecutableElement> forConstructors(Constructor<?>[] constructors) { List<ExecutableElement> executableElements = newArrayList( constructors.length ); for ( Constructor<?> constructor : constructors ) { executableElements.add( forConstructor( constructor ) ); } return executableElements; }
public static List<ExecutableElement> forMethods(Method[] methods) { List<ExecutableElement> executableElements = newArrayList( methods.length ); for ( Method method : methods ) { executableElements.add( forMethod( method ) ); } return executableElements; }
@SuppressWarnings("unchecked") ConstraintDefinitionContribution<A> build() { return new ConstraintDefinitionContribution<A>( annotationType, CollectionHelper.newArrayList( validatorTypes ), includeExistingValidators ); } }
private List<String> getParameterNames(int parameterCount) { List<String> parameterNames = newArrayList(); for ( int i = 0; i < parameterCount; i++ ) { parameterNames.add( getPrefix() + i ); } return parameterNames; }
private List<ParameterDescriptor> parametersAsDescriptors(boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence) { List<ParameterDescriptor> parameterDescriptorList = newArrayList(); for ( ParameterMetaData parameterMetaData : parameterMetaDataList ) { parameterDescriptorList.add( parameterMetaData.asDescriptor( defaultGroupSequenceRedefined, defaultGroupSequence ) ); } return parameterDescriptorList; }
private Class<?>[] getGroups(GroupsType groupsType, String defaultPackage) { if ( groupsType == null ) { return new Class[] { }; } List<Class<?>> groupList = newArrayList(); for ( String groupClass : groupsType.getValue() ) { groupList.add( classLoadingHelper.loadClass( groupClass, defaultPackage ) ); } return groupList.toArray( new Class[groupList.size()] ); }
private ConstraintTree(ConstraintDescriptorImpl<A> descriptor, ConstraintTree<?> parent) { this.parent = parent; this.descriptor = descriptor; final Set<ConstraintDescriptorImpl<?>> composingConstraints = descriptor.getComposingConstraintImpls(); children = newArrayList( composingConstraints.size() ); for ( ConstraintDescriptorImpl<?> composingDescriptor : composingConstraints ) { ConstraintTree<?> treeNode = createConstraintTree( composingDescriptor ); children.add( treeNode ); } }
private List<Class<?>> createGroupSequence(GroupSequenceType groupSequenceType, String defaultPackage) { List<Class<?>> groupSequence = newArrayList(); if ( groupSequenceType != null ) { for ( String groupName : groupSequenceType.getValue() ) { Class<?> group = classLoadingHelper.loadClass( groupName, defaultPackage ); groupSequence.add( group ); } } return groupSequence; } }
@Override public <T> List<BeanConfiguration<? super T>> getBeanConfigurationForHierarchy(Class<T> beanClass) { List<BeanConfiguration<? super T>> configurations = newArrayList(); for ( Class<? super T> clazz : ClassHierarchyHelper.getHierarchy( beanClass ) ) { BeanConfiguration<? super T> configuration = getBeanConfiguration( clazz ); if ( configuration != null ) { configurations.add( configuration ); } } return configurations; }
/** * Finds type use annotation constraints defined on the type argument. */ private List<ConstraintDescriptorImpl<?>> findTypeUseConstraints(Member member, AnnotatedType typeArgument) { List<ConstraintDescriptorImpl<?>> metaData = newArrayList(); for ( Annotation annotation : typeArgument.getAnnotations() ) { metaData.addAll( findConstraintAnnotations( member, annotation, ElementType.TYPE_USE ) ); } return metaData; }
public TokenCollector(String originalMessageDescriptor, InterpolationTermType interpolationTermType) throws MessageDescriptorFormatException { this.originalMessageDescriptor = originalMessageDescriptor; this.interpolationTermType = interpolationTermType; this.currentParserState = new MessageState(); this.tokenList = newArrayList(); parse(); }
public TokenCollector(String originalMessageDescriptor, InterpolationTermType interpolationTermType) throws MessageDescriptorFormatException { this.originalMessageDescriptor = originalMessageDescriptor; this.interpolationTermType = interpolationTermType; this.currentParserState = new BeginState(); this.tokenList = newArrayList(); parse(); }