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


Java Constants类代码示例

本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.Constants的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Constants类属于com.sun.org.apache.xalan.internal.xsltc.compiler包,在下文中一共展示了Constants类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadSource

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:TransformerFactoryImpl.java

示例2: translateTo

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * Translates a string into an object of internal type <code>type</code>.
 * The translation to int is undefined since strings are always converted
 * to reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else if (type == Type.ObjectString) {
        // NOP -> same representation
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:StringType.java

示例3: translateFrom

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * Translates an external (primitive) Java type into a string.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
 */
public void translateFrom(ClassGenerator classGen,
    MethodGenerator methodGen, Class clazz)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (clazz.getName().equals("java.lang.String")) {
        // same internal representation, convert null to ""
        il.append(DUP);
        final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
        il.append(POP);
        il.append(new PUSH(cpg, ""));
        ifNonNull.setTarget(il.append(NOP));
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:StringType.java

示例4: translateTo

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * Translates an integer into an object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        final Type type) {
    if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:IntType.java

示例5: translateTo

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * Translates a real into an object of internal type <code>type</code>. The
 * translation to int is undefined since reals are never converted to ints.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else if (type == Type.Int) {
        translateTo(classGen, methodGen, (IntType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:RealType.java

示例6: translateFrom

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * Translates an external (primitive) Java type into a real. Expects a java
 * object on the stack and pushes a real (i.e., a double).
 */
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
                          Class clazz) {
    InstructionList il = methodGen.getInstructionList();

    if (clazz == Character.TYPE || clazz == Byte.TYPE ||
        clazz == Short.TYPE || clazz == Integer.TYPE) {
        il.append(I2D);
    }
    else if (clazz == Long.TYPE) {
        il.append(L2D);
    }
    else if (clazz == Float.TYPE) {
        il.append(F2D);
    }
    else if (clazz == Double.TYPE) {
        il.append(NOP);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:RealType.java

示例7: translateTo

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
/**
 * Translates a real into an object of internal type <code>type</code>. The
 * translation to int is undefined since booleans are always converted to
 * reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:BooleanType.java

示例8: CompareGenerator

import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; //导入依赖的package包/类
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:CompareGenerator.java


注:本文中的com.sun.org.apache.xalan.internal.xsltc.compiler.Constants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。