Example usage for org.apache.commons.lang NullArgumentException NullArgumentException

List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.lang NullArgumentException NullArgumentException.

Prototype

public NullArgumentException(String argName) 

Source Link

Document

Instantiates with the given argument name.

Usage

From source file:org.dresdenocl.essentialocl.expressions.factory.EssentialOclFactory.java

/**
 * <p>/*w ww .  j  a v a 2s. c o  m*/
 * Creates a new {@link TupleLiteralPart} from a {@link Variable variable
 * declaration}.
 * </p>
 * 
 * @param variableDeclaration
 *          The variable declaration for which the tuple literal part should
 *          be created
 * 
 * @return A {@link TupleLiteralPart} instance.
 */
public TupleLiteralPart createTupleLiteralPart(Variable variableDeclaration) {

    if (variableDeclaration == null) {
        throw new NullArgumentException("variableDeclaration"); //$NON-NLS-1$
    }

    TupleLiteralPart part;

    // create a new part
    part = ExpressionsFactory.INSTANCE.createTupleLiteralPart();

    // set the property and the value of the part
    part.setProperty(variableDeclaration.asProperty());
    part.setValue(variableDeclaration.getInitExpression());

    return part;
}

From source file:org.dresdenocl.pivotmodel.impl.GenericElements.java

/**
 * Checks the parameters for a binding and throws an exception if they are not
 * valid.//ww w .  j av  a 2 s  .co  m
 * 
 * @param parameters
 *          the list of type parameters
 * @param types
 *          the list of types
 */
public static void checkBindingParameters(List<TypeParameter> parameters, List<? extends Type> types) {

    if (parameters == null || types == null) {
        throw new NullArgumentException("parameters or types"); //$NON-NLS-1$
    }

    if (parameters.size() != types.size()) {
        throw new IllegalArgumentException(
                "The list of type parameters must have the same size as the list of types."); //$NON-NLS-1$
    }

    if (parameters.contains(null) || types.contains(null)) {
        throw new IllegalArgumentException(
                "The lists with type parameters and types must not contain null values."); //$NON-NLS-1$
    }

}

From source file:org.dresdenocl.pivotmodel.impl.TypeImpl.java

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * /*from  w  w  w .  j a va 2  s  .c om*/
 * @generated NOT
 */
@Override
public Type commonSuperType(Type other) {

    if (logger.isDebugEnabled()) {
        logger.debug("commonSuperType(other=" + other + ") - enter"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (other == null) {
        throw new NullArgumentException("other"); //$NON-NLS-1$
    }

    Type commonSuperType;

    // by default there is no common supertype
    commonSuperType = null;

    // check direct conformance of the two types
    if (this.conformsTo(other)) {
        commonSuperType = other;
    }

    else if (other.conformsTo(this)) {
        commonSuperType = this;
    }

    // else check inheritance hierachies of this and the other type
    else {
        // the super types in one inheritance level for this and the other
        // type,
        // respectively, and the transitive closure of all types in both
        // hierachies
        Set<Type> thisSuperTypes, otherSuperTypes, allThisTypes, allOtherTypes;

        // initialize
        thisSuperTypes = new HashSet<Type>();
        otherSuperTypes = new HashSet<Type>();
        allThisTypes = new HashSet<Type>();
        allOtherTypes = new HashSet<Type>();

        // add the parents of both types to the corresponding sets
        thisSuperTypes.addAll(this.getSuperType());
        otherSuperTypes.addAll(other.getSuperType());

        // go up both inheritance hierarchies to the top
        while (!(thisSuperTypes.isEmpty() && otherSuperTypes.isEmpty())) {
            Set<Type> temp = new HashSet<Type>();

            // add the current super types to the transitive closure of each
            // hierarchy
            allThisTypes.addAll(thisSuperTypes);
            allOtherTypes.addAll(otherSuperTypes);

            // check if one of this type's current supertypes is contained
            // in the
            // other type's hierarchy
            for (Type type : thisSuperTypes) {

                if (allOtherTypes.contains(type)) {
                    commonSuperType = type;
                    break;
                }

                // remember the types of the next hierarchy level
                temp.addAll(type.getSuperType());
            }

            // quit if we have found a super type
            if (commonSuperType != null) {
                break;
            }

            // save the next hierarchy level types for the next iteration
            thisSuperTypes.addAll(temp);
            temp.clear();

            // check if one of the other type's current supertypes is
            // contained in
            // this type's hierarchy
            for (Type type : otherSuperTypes) {

                if (allThisTypes.contains(type)) {
                    commonSuperType = type;
                    break;
                }

                // remember the types of the next hierarchy level
                temp.addAll(type.getSuperType());
            }

            // quit if we have found a super type
            if (commonSuperType != null) {
                break;
            }

            // save the next hierarchy level types for the next iteration
            otherSuperTypes.addAll(temp);
            temp.clear();
        }
    }

    if (logger.isDebugEnabled()) {
        logger.debug("commonSuperType() - exit - return value=" + //$NON-NLS-1$
                commonSuperType);
    }

    return commonSuperType;
}

From source file:org.dresdenocl.pivotmodel.impl.TypeImpl.java

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * /*w  ww  .j  a  v a2 s .  c o m*/
 * @generated NOT
 */
@Override
public Operation lookupOperation(String name, List<Type> paramTypes) {

    if (logger.isDebugEnabled()) {
        logger.debug("lookupOperation(name=" + name + ", paramTypes=" //$NON-NLS-1$ //$NON-NLS-2$
                + paramTypes + ") - enter"); //$NON-NLS-1$
    }

    Operation operation = null;

    // precondition check
    if (name == null || paramTypes == null) {
        throw new NullArgumentException("name or paramTypes"); //$NON-NLS-1$
    }

    // look for an operation with that name and matching signature
    for (Operation o : allOperations()) {
        if (name.equals(o.getName()) && o.hasMatchingSignature(paramTypes)) {
            operation = o;
            break;
        }
    }

    if (logger.isDebugEnabled()) {
        logger.debug("lookupOperation() - exit - return value=" + operation); //$NON-NLS-1$
    }

    return operation;
}

From source file:org.ebayopensource.turmeric.eclipse.codegen.utils.CodegenInvoker.java

/**
 * Initializes this invoker, Sets the class path and make the stage ready
 * for code generation. The key here is the class loader which is loaded
 * with all the class path required. Also we don't use the the standard IBM
 * or SUN java class loader, reason being those class loaders seem to be
 * using a locked stream for reading the classes from a jar file and the
 * custom class loader address this issue.
 *
 * @param project the project/*from   www . j a  v a  2s  .c o m*/
 * @return the codegen invoker
 * @throws Exception the exception
 */
public static CodegenInvoker init(IProject project) throws Exception {
    if (project == null) {
        throw new NullArgumentException("Project can not be null");
    }
    Set<URL> urls = JDTUtil.resolveClasspathToURLs(project);

    SOAPluginClassLoader classLoader = new SOAPluginClassLoader("Codegen", urls.toArray(new URL[0]));

    CodegenInvoker codegenInvoker = new CodegenInvoker();
    codegenInvoker.setSoaPluginClassLoader(classLoader);
    return codegenInvoker;
}

From source file:org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverConnection.simpleDSRequestBuilder.SimpleRequestBuilder.java

private SimpleRequestBuilder buildNewRequestInt(String interfaceKey) {
    if (interfaceKey == null) {
        throw new NullArgumentException("interfaceKey");
    }/*  w  ww. j av  a2  s  .c o  m*/
    request = "/" + interfaceKey + "/";
    classIsChosen = false;
    functionIsChosen = false;
    parameterIsAdded = false;
    return this;
}

From source file:org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverConnection.simpleDSRequestBuilder.SimpleRequestBuilder.java

private SimpleRequestBuilder addRequestClassInt(String requestClassKey) {
    if (!classIsChosen && requestClassKey != null) {
        classIsChosen = true;/*from  w  w  w .j av a2  s.com*/
        request = request + requestClassKey + "/";
    } else {
        if (!classIsChosen) {
            throw new IllegalArgumentException(ExeptionConstants.CLASS_ALREADY_ADDED);
        } else {
            throw new NullArgumentException("requestClassKey");
        }
    }
    return this;
}

From source file:org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverConnection.simpleDSRequestBuilder.SimpleRequestBuilder.java

private SimpleRequestBuilder addFunctionInt(String functionKey) {
    if (!classIsChosen) {
        throw new IllegalArgumentException(ExeptionConstants.NO_CLASS_ADDED);
    }/*from ww  w .  j  a  v a  2s. c o m*/
    if (!functionIsChosen) {
        if (functionKey != null) {
            functionIsChosen = true;
            request = request + functionKey;
        } else {
            throw new NullArgumentException("functionKey");
        }
    } else {
        throw new IllegalArgumentException(ExeptionConstants.FUNCTION_ALLREADY_ADDED);
    }
    return this;
}

From source file:org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverConnection.simpleDSRequestBuilder.SimpleRequestBuilder.java

private SimpleRequestBuilder addParameterInt(String parameterKey, String parameterValue) {
    if (allRight()) {
        if (parameterKey == null) {
            throw new NullArgumentException("parameterKey");
        }//from w w  w .j  a v  a2 s . c om
        if (parameterValue != null) {
            if (!parameterIsAdded) {
                parameterIsAdded = true;
                request = request + "?" + parameterKey + "=" + parameterValue;
            } else {
                request = request + "&" + parameterKey + "=" + parameterValue;
            }
        }
    }
    return this;
}

From source file:org.ensembl.healthcheck.util.Pair.java

public Pair(A a, B b) {
    super(a);// w ww  .  j av  a2  s .  c o m
    if (b == null) {
        throw new NullArgumentException(
                this.getClass().getSimpleName() + " cannot be instantiated with null arguments");
    }
    this.b = b;
}