List of usage examples for org.apache.commons.lang Validate notNull
public static void notNull(Object object, String message)
Validate an argument, throwing IllegalArgumentException
if the argument is null
.
Validate.notNull(myObject, "The object must not be null");
From source file:com.edmunds.etm.rules.api.BlockedUrlRule.java
public BlockedUrlRule(UrlRule urlRule, Set<UrlRule> blockingRules) { Validate.notNull(urlRule, "Blocked rule is null"); Validate.notNull(blockingRules, "Blocking rules are null"); this.urlRule = urlRule; this.blockingRules = blockingRules; }
From source file:com.opengamma.financial.analytics.conversion.SwaptionConverterDataProvider.java
public SwaptionConverterDataProvider(final String dataSourceName, final String fieldName, final String dataProvider) { Validate.notNull(dataSourceName, "data source name"); Validate.notNull(fieldName, "field name"); Validate.notNull(dataProvider, "data provider"); //_swapConverter = new DefinitionConverterDataProvider(dataSourceName, fieldName, dataProvider); }
From source file:com.opengamma.analytics.math.curve.MultiplyCurveSpreadFunction.java
/** * @param curves An array of curves, not null or empty * @return A function that will find the value of each curve at the given input <i>x</i> and multiply each in turn *//* w w w. j a va 2 s .co m*/ @SuppressWarnings("unchecked") @Override public Function<Double, Double> evaluate(final Curve<Double, Double>... curves) { Validate.notNull(curves, "x"); Validate.notEmpty(curves, "curves"); return new Function<Double, Double>() { @Override public Double evaluate(final Double... x) { Validate.notNull(x, "x"); Validate.notEmpty(x, "x"); final double x0 = x[0]; double y = curves[0].getYValue(x0); for (int i = 1; i < curves.length; i++) { y *= curves[i].getYValue(x0); } return y; } }; }
From source file:com.opengamma.analytics.math.statistics.descriptive.SampleSkewnessCalculator.java
/** * @param x The array of data, not null, must contain at least three data points * @return The sample skewness//ww w . java2 s . co m */ @Override public Double evaluate(final double[] x) { Validate.notNull(x, "x"); Validate.isTrue(x.length >= 3, "Need at least three points to calculate sample skewness"); double sum = 0; double variance = 0; final double mean = MEAN.evaluate(x); for (final Double d : x) { final double diff = d - mean; variance += diff * diff; sum += diff * diff * diff; } final int n = x.length; variance /= n - 1; return Math.sqrt(n - 1.) * sum / (Math.pow(variance, 1.5) * Math.sqrt(n) * (n - 2)); }
From source file:com.opengamma.analytics.math.curve.InterpolatedCurveBuildingFunction.java
public InterpolatedCurveBuildingFunction(final LinkedHashMap<String, double[]> knotPoints, LinkedHashMap<String, Interpolator1D> interpolators) { Validate.notNull(knotPoints, "null knot points"); Validate.notNull(interpolators, "null interpolators"); int count = 0; Set<String> names = knotPoints.keySet(); for (String name : names) { int size = knotPoints.get(name).length; Validate.isTrue(size > 0, "no knot points for " + name); count += size;//from www . j a v a 2s. c om } _knotPoints = knotPoints; _interpolators = interpolators; _nNodes = count; }
From source file:com.vmware.identity.idm.AlternativeOCSP.java
public AlternativeOCSP(URL responderURL, X509Certificate signingCert) { Validate.notNull(responderURL, "responderURL"); this._responderURL = responderURL; this._responderSigningCert = signingCert; }
From source file:com.opengamma.analytics.financial.model.volatility.surface.SABRBlackEquivalentVolatilitySurfaceModel.java
@Override public VolatilitySurface getSurface(final OptionDefinition option, final SABRDataBundle data) { Validate.notNull(option, "option definition"); Validate.notNull(data);/*from w ww . j a v a2s . co m*/ final double k = option.getStrike(); final double t = option.getTimeToExpiry(data.getDate()); final double alpha = data.getAlpha(); final double beta = data.getBeta(); final double rho = data.getRho(); final double ksi = data.getVolOfVol(); final double b = data.getCostOfCarry(); final double f = data.getSpot() * Math.exp(b * t); return new VolatilitySurface(ConstantDoublesSurface .from(SABR_FUNCTION.getVolatilityFunction(new EuropeanVanillaOption(k, t, true), f) .evaluate(new SABRFormulaData(alpha, beta, rho, ksi)))); }
From source file:com.evolveum.midpoint.web.component.SecurityContextAwareCallable.java
protected SecurityContextAwareCallable(SecurityEnforcer enforcer, Authentication authentication) { Validate.notNull(enforcer, "Security enforcer must not be null."); this.enforcer = enforcer; this.authentication = authentication; }
From source file:com.opengamma.analytics.financial.model.finitedifference.NeumannBoundaryCondition.java
/** * Neumann boundary condition, i.e. du/dx(A,t) = f(t), where A is the boundary level, and f(t) is some specified function of time * @param timeValue The value of u at the boundary, i.e. du/dx(A,t) = f(t) * @param level The boundary level (A)/*w w w . j a va 2 s . c om*/ * @param isLower True if this represents a lower boundary */ public NeumannBoundaryCondition(final Function1D<Double, Double> timeValue, final double level, final boolean isLower) { Validate.notNull(timeValue, "null timeValue"); _timeValue = timeValue; _level = level; _isLower = isLower; }
From source file:net.daboross.bukkitdev.asyncsql.SQLConnectionInfo.java
public SQLConnectionInfo(String host, int port, String database, String username, String password) { Validate.notNull(host, "Host cannot be null"); Validate.notNull(database, "Database cannot be null"); Validate.notNull(username, "Username cannot be null"); Validate.notNull(password, "Password cannot be null"); this.url = String.format("jdbc:mysql://%s:%s/%s", host, port, database); this.properties = new Properties(); this.properties.setProperty("user", username); this.properties.setProperty("password", password); }