@Override public Map<String, String> getProperties() { return newHashMap( properties ); }
private Map<String, Object> getBindings(Object[] arguments, List<String> parameterNames) { Map<String, Object> bindings = newHashMap(); for ( int i = 0; i < arguments.length; i++ ) { bindings.put( parameterNames.get( i ), arguments[i] ); } return bindings; }
private Map<String, Object> getBindings(Object[] arguments, List<String> parameterNames) { Map<String, Object> bindings = newHashMap(); for ( int i = 0; i < arguments.length; i++ ) { bindings.put( parameterNames.get( i ), arguments[i] ); } return bindings; }
private static Map<String, String> getSchemasByVersion() { Map<String, String> schemasByVersion = CollectionHelper.newHashMap( 3 ); schemasByVersion.put( "1.0", "META-INF/validation-configuration-1.0.xsd" ); schemasByVersion.put( "1.1", "META-INF/validation-configuration-1.1.xsd" ); schemasByVersion.put( "2.0", "META-INF/validation-configuration-2.0.xsd" ); return schemasByVersion; }
public ConstraintValidatorContext addConstraintViolation() { constraintViolationCreationContexts.add( new ConstraintViolationCreationContext( messageTemplate, propertyPath, messageParameters != null ? newHashMap( messageParameters ) : Collections.<String, Object>emptyMap(), expressionVariables != null ? newHashMap( expressionVariables ) : Collections.<String, Object>emptyMap(), dynamicPayload ) ); return ConstraintValidatorContextImpl.this; } }
public void insertSequence(Sequence sequence) { if ( sequence == null ) { return; } if ( sequenceMap == null ) { sequenceMap = CollectionHelper.newHashMap( 5 ); } sequenceMap.putIfAbsent( sequence.getDefiningClass(), sequence ); }
public boolean evaluateScriptAssertExpression(Object object, String alias) { Map<String, Object> bindings = newHashMap(); bindings.put( alias, object ); return evaluateScriptAssertExpression( bindings ); }
private BootstrapConfigurationImpl() { this.defaultProviderClassName = null; this.constraintValidatorFactoryClassName = null; this.messageInterpolatorClassName = null; this.traversableResolverClassName = null; this.parameterNameProviderClassName = null; this.validatedExecutableTypes = DEFAULT_VALIDATED_EXECUTABLE_TYPES; this.isExecutableValidationEnabled = true; this.constraintMappingResourcePaths = newHashSet(); this.properties = newHashMap(); }
public boolean evaluateScriptAssertExpression(Object object, String alias) { Map<String, Object> bindings = newHashMap(); bindings.put( alias, object ); return evaluateScriptAssertExpression( bindings ); }
@Override public HibernateConstraintValidatorContext addMessageParameter(String name, Object value) { Contracts.assertNotNull( name, "null is not a valid value for a parameter name" ); if ( messageParameters == null ) { messageParameters = newHashMap(); } this.messageParameters.put( name, value ); return this; }
@Override public HibernateConstraintValidatorContext addExpressionVariable(String name, Object value) { Contracts.assertNotNull( name, "null is not a valid value for an expression variable name" ); if ( expressionVariables == null ) { expressionVariables = newHashMap(); } this.expressionVariables.put( name, value ); return this; }
/** * Builds up the method meta data for this type; each meta-data entry will be stored under the signature of the * represented method and all the methods it overrides. */ private Map<String, ExecutableMetaData> bySignature(Set<ExecutableMetaData> executables) { Map<String, ExecutableMetaData> theValue = newHashMap(); for ( ExecutableMetaData executableMetaData : executables ) { for ( String signature : executableMetaData.getSignatures() ) { theValue.put( signature, executableMetaData ); } } return theValue; }
/** * Builds up the method meta data for this type; each meta-data entry will be stored under the signature of the * represented method and all the methods it overrides. */ private Map<String, ExecutableMetaData> bySignature(Set<ExecutableMetaData> executables) { Map<String, ExecutableMetaData> theValue = newHashMap(); for ( ExecutableMetaData executableMetaData : executables ) { for ( String signature : executableMetaData.getSignatures() ) { theValue.put( signature, executableMetaData ); } } return theValue; }
private static Map<TypeVariable<?>, CascadingMetaDataBuilder> addArrayElementCascadingMetaData(final Class<?> enclosingType, Map<TypeVariable<?>, CascadingMetaDataBuilder> containerElementTypesCascadingMetaData, Map<Class<?>, Class<?>> groupConversions) { Map<TypeVariable<?>, CascadingMetaDataBuilder> amendedCascadingMetadata = CollectionHelper.newHashMap( containerElementTypesCascadingMetaData.size() + 1 ); amendedCascadingMetadata.putAll( containerElementTypesCascadingMetaData ); TypeVariable<?> cascadableTypeParameter = new ArrayElement( enclosingType ); amendedCascadingMetadata.put( cascadableTypeParameter, new CascadingMetaDataBuilder( enclosingType, cascadableTypeParameter, true, Collections.emptyMap(), groupConversions ) ); return amendedCascadingMetadata; }
public MappingXmlParser(ConstraintHelper constraintHelper, ParameterNameProvider parameterNameProvider, ClassLoader externalClassLoader) { this.constraintHelper = constraintHelper; this.annotationProcessingOptions = new AnnotationProcessingOptionsImpl(); this.defaultSequences = newHashMap(); this.constrainedElements = newHashMap(); this.xmlParserHelper = new XmlParserHelper(); this.parameterNameProvider = parameterNameProvider; this.classLoadingHelper = new ClassLoadingHelper( externalClassLoader ); }
private Map<String, Object> buildAnnotationParameterMap(Annotation annotation) { final Method[] declaredMethods = run( GetDeclaredMethods.action( annotation.annotationType() ) ); Map<String, Object> parameters = newHashMap( declaredMethods.length ); for ( Method m : declaredMethods ) { Object value = run( GetAnnotationParameter.action( annotation, m.getName(), Object.class ) ); parameters.put( m.getName(), value ); } return Collections.unmodifiableMap( parameters ); }
public MappingXmlParser(ConstraintHelper constraintHelper, TypeResolutionHelper typeResolutionHelper, ValueExtractorManager valueExtractorManager, ClassLoader externalClassLoader) { this.constraintHelper = constraintHelper; this.typeResolutionHelper = typeResolutionHelper; this.valueExtractorManager = valueExtractorManager; this.annotationProcessingOptions = new AnnotationProcessingOptionsImpl(); this.defaultSequences = newHashMap(); this.constrainedElements = newHashMap(); this.xmlParserHelper = new XmlParserHelper(); this.classLoadingHelper = new ClassLoadingHelper( externalClassLoader, run( GetClassLoader.fromContext() ) ); }
private static Map<String, ExecutableDescriptorImpl> getConstrainedMethodsAsDescriptors(Map<String, ExecutableMetaData> executableMetaDataMap, boolean defaultGroupSequenceIsRedefined, List<Class<?>> resolvedDefaultGroupSequence) { Map<String, ExecutableDescriptorImpl> constrainedMethodDescriptors = newHashMap(); for ( ExecutableMetaData executableMetaData : executableMetaDataMap.values() ) { if ( executableMetaData.getKind() == ElementKind.METHOD && executableMetaData.isConstrained() ) { ExecutableDescriptorImpl descriptor = executableMetaData.asDescriptor( defaultGroupSequenceIsRedefined, resolvedDefaultGroupSequence ); for ( String signature : executableMetaData.getSignatures() ) { constrainedMethodDescriptors.put( signature, descriptor ); } } } return constrainedMethodDescriptors; }
Map<Class<?>, Class<?>> buildGroupConversionMap(List<GroupConversionType> groupConversionTypes, String defaultPackage) { Map<Class<?>, Class<?>> groupConversionMap = newHashMap(); for ( GroupConversionType groupConversionType : groupConversionTypes ) { Class<?> fromClass = classLoadingHelper.loadClass( groupConversionType.getFrom(), defaultPackage ); Class<?> toClass = classLoadingHelper.loadClass( groupConversionType.getTo(), defaultPackage ); groupConversionMap.put( fromClass, toClass ); } return groupConversionMap; } }
private void addOverrideAttributes(Map<ClassIndexWrapper, Map<String, Object>> overrideParameters, Method m, OverridesAttribute... attributes) { Object value = run( GetAnnotationParameter.action( annotation, m.getName(), Object.class ) ); for ( OverridesAttribute overridesAttribute : attributes ) { ensureAttributeIsOverridable( m, overridesAttribute ); ClassIndexWrapper wrapper = new ClassIndexWrapper( overridesAttribute.constraint(), overridesAttribute.constraintIndex() ); Map<String, Object> map = overrideParameters.get( wrapper ); if ( map == null ) { map = newHashMap(); overrideParameters.put( wrapper, map ); } map.put( overridesAttribute.name(), value ); } }