Class EclipseJavaProject
- java.lang.Object
-
- org.faktorips.devtools.abstraction.AWrapper<org.eclipse.jdt.core.IJavaElement>
-
- org.faktorips.devtools.abstraction.eclipse.internal.EclipseJavaElement
-
- org.faktorips.devtools.abstraction.eclipse.internal.EclipseJavaProject
-
- All Implemented Interfaces:
AAbstraction,AJavaElement,AJavaProject
public class EclipseJavaProject extends EclipseJavaElement implements AJavaProject
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMSGCODE_JAVA_PROJECT_HAS_BUILDPATH_ERRORSValidation message code to indicate that the corresponding Java Project has build path errors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()A Java element exists if its corresponding resource exists and contains information for this element.java.util.Set<APackageFragmentRoot>getAllPackageFragmentRoots()Returns all of the existing package fragment roots that exist on the classpath, in the order they are defined by the classpath.java.util.Map<java.lang.String,java.lang.String>getOptions()Returns the options for this project.java.nio.file.PathgetOutputLocation()Returns the default output location for this project as a path relative to the containing workspace.AProjectgetProject()Returns the corresponding project.java.util.Set<AJavaProject>getReferencedJavaProjects()Returns all other Java projects referenced by this project.java.lang.Runtime.VersiongetSourceVersion()Returns the Java version number for this project's source code.booleanhasBuildState()Returns whether this project has previously been built and retains some information about that build.booleanisJavaFolder(AResource resource)Examines thisIJavaProjectand its relation to the given resource.APackageFragmentRoottoPackageFragmentRoot(java.lang.String externalLibraryPath)Returns the package fragment root for an external library.APackageFragmentRoottoPackageFragmentRoot(AResource resource)Returns theresourceas package fragment root.org.eclipse.jdt.core.IJavaProjectunwrap()Returns the platform-specific object corresponding to this abstraction.org.faktorips.runtime.MessageListvalidateJavaProjectBuildPath()Validates whether this project's build path is configured correctly, adding any errors to the returned list.-
Methods inherited from class org.faktorips.devtools.abstraction.eclipse.internal.EclipseJavaElement
getJavaProject, getPath, getResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.faktorips.devtools.abstraction.AJavaElement
getJavaProject, getPath, getResource
-
-
-
-
Field Detail
-
MSGCODE_JAVA_PROJECT_HAS_BUILDPATH_ERRORS
public static final java.lang.String MSGCODE_JAVA_PROJECT_HAS_BUILDPATH_ERRORS
Validation message code to indicate that the corresponding Java Project has build path errors.- See Also:
- Constant Field Values
-
-
Method Detail
-
unwrap
public org.eclipse.jdt.core.IJavaProject unwrap()
Description copied from interface:AAbstractionReturns the platform-specific object corresponding to this abstraction. The generic type parameter is used to avoid casts when assigning to platform-specific objects. It is the obligation of the caller to make sure the right type is used, otherwise aClassCastExceptionwill be thrown.Sample usage:
interface ACalendar extends AAbstraction[...] class LocalDateAsCalendarWrapper extends AWrapper<LocalDate>[...] [...] ACalendar calendar = Wrappers.of(LocalDate.now()).as(ACalendar.class); [...] LocalDate date = calendar.unwrap();- Specified by:
unwrapin interfaceAAbstraction- Overrides:
unwrapin classAWrapper<org.eclipse.jdt.core.IJavaElement>- See Also:
Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.
-
exists
public boolean exists()
Description copied from interface:AJavaElementA Java element exists if its corresponding resource exists and contains information for this element.- Specified by:
existsin interfaceAJavaElement- Specified by:
existsin interfaceAJavaProject- Overrides:
existsin classEclipseJavaElement- Returns:
- whether this element exists
-
getOutputLocation
public java.nio.file.Path getOutputLocation()
Description copied from interface:AJavaProjectReturns the default output location for this project as a path relative to the containing workspace.- Specified by:
getOutputLocationin interfaceAJavaProject
-
toPackageFragmentRoot
public APackageFragmentRoot toPackageFragmentRoot(java.lang.String externalLibraryPath)
Description copied from interface:AJavaProjectReturns the package fragment root for an external library. The Path must either be a file or a folder outside of the workspace.- Specified by:
toPackageFragmentRootin interfaceAJavaProject- Parameters:
externalLibraryPath- the path to the external library, either a folder or archive file
-
toPackageFragmentRoot
public APackageFragmentRoot toPackageFragmentRoot(AResource resource)
Description copied from interface:AJavaProjectReturns theresourceas package fragment root. Every sub folder of theresourcewill be considered as java package and therefore must be excluded in the path of theresource.For example the path of the
resourcein a typical eclipse project would besrc. In a maven project the path would besrc/main/java- Specified by:
toPackageFragmentRootin interfaceAJavaProject- Parameters:
resource- the path to the root, either a folder or archive file
-
getProject
public AProject getProject()
Description copied from interface:AJavaProjectReturns the corresponding project.- Specified by:
getProjectin interfaceAJavaProject
-
hasBuildState
public boolean hasBuildState()
Description copied from interface:AJavaProjectReturns whether this project has previously been built and retains some information about that build.- Specified by:
hasBuildStatein interfaceAJavaProject
-
getSourceVersion
public java.lang.Runtime.Version getSourceVersion()
Description copied from interface:AJavaProjectReturns the Java version number for this project's source code.- Specified by:
getSourceVersionin interfaceAJavaProject
-
getReferencedJavaProjects
public java.util.Set<AJavaProject> getReferencedJavaProjects()
Description copied from interface:AJavaProjectReturns all other Java projects referenced by this project.- Specified by:
getReferencedJavaProjectsin interfaceAJavaProject
-
isJavaFolder
public boolean isJavaFolder(AResource resource)
Examines thisIJavaProjectand its relation to the given resource. Returnstrueif the given resource corresponds to a classpath entry of the Java project. Returnstrueif the given resource corresponds to a folder that is either the Java project's default output location or the output location of one of the project's classpath entries.Falseotherwise.- Specified by:
isJavaFolderin interfaceAJavaProject
-
validateJavaProjectBuildPath
public org.faktorips.runtime.MessageList validateJavaProjectBuildPath()
Description copied from interface:AJavaProjectValidates whether this project's build path is configured correctly, adding any errors to the returned list.- Specified by:
validateJavaProjectBuildPathin interfaceAJavaProject
-
getOptions
public java.util.Map<java.lang.String,java.lang.String> getOptions()
Description copied from interface:AJavaProjectReturns the options for this project.- Specified by:
getOptionsin interfaceAJavaProject
-
getAllPackageFragmentRoots
public java.util.Set<APackageFragmentRoot> getAllPackageFragmentRoots()
Description copied from interface:AJavaProjectReturns all of the existing package fragment roots that exist on the classpath, in the order they are defined by the classpath.- Specified by:
getAllPackageFragmentRootsin interfaceAJavaProject
-
-