/** * Checks whether the given class has been imported. * * @param clazz * the class to check, must not be null. * * @return true if import exists, otherwise false. */ public boolean hasImport(MetaClass clazz) { checkThread(); if (clazz.isArray()) { clazz = clazz.getComponentType(); } return imports != null && imports.containsKey(clazz.getName()) && imports.get(clazz.getName()).equals(getImportForClass(clazz)); }
/** * Checks whether the given class has been imported. * * @param clazz * the class to check, must not be null. * * @return true if import exists, otherwise false. */ public boolean hasImport(MetaClass clazz) { checkThread(); if (clazz.isArray()) { clazz = clazz.getComponentType(); } return imports != null && imports.containsKey(clazz.getName()) && imports.get(clazz.getName()).equals(getImportForClass(clazz)); }
/** * Imports the given class. * * @param clazz * the class to import, must not be null. If it is an array type (of any number of dimensions), its non-array * component type will be imported. * * @return the current context with the import added. */ public Context addImport(MetaClass clazz) { checkThread(); initImports(); while (clazz.isArray()) { clazz = clazz.getComponentType(); } if (!imports.containsKey(clazz.getName())) { final String imp = getImportForClass(clazz); if (imp != null) { imports.put(clazz.getName(), imp); } } return this; }
/** * Imports the given class. * * @param clazz * the class to import, must not be null. If it is an array type (of any number of dimensions), its non-array * component type will be imported. * * @return the current context with the import added. */ public Context addImport(MetaClass clazz) { checkThread(); initImports(); while (clazz.isArray()) { clazz = clazz.getComponentType(); } if (!imports.containsKey(clazz.getName())) { final String imp = getImportForClass(clazz); if (imp != null) { imports.put(clazz.getName(), imp); } } return this; }