当前位置: 首页>>代码示例>>Java>>正文


Java VilException.ID_TYPE_INCOMPATIBILITY属性代码示例

本文整理汇总了Java中net.ssehub.easy.instantiation.core.model.common.VilException.ID_TYPE_INCOMPATIBILITY属性的典型用法代码示例。如果您正苦于以下问题:Java VilException.ID_TYPE_INCOMPATIBILITY属性的具体用法?Java VilException.ID_TYPE_INCOMPATIBILITY怎么用?Java VilException.ID_TYPE_INCOMPATIBILITY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.ssehub.easy.instantiation.core.model.common.VilException的用法示例。


在下文中一共展示了VilException.ID_TYPE_INCOMPATIBILITY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: throwIncompatibleParameter

/**
 * Throws an exception for the case that parameter are incompatible.
 * 
 * @param args the actual arguments
 * @throws VilException the created exception (happens in any case)
 */
protected void throwIncompatibleParameter(Object[] args) throws VilException {
    StringBuilder tmp = new StringBuilder("(");
    int start = 0;
    if (!isStatic()) {
        start = 1;
    }
    for (int i = start; i < args.length; i++) {
        if (i > start) {
            tmp.append(", ");
        }
        if (null == args[i]) {
            tmp.append("null");
        } else {
            tmp.append(args[i].getClass().getSimpleName());
        }
    }
    tmp.append(")");
    throw new VilException("incompatible parameter " + tmp + " cannot be applied to " 
        + getJavaSignature(), VilException.ID_TYPE_INCOMPATIBILITY);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:26,代码来源:OperationDescriptor.java

示例2: setValue

@Override
public void setValue(Object owner, Object value) throws VilException {
    if (null != owner) {
        IvmlElement elt;
        if (CompatibilityResult.COMPATIBLE == Utils.isCompatible(owner, DecisionVariable.class)) {
            elt = ((DecisionVariable) owner).getAttribute(getName());
        } else if (CompatibilityResult.COMPATIBLE == Utils.isCompatible(owner, Configuration.class)) {
            elt = ((Configuration) owner).getAttribute(getName());
        } else {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        if (elt instanceof AbstractIvmlVariable) {
            ((AbstractIvmlVariable) elt).setValue(value);
        } else {
            EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID).info("Configuration field " + getName() 
                + " not accessible via byName");
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:19,代码来源:IvmlAnnotationFieldDescriptor.java

示例3: check

/**
 * Checks the given (potentially existing) <code>descriptor</code> for validity against the new information.
 * 
 * @param descriptor the existing descriptor
 * @param type the type to be registered
 * @param key the name key of <code>type</code>
 * @param checkRegistered check whether <code>key</code> is already registered
 * @throws VilException in case of violations
 */
private static void check(TypeDescriptor<?> descriptor, Class<?> type, String key, boolean checkRegistered) 
    throws VilException {
    if (null != descriptor) {
        String msg = ArtifactFactory.checkReplacement(descriptor.getTypeClass(), type);
        if (null != msg) {
            throw new VilException(msg, VilException.ID_ALREADY_REGISTERED);
        }
        if (checkRegistered && type.equals(descriptor.getTypeClass())) {
            throw new VilException("type '" + key + "' is already registered", 
                 VilException.ID_ALREADY_REGISTERED);
        }
        if (!descriptor.getTypeClass().isAssignableFrom(type)) {
            throw new VilException("type replacement requires subtype relationship", 
                VilException.ID_TYPE_INCOMPATIBILITY);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:26,代码来源:RtVilTypeRegistry.java

示例4: getValue

@Override
public Object getValue(Object owner) throws VilException {
    Object result;
    if (null == owner) {
        result = null;
    } else {
        if (Utils.isCompatible(owner, Configuration.class) != CompatibilityResult.COMPATIBLE) {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        Configuration cfg = (Configuration) owner;
        DecisionVariable tmp = cfg.getByName(getName());
        if (null == tmp) {
            tmp = cfg.getByName(getVariable().getQualifiedName());
        }
        if (null == tmp) {
            result = null;
            EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID).info("Configuration field " + getName() 
                + " not accessible via byName");
        } else {
            if (getType().isCollection()) {
                IDatatype type = tmp.getDecisionVariable().getDeclaration().getType();
                type = DerivedDatatype.resolveToBasis(type);
                if (Set.TYPE.isAssignableFrom(type)) {
                    result = tmp.variablesSet();
                } else {
                    result = tmp.variables();
                }
            } else {
                result = getSpecificBaseValue(tmp);
                if (null == result) {
                    result = tmp;
                }
            }
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:37,代码来源:IvmlConfigurationFieldDescriptor.java

示例5: setValue

@Override
public void setValue(Object owner, Object value) throws VilException {
    if (null != owner) {
        if (Utils.isCompatible(owner, Configuration.class) != CompatibilityResult.COMPATIBLE) {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        DecisionVariable tmp = ((Configuration) owner).getByName(getName());
        if (null != tmp) {
            tmp.setValue(value);
        } else {
            EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID).info("Configuration field " + getName() 
                + " not accessible via byName");
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:15,代码来源:IvmlConfigurationFieldDescriptor.java

示例6: getMetaValue

@Override
public Object getMetaValue(Object owner) throws VilException {
    if (Utils.isCompatible(owner, Configuration.class) != CompatibilityResult.COMPATIBLE) {
        throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
    }
    return ((Configuration) owner).getByName(getName());
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:7,代码来源:IvmlConfigurationFieldDescriptor.java

示例7: invoke

@Override
public Object invoke(Object... args) throws VilException {
    Object result;
    if (null == args[0]) {
        result = null;
    } else {
        if (Utils.isCompatible(args, Configuration.class) != CompatibilityResult.COMPATIBLE) {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        result = args[0];
    } 
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:13,代码来源:IvmlConfigurationConversionOperationDescriptor.java

示例8: invoke

@Override
public Object invoke(Object... args) throws VilException {
    Object result;
    if (null == args[0]) {
        result = null;
    } else {
        if (Utils.isCompatible(args, Configuration.class) != CompatibilityResult.COMPATIBLE) {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        result = ((Configuration) args[0]).getByName(getName());
    } 
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:13,代码来源:IvmlConfigurationOperationDescriptor.java

示例9: setValue

@Override
public void setValue(Object owner, Object value) throws VilException {
    if (null != owner) {
        if (Utils.isCompatibleToDecisionVariable(owner) != CompatibilityResult.COMPATIBLE) {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        DecisionVariable tmp = ((DecisionVariable) owner).getByName(getName());
        if (null == tmp) {
            EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID).info("Configuration field " + getName() 
                + " not accessible via byName");
        } else {
            tmp.setValue(value);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:15,代码来源:IvmlAccessorFieldDescriptor.java

示例10: getMetaValue

@Override
public Object getMetaValue(Object owner) throws VilException {
    if (Utils.isCompatibleToDecisionVariable(owner) != CompatibilityResult.COMPATIBLE) {
        throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
    }
    return ((DecisionVariable) owner).getByName(getName());
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:7,代码来源:IvmlAccessorFieldDescriptor.java

示例11: getValue

@Override
public Object getValue(Object owner) throws VilException {
    Object result;
    if (null == owner) {
        result = null;
    } else {
        if (CompatibilityResult.COMPATIBLE == Utils.isCompatible(owner, DecisionVariable.class)) {
            result = ((DecisionVariable) owner).getAttribute(getName());
        } else if (CompatibilityResult.COMPATIBLE == Utils.isCompatible(owner, Configuration.class)) {
            result = ((Configuration) owner).getAttribute(getName());
        } else {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        if (result instanceof AbstractIvmlVariable) {
            AbstractIvmlVariable annotation = (AbstractIvmlVariable) result;
            if (getType().isCollection()) {
                result = annotation.variables();
            } else {
                Object tmp = getSpecificBaseValue(annotation);
                if (null != tmp && annotation.isConfigured()) {
                    result = tmp;
                }
            }
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:27,代码来源:IvmlAnnotationFieldDescriptor.java

示例12: getMetaValue

@Override
public Object getMetaValue(Object owner) throws VilException {
    Object result;
    if (CompatibilityResult.COMPATIBLE == Utils.isCompatible(owner, DecisionVariable.class)) {
        result = ((DecisionVariable) owner).getAttribute(getName());
    } else if (CompatibilityResult.COMPATIBLE == Utils.isCompatible(owner, Configuration.class)) {
        result = ((Configuration) owner).getAttribute(getName());
    } else {
        throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:12,代码来源:IvmlAnnotationFieldDescriptor.java

示例13: create

/**
 * Creates an instance of the type according to the given parameters. 
 * 
 * @param params the parameters
 * @return the created instance
 * @throws VilException in case that the creation does not work
 */
public T create(Object...params) throws VilException {
    boolean found = false;
    T result = null;
    int oCount = getOperationsCount();
    for (int o = 0; !found && o < oCount; o++) {
        OperationDescriptor op = getOperation(o);
        if (op.isConstructor() && CompatibilityResult.COMPATIBLE == op.isCompatible(getTypeClass(), params)) {
            found = true;
            Object res = op.invoke(params);
            if (null == res) {
                throw new VilException("VIL constructor does not return a result", 
                       VilException.ID_NO_RESULT);
            } else {
                try {
                    result = getTypeClass().cast(res);
                } catch (ClassCastException e) {
                    throw new VilException("VIL constructor returns wrong result type", 
                        VilException.ID_TYPE_INCOMPATIBILITY);
                }
            }
        }
    }
    if (!found) {
        throw new VilException("VIL constructor not found", VilException.ID_OP_NOT_FOUND);
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:34,代码来源:ReflectionTypeDescriptor.java

示例14: insertElement

/**
 * Inserts an element into the current block of the last found position. Requires visiting to build a resolver 
 * before.
 * 
 * @param element the element to be inserted
 * @throws VilException in case of type problems 
 */
void insertElement(IRuleElement element) throws VilException {
    if (null != currentBlock) {
        int pos = currentBlockPosition;
        if (InsertionPoint.AFTER_THIS == point) {
            pos++;
        }
        currentBlock.addBodyElement(pos, element);
        if (rule.getDefaultReturnType() != rule.getReturnType()) { 
            boolean found = false;
            for (int b = rule.getBodyElementCount() - 1; !found && b >= 0; b--) {
                IRuleElement elt = rule.getBodyElement(b);
                if (elt instanceof ExpressionStatement) {
                    ExpressionStatement eStmt = (ExpressionStatement) elt;
                    TypeDescriptor<?> exType = eStmt.getExpression().inferType();
                    if (!rule.getReturnType().isAssignableFrom(exType)) {
                        throw new VilException("Expected return type '" + rule.getReturnType().getVilName()
                            + "' does not match last expression type '" + exType.getVilName() + "'", 
                            VilException.ID_TYPE_INCOMPATIBILITY);
                    }
                    found = true;
                }
            }
        }
    } else {
        throw new VilException("No current block", VilException.ID_INTERNAL);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:34,代码来源:BuildResolverVisitor.java

示例15: getValue

@Override
public Object getValue(Object owner) throws VilException {
    Object result;
    if (null == owner) {
        result = null;
    } else if (owner instanceof CompoundValue) {
        CompoundValue cValue = (CompoundValue) owner;
        Value val = cValue.getNestedValue(getName());
        if (null != val) {
            result = val.getValue();
        } else {
            result = null;
        }
    } else {
        if (Utils.isCompatibleToDecisionVariable(owner) != CompatibilityResult.COMPATIBLE) {
            throw new VilException("incompatible arguments", VilException.ID_TYPE_INCOMPATIBILITY);
        }
        DecisionVariable ownerVar = (DecisionVariable) owner;
        DecisionVariable tmp = ownerVar.getByName(getName());
        if (null == tmp) {
            result = null;
            EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID).info("Configuration field " + getName() 
                + " not accessible via byName");
        } else {
            if (getType().isCollection()) {
                IDatatype type = tmp.getDecisionVariable().getDeclaration().getType();
                type = DerivedDatatype.resolveToBasis(type);
                if (Set.TYPE.isAssignableFrom(type)) {
                    result = tmp.variablesSet();
                } else {
                    result = tmp.variables();
                }
            } else {
                result = getSpecificBaseValue(tmp);
                if (null == result && tmp.isConfigured()) {
                    result = tmp;
                }
            }
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:42,代码来源:IvmlAccessorFieldDescriptor.java


注:本文中的net.ssehub.easy.instantiation.core.model.common.VilException.ID_TYPE_INCOMPATIBILITY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。