src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Type.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * reserved comment block |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT REMOVE OR ALTER! |
3 * @LastModified: Oct 2017 |
4 */ |
4 */ |
5 /* |
5 /* |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
8 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
74 |
74 |
75 /** |
75 /** |
76 * Factory method to instantiate object types. Returns a pre-defined |
76 * Factory method to instantiate object types. Returns a pre-defined |
77 * instance for java.lang.Object.class and java.lang.String.class. |
77 * instance for java.lang.Object.class and java.lang.String.class. |
78 */ |
78 */ |
79 public static Type newObjectType(Class clazz) { |
79 public static Type newObjectType(Class<?> clazz) { |
80 if (clazz == java.lang.Object.class) { |
80 if (clazz == java.lang.Object.class) { |
81 return Type.Object; |
81 return Type.Object; |
82 } |
82 } |
83 else if (clazz == java.lang.String.class) { |
83 else if (clazz == java.lang.String.class) { |
84 return Type.ObjectString; |
84 return Type.ObjectString; |
187 * Translates an object of this type to the external (Java) type denoted |
187 * Translates an object of this type to the external (Java) type denoted |
188 * by <code>clazz</code>. This method is used to translate parameters |
188 * by <code>clazz</code>. This method is used to translate parameters |
189 * when external functions are called. |
189 * when external functions are called. |
190 */ |
190 */ |
191 public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, |
191 public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, |
192 Class clazz) { |
192 Class<?> clazz) { |
193 ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, |
193 ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, |
194 toString(), clazz.getClass().toString()); |
194 toString(), clazz.getClass().toString()); |
195 classGen.getParser().reportError(Constants.FATAL, err); |
195 classGen.getParser().reportError(Constants.FATAL, err); |
196 } |
196 } |
197 |
197 |
199 * Translates an external (Java) type denoted by <code>clazz</code> to |
199 * Translates an external (Java) type denoted by <code>clazz</code> to |
200 * an object of this type. This method is used to translate return values |
200 * an object of this type. This method is used to translate return values |
201 * when external functions are called. |
201 * when external functions are called. |
202 */ |
202 */ |
203 public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, |
203 public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, |
204 Class clazz) { |
204 Class<?> clazz) { |
205 ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, |
205 ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, |
206 clazz.getClass().toString(), toString()); |
206 clazz.getClass().toString(), toString()); |
207 classGen.getParser().reportError(Constants.FATAL, err); |
207 classGen.getParser().reportError(Constants.FATAL, err); |
208 } |
208 } |
209 |
209 |