Copyright (c) 2017, 2018 IBM Corporation and others. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0 Contributors: IBM Corporation - initial API and implementation
/******************************************************************************* * Copyright (c) 2017, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/
package org.eclipse.jdt.internal.core; import java.util.Map; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.compiler.CharOperation; public class SourceModule extends NamedMember implements AbstractModule { public SourceModule(JavaElement parent, String name) { super(parent, name); } @Override public int getFlags() throws JavaModelException { ModuleDescriptionInfo info = (ModuleDescriptionInfo) getElementInfo(); return info.getModifiers(); } @Override public char getHandleMementoDelimiter() { return JavaElement.JEM_MODULE; } @Override public String[] getCategories() throws JavaModelException { ModuleDescriptionInfo info = (ModuleDescriptionInfo) getElementInfo(); Map<IJavaElement,String[]> map = info.getCategories(); if (map == null) return CharOperation.NO_STRINGS; String[] categories = map.get(this); if (categories == null) return CharOperation.NO_STRINGS; return categories; } @Override public String toString(String lineDelimiter) { StringBuffer buffer = new StringBuffer(); try { toStringContent(buffer, lineDelimiter); } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } return buffer.toString(); } }