本文整理汇总了Java中sun.tools.java.ClassDefinition.getType方法的典型用法代码示例。如果您正苦于以下问题:Java ClassDefinition.getType方法的具体用法?Java ClassDefinition.getType怎么用?Java ClassDefinition.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.tools.java.ClassDefinition
的用法示例。
在下文中一共展示了ClassDefinition.getType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forNCInterface
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an NCInterfaceType for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static NCInterfaceType forNCInterface( ClassDefinition classDef,
ContextStack stack) {
if (stack.anyErrors()) return null;
boolean doPop = false;
try {
// Do we already have it?
sun.tools.java.Type theType = classDef.getType();
Type existing = getType(theType,stack);
if (existing != null) {
if (!(existing instanceof NCInterfaceType)) return null; // False hit.
// Yep, so return it...
return (NCInterfaceType) existing;
}
NCInterfaceType it = new NCInterfaceType(stack, classDef);
putType(theType,it,stack);
stack.push(it);
doPop = true;
if (it.initialize(stack)) {
stack.pop(true);
return it;
} else {
removeType(theType,stack);
stack.pop(false);
return null;
}
} catch (CompilerError e) {
if (doPop) stack.pop(false);
return null;
}
}
示例2: forSpecial
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create a SpecialInterfaceType object for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static SpecialInterfaceType forSpecial ( ClassDefinition theClass,
ContextStack stack) {
if (stack.anyErrors()) return null;
// Do we already have it?
sun.tools.java.Type type = theClass.getType();
Type existing = getType(type,stack);
if (existing != null) {
if (!(existing instanceof SpecialInterfaceType)) return null; // False hit.
// Yep, so return it...
return (SpecialInterfaceType) existing;
}
// Is it special?
if (isSpecial(type,theClass,stack)) {
// Yes...
SpecialInterfaceType result = new SpecialInterfaceType(stack,0,theClass);
putType(type,result,stack);
stack.push(result);
if (result.initialize(type,stack)) {
stack.pop(true);
return result;
} else {
removeType(type,stack);
stack.pop(false);
return null;
}
}
return null;
}
示例3: forRemote
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an RemoteType for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static RemoteType forRemote(ClassDefinition classDef,
ContextStack stack,
boolean quiet) {
if (stack.anyErrors()) return null;
boolean doPop = false;
RemoteType result = null;
try {
// Do we already have it?
sun.tools.java.Type theType = classDef.getType();
Type existing = getType(theType,stack);
if (existing != null) {
if (!(existing instanceof RemoteType)) return null; // False hit.
// Yep, so return it...
return (RemoteType) existing;
}
// Could this be a remote type?
if (couldBeRemote(quiet,stack,classDef)) {
// Yes, so check it...
RemoteType it = new RemoteType(stack,classDef);
putType(theType,it,stack);
stack.push(it);
doPop = true;
if (it.initialize(quiet,stack)) {
stack.pop(true);
result = it;
} else {
removeType(theType,stack);
stack.pop(false);
}
}
} catch (CompilerError e) {
if (doPop) stack.pop(false);
}
return result;
}
示例4: forValue
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an ValueType object for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static ValueType forValue(ClassDefinition classDef,
ContextStack stack,
boolean quiet) {
if (stack.anyErrors()) return null;
// Do we already have it?
sun.tools.java.Type theType = classDef.getType();
String typeKey = theType.toString();
Type existing = getType(typeKey,stack);
if (existing != null) {
if (!(existing instanceof ValueType)) return null; // False hit.
// Yep, so return it...
return (ValueType) existing;
}
// Is this java.lang.Class?
boolean javaLangClass = false;
if (classDef.getClassDeclaration().getName() == idJavaLangClass) {
// Yes, so replace classDef with one for
// javax.rmi.CORBA.ClassDesc...
javaLangClass = true;
BatchEnvironment env = stack.getEnv();
ClassDeclaration decl = env.getClassDeclaration(idClassDesc);
ClassDefinition def = null;
try {
def = decl.getClassDefinition(env);
} catch (ClassNotFound ex) {
classNotFound(stack,ex);
return null;
}
classDef = def;
}
// Could this be a value?
if (couldBeValue(stack,classDef)) {
// Yes, so check it...
ValueType it = new ValueType(classDef,stack,javaLangClass);
putType(typeKey,it,stack);
stack.push(it);
if (it.initialize(stack,quiet)) {
stack.pop(true);
return it;
} else {
removeType(typeKey,stack);
stack.pop(false);
return null;
}
} else {
return null;
}
}
示例5: forAbstract
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an AbstractType for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static AbstractType forAbstract(ClassDefinition classDef,
ContextStack stack,
boolean quiet)
{
boolean doPop = false;
AbstractType result = null;
try {
// Do we already have it?
sun.tools.java.Type theType = classDef.getType();
Type existing = getType(theType,stack);
if (existing != null) {
if (!(existing instanceof AbstractType)) return null; // False hit.
// Yep, so return it...
return (AbstractType) existing;
}
// Could this be an abstract?
if (couldBeAbstract(stack,classDef,quiet)) {
// Yes, so try it...
AbstractType it = new AbstractType(stack, classDef);
putType(theType,it,stack);
stack.push(it);
doPop = true;
if (it.initialize(quiet,stack)) {
stack.pop(true);
result = it;
} else {
removeType(theType,stack);
stack.pop(false);
}
}
} catch (CompilerError e) {
if (doPop) stack.pop(false);
}
return result;
}
示例6: forNCClass
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an NCClassType for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static NCClassType forNCClass(ClassDefinition classDef,
ContextStack stack) {
if (stack.anyErrors()) return null;
boolean doPop = false;
try {
// Do we already have it?
sun.tools.java.Type theType = classDef.getType();
Type existing = getType(theType,stack);
if (existing != null) {
if (!(existing instanceof NCClassType)) return null; // False hit.
// Yep, so return it...
return (NCClassType) existing;
}
NCClassType it = new NCClassType(stack, classDef);
putType(theType,it,stack);
stack.push(it);
doPop = true;
if (it.initialize(stack)) {
stack.pop(true);
return it;
} else {
removeType(theType,stack);
stack.pop(false);
return null;
}
} catch (CompilerError e) {
if (doPop) stack.pop(false);
return null;
}
}
示例7: forImplementation
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an ImplementationType for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static ImplementationType forImplementation(ClassDefinition classDef,
ContextStack stack,
boolean quiet) {
if (stack.anyErrors()) return null;
boolean doPop = false;
ImplementationType result = null;
try {
// Do we already have it?
sun.tools.java.Type theType = classDef.getType();
Type existing = getType(theType,stack);
if (existing != null) {
if (!(existing instanceof ImplementationType)) return null; // False hit.
// Yep, so return it...
return (ImplementationType) existing;
}
// Could this be an implementation?
if (couldBeImplementation(quiet,stack,classDef)) {
// Yes, so check it...
ImplementationType it = new ImplementationType(stack, classDef);
putType(theType,it,stack);
stack.push(it);
doPop = true;
if (it.initialize(stack,quiet)) {
stack.pop(true);
result = it;
} else {
removeType(theType,stack);
stack.pop(false);
}
}
} catch (CompilerError e) {
if (doPop) stack.pop(false);
}
return result;
}
示例8: forSpecial
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create a SpecialClassType object for the given class.
*
* If the class is not a properly formed or if some other error occurs, the
* return value will be null, and errors will have been reported to the
* supplied BatchEnvironment.
*/
public static SpecialClassType forSpecial (ClassDefinition theClass,
ContextStack stack) {
if (stack.anyErrors()) return null;
sun.tools.java.Type type = theClass.getType();
// Do we already have it?
String typeKey = type.toString() + stack.getContextCodeString();
Type existing = getType(typeKey,stack);
if (existing != null) {
if (!(existing instanceof SpecialClassType)) return null; // False hit.
// Yep, so return it...
return (SpecialClassType) existing;
}
// Is it a special type?
int typeCode = getTypeCode(type,theClass,stack);
if (typeCode != TYPE_NONE) {
// Yes...
SpecialClassType result = new SpecialClassType(stack,typeCode,theClass);
putType(typeKey,result,stack);
stack.push(result);
stack.pop(true);
return result;
} else {
return null;
}
}