Refine search
/** * Validate {@code enumClass}. * @param <E> the type of the enumeration * @param enumClass to check * @return {@code enumClass} * @throws NullPointerException if {@code enumClass} is {@code null} * @throws IllegalArgumentException if {@code enumClass} is not an enum class * @since 3.2 */ private static <E extends Enum<E>> Class<E> asEnum(final Class<E> enumClass) { Validate.notNull(enumClass, ENUM_CLASS_MUST_BE_DEFINED); Validate.isTrue(enumClass.isEnum(), S_DOES_NOT_SEEM_TO_BE_AN_ENUM_TYPE, enumClass); return enumClass; } }
/** * Add default filters to apply to each request. * * @param filter The filter to add * @param additionalFilters An optional array of additional filters to add */ public static void filters(Filter filter, Filter... additionalFilters) { Validate.notNull(filter, "Filter cannot be null"); RestAssured.filters.add(filter); if (additionalFilters != null) { Collections.addAll(RestAssured.filters, additionalFilters); } }
Validate.notNull(transaction,"Transaction cannot be null"); Validate.notNull((String)transaction.getTransactionDetails().get("TRANSACTIONID"), "Transaction details must contain a TRANSACTIONID"); Validate.notNull(order,"Order must not be null"); Validate.notNull(order.getCurrency(),"Order nust contain Currency object"); configurationMap.put("mode", mode); configurationMap.put("acct1.UserName", configuration.getIntegrationKeys().get("username")); configurationMap.put("acct1.Password", configuration.getIntegrationKeys().get("api")); configurationMap.put("acct1.Signature", configuration.getIntegrationKeys().get("signature"));
throws IntegrationException { Validate.notNull(configuration, "Configuration must not be null"); Validate.notNull(payment, "Payment must not be null"); Validate.notNull(summary, "OrderTotalSummary must not be null"); item.setAmount(amt); lineItems.add(item); paymentDetailsList.add(paymentDetails); configurationMap.put("mode", mode); configurationMap.put("acct1.UserName", configuration.getIntegrationKeys().get("username")); configurationMap.put("acct1.Password", configuration.getIntegrationKeys().get("api")); configurationMap.put("acct1.Signature", configuration.getIntegrationKeys().get("signature"));
public List<RelationInfoExtended> getRelationInfoFor(final JpaEntityMetadata entityMetadata, final String path) { Validate.notNull(entityMetadata, "entity metadata is required"); Validate.notBlank(path, "path is required"); List<RelationInfoExtended> infos = new ArrayList<RelationInfoExtended>(); String[] split = StringUtils.split(path, '.'); RelationInfo info = entityMetadata.getRelationInfos().get(split[0]); Validate.notNull(info, "%s.%s not found or not a relation field", entityMetadata.getDestination(), split[0]); ClassOrInterfaceTypeDetails childCid = getTypeLocationService().getTypeDetails(info.childType); JpaEntityMetadata childMetadata = getMetadataService().get(JpaEntityMetadata.createIdentifier(childCid)); infos.add(new RelationInfoExtended(info, entityMetadata, childMetadata)); if (split.length > 1) { infos .addAll(getRelationInfoFor(childMetadata, StringUtils.join(split, '.', 1, split.length))); } return infos; }
/** * Constructor * * @param annotationType the type of annotation for which these are the * metadata (required) * @param attributeValues the given annotation's values; can be * <code>null</code> */ DefaultAnnotationMetadata(final JavaType annotationType, final List<AnnotationAttributeValue<?>> attributeValues) { Validate.notNull(annotationType, "Annotation type required"); this.annotationType = annotationType; attributes = new ArrayList<AnnotationAttributeValue<?>>(); attributeMap = new HashMap<JavaSymbolName, AnnotationAttributeValue<?>>(); if (attributeValues != null) { attributes.addAll(attributeValues); for (final AnnotationAttributeValue<?> value : attributeValues) { attributeMap.put(value.getName(), value); } } }
public void add(final Class<?> clazz) { Validate.notNull(clazz, "A class to provide conversion services is required"); Validate.isTrue(fields.get(clazz) == null, "Class '%s' is already registered for completion services", clazz); final Map<String, Field> ffields = new HashMap<String, Field>(); for (final Field field : clazz.getFields()) { final int modifier = field.getModifiers(); if (Modifier.isStatic(modifier) && Modifier.isPublic(modifier)) { ffields.put(field.getName(), field); } } Validate.notEmpty(ffields, "Zero public static fields accessible in '%s'", clazz); fields.put(clazz, ffields); }
public RuntimeResourceDefinition getResourceDefinition(FhirVersionEnum theVersion, String theResourceName) { Validate.notNull(theVersion, "theVersion can not be null"); validateInitialized(); if (theVersion.equals(myVersion.getVersion())) { return getResourceDefinition(theResourceName); } Map<String, Class<? extends IBaseResource>> nameToType = myVersionToNameToResourceType.get(theVersion); if (nameToType == null) { nameToType = new HashMap<>(); Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> existing = new HashMap<>(); ModelScanner.scanVersionPropertyFile(null, nameToType, theVersion, existing); Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> newVersionToNameToResourceType = new HashMap<>(); newVersionToNameToResourceType.putAll(myVersionToNameToResourceType); newVersionToNameToResourceType.put(theVersion, nameToType); myVersionToNameToResourceType = newVersionToNameToResourceType; } Class<? extends IBaseResource> resourceType = nameToType.get(theResourceName.toLowerCase()); if (resourceType == null) { throw new DataFormatException(createUnknownResourceNameError(theResourceName, theVersion)); } return getResourceDefinition(resourceType); }
/** * Registers an event listener. Will not add a pre-existing listener * object to the list if <code>allowDuplicate</code> is false. * * @param listener the event listener (may not be <code>null</code>). * @param allowDuplicate the flag for determining if duplicate listener * objects are allowed to be registered. * * @throws NullPointerException if <code>listener</code> is <code>null</code>. * @since 3.5 */ public void addListener(final L listener, final boolean allowDuplicate) { Validate.notNull(listener, "Listener object cannot be null."); if (allowDuplicate) { listeners.add(listener); } else if (!listeners.contains(listener)) { listeners.add(listener); } }
Validate.notNull(capturableTransaction,"Transaction cannot be null"); Validate.notNull((String)capturableTransaction.getTransactionDetails().get("TRANSACTIONID"), "Transaction details must contain a TRANSACTIONID"); Validate.notNull(order,"Order must not be null"); Validate.notNull(order.getCurrency(),"Order nust contain Currency object"); configurationMap.put("mode", mode); configurationMap.put("acct1.UserName", configuration.getIntegrationKeys().get("username")); configurationMap.put("acct1.Password", configuration.getIntegrationKeys().get("api")); configurationMap.put("acct1.Signature", configuration.getIntegrationKeys().get("signature"));
protected void bindMetadataProvider(final MetadataProvider mp) { synchronized (lock) { Validate.notNull(mp, "Metadata provider required"); final String mid = mp.getProvidesType(); Validate.isTrue(MetadataIdentificationUtils.isIdentifyingClass(mid), "Metadata provider '%s' violated interface contract by returning '%s'", mp, mid); Validate.isTrue(!providerMap.containsKey(mid), "Metadata provider '%s' already is providing metadata for '%s'", providerMap.get(mid), mid); providers.add(mp); providerMap.put(mid, mp); } }
public NiFiBolt(final SiteToSiteClientConfig clientConfig, final NiFiDataPacketBuilder builder, final int tickFrequencySeconds) { Validate.notNull(clientConfig); Validate.notNull(builder); Validate.isTrue(tickFrequencySeconds > 0); this.clientConfig = clientConfig; this.builder = builder; this.tickFrequencySeconds = tickFrequencySeconds; }
public void registerMatcher(final String addingClass, final Matcher<? extends CustomDataAccessor> matcher) { Validate.notNull(addingClass, "The calling class must be specified"); Validate.notNull(matcher, "The matcher must be specified"); taggerMap.put(addingClass + matcher.getCustomDataKey(), matcher); }
/** * Constructs an instance for controlling a local process. * * @param pid process id identifying the process to attach to * * @throws IllegalArgumentException if pid is not a positive integer */ MBeanProcessController(final MBeanControllerParameters arguments, final int pid) { notNull(arguments, "Invalid arguments '" + arguments + "' specified"); isTrue(pid > 0, "Invalid pid '" + pid + "' specified"); this.pid = pid; this.arguments = arguments; }
Validate.notNull(firstArgument, "You need to supply at least one argument"); final List<Argument> arguments = new LinkedList<Argument>(); arguments.add(Argument.arg(firstArgument)); if (additionalArguments != null && additionalArguments.length > 0) { for (Object additionalArgument : additionalArguments) { arguments.add(Argument.arg(additionalArgument));
public FhirContext getContext(FhirVersionEnum theVersion) { Validate.notNull(theVersion, "theVersion must not be null"); synchronized (ourRetrievalContexts) { FhirContext retVal = ourRetrievalContexts.get(theVersion); if (retVal == null) { retVal = new FhirContext(theVersion); ourRetrievalContexts.put(theVersion, retVal); } return retVal; } }
/** * Specifies parameter ordering.<br> * By default parameter ordering == {@link OrderBy#NATURAL}.<br> * Use {@link #withParameterOrdering(Comparator)} to set a custom ordering. * * @param orderBy parameter ordering * @return this builder */ public Swagger2MarkupConfigBuilder withParameterOrdering(OrderBy orderBy) { Validate.notNull(orderBy, "%s must not be null", "orderBy"); Validate.isTrue(orderBy != OrderBy.CUSTOM, "You must provide a custom comparator if orderBy == OrderBy.CUSTOM"); config.parameterOrderBy = orderBy; return this; }
Validate.notNull(delivery, "Delivery cannot be null"); Validate.notNull(delivery.getCountry(), "Delivery.country cannot be null"); Validate.notNull(packages, "packages cannot be null"); Validate.notEmpty(packages, "packages cannot be empty"); shippingOption.setOptionId(MODULE_CODE); options.add(shippingOption);
private void processTypesWithTag(final Object tag, final LocatedTypeCallback callback) { Validate.notNull(tag, "Tag required"); Validate.notNull(callback, "Callback required"); // If the cache doesn't yet contain the tag it should be added if (!tagToMidMap.containsKey(tag)) { tagToMidMap.put(tag, new HashSet<String>()); } // Before processing the call any changes to the project should be // processed and the cache updated accordingly updateTypeCache(); for (final String locatedMid : tagToMidMap.get(tag)) { final ClassOrInterfaceTypeDetails located = getTypeCache().getTypeDetails(locatedMid); callback.process(located); } }