/** * @param executor the executor that should be used to create threads to run {@link Consumer}s; may not be null * @param adapter the adapter for consumers; may not be null */ protected RingBufferBuilder( Executor executor, ConsumerAdapter<T, C> adapter ) { CheckArg.isNotNull(executor, "executor"); CheckArg.isNotNull(adapter, "adapter"); this.executor = executor; this.adapter = adapter; }
public DelegatingClassLoader( ClassLoader parent, Iterable<? extends ClassLoader> delegates ) { super(new URL[0], parent); CheckArg.isNotNull(delegates, "delegates"); this.delegates = delegates; }
/** * Construct a Reflection instance that cache's some information about the target class. The target class is the Class object * upon which the methods will be found. * * @param targetClass the target class * @throws IllegalArgumentException if the target class is null */ public Reflection( Class<?> targetClass ) { CheckArg.isNotNull(targetClass, "targetClass"); this.targetClass = targetClass; }
protected AbstractValueFactory( PropertyType type, TextDecoder decoder, ValueFactory<String> stringValueFactory ) { CheckArg.isNotNull(type, "type"); this.propertyType = type; this.decoder = decoder != null ? decoder : DEFAULT_DECODER; this.stringValueFactory = stringValueFactory; }
/** * Create an exception with the invalid query and a message. * * @param query the query that is invalid * @param message */ public InvalidQueryException( String query, String message ) { super(message); CheckArg.isNotNull(query, "query"); this.query = query; }
/** * Get the time required to come up with the canonical plan. * * @param unit the time unit that should be used * @return the time to plan, in the desired units * @throws IllegalArgumentException if the unit is null */ public long getPlanningTime( TimeUnit unit ) { CheckArg.isNotNull(unit, "unit"); return unit.convert(planningNanos, TimeUnit.NANOSECONDS); }
/** * Get the time required to determine or select a (more) optimal plan. * * @param unit the time unit that should be used * @return the time to determine an optimal plan, in the desired units * @throws IllegalArgumentException if the unit is null */ public long getOptimizationTime( TimeUnit unit ) { CheckArg.isNotNull(unit, "unit"); return unit.convert(optimizationNanos, TimeUnit.NANOSECONDS); }
/** * Get the time required to formulate the structure of the results. * * @param unit the time unit that should be used * @return the time to formulate the results, in the desired units * @throws IllegalArgumentException if the unit is null */ public long getResultFormulationTime( TimeUnit unit ) { CheckArg.isNotNull(unit, "unit"); return unit.convert(resultFormulationNanos, TimeUnit.NANOSECONDS); }
/** * Remove from this engine the language with the given name. * * @param language the name of the language, which is to match the {@link QueryParser#getLanguage() language} of the parser * @return the parser for the language, or null if the engine had no support for the named language * @throws IllegalArgumentException if the language is null */ public QueryParser removeLanguage( String language ) { CheckArg.isNotNull(language, "language"); return this.parsers.remove(language.toLowerCase()); }
/** * Attempt to find the Type given a symbol. The matching is done independent of case. * * @param symbol the symbol * @return the Type having the supplied symbol, or null if there is no Type with the supplied symbol * @throws IllegalArgumentException if the symbol is null */ public static Type forSymbol( String symbol ) { CheckArg.isNotNull(symbol, "symbol"); return TYPE_BY_SYMBOL.get(symbol.toUpperCase().trim()); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.Graph.To#to(org.modeshape.graph.Location) */ public T to( Location desiredLocation ) { CheckArg.isNotNull(desiredLocation, "desiredLocation"); this.to = desiredLocation; return and(); }
/** * {@inheritDoc} * * @see Location#getIdProperty(Name) */ @Override public final Property getIdProperty( Name name ) { CheckArg.isNotNull(name, "name"); Property property = getIdProperties().get(0); // this is fast return property.getName().equals(name) ? property : null; }
public StringURLClassLoader( List<String> urls ) { super(new URL[0], null); CheckArg.isNotNull(urls, "urls"); for (String url : urls) { try { super.addURL(new URL(url)); } catch (MalformedURLException e) { LOGGER.debug("{0} is not a valid url ", url); } } } }
public ConstraintBuilder isIn( Iterable<Object> literals ) { CheckArg.isNotNull(literals, "literals"); Collection<StaticOperand> right = new ArrayList<StaticOperand>(); for (Object literal : literals) { right.add(literal instanceof Literal ? (Literal)literal : new Literal(literal)); } return this.constraintBuilder.setConstraint(new SetCriteria(left, right)); }
public Map<Location, Property> on( Collection<Location> locations ) { CheckArg.isNotNull(locations, "locations"); final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>(); String workspace = getCurrentWorkspaceName(); for (Location location : locations) { requests.add(new ReadPropertyRequest(location, workspace, name)); } return execute(requests); }
public boolean includes( Path path ) { CheckArg.isNotNull(path, "path"); path = getAbsolutePath(path); return request.includes(path); }
/** * {@inheritDoc} */ public ValueFactory<?> getValueFactory( Object prototype ) { CheckArg.isNotNull(prototype, "prototype"); PropertyType inferredType = PropertyType.discoverType(prototype); assert inferredType != null; return getValueFactory(inferredType); }
public Map<Location, Property> on( Path first, Path... additional ) { CheckArg.isNotNull(first, "first"); final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>(); String workspace = getCurrentWorkspaceName(); requests.add(new ReadPropertyRequest(Location.create(first), workspace, name)); for (Path path : additional) { requests.add(new ReadPropertyRequest(Location.create(path), workspace, name)); } return execute(requests); }
protected AbstractValueComparatorsTest( Comparator<T> comparator, T... validNonNullValues ) { CheckArg.isNotNull(comparator, "comparator"); CheckArg.isNotEmpty(validNonNullValues, "validNonNullValues"); this.comparator = comparator; this.validNonNullValues = validNonNullValues; }