jps model: JpsElementType converted to interface to allow reusing common base class

This commit is contained in:
nik
2013-09-20 13:51:21 +04:00
parent 229deb0a99
commit b1d506296d
19 changed files with 102 additions and 28 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,13 +15,12 @@
*/
package org.jetbrains.jps.model;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public abstract class JpsElementType<P extends JpsElement> {
private final JpsElementChildRole<P> myPropertiesRole = new JpsElementChildRole<P>();
public final JpsElementChildRole<P> getPropertiesRole() {
return myPropertiesRole;
}
public interface JpsElementType<P extends JpsElement> {
@NotNull
JpsElementChildRole<P> getPropertiesRole();
}
@@ -16,10 +16,11 @@
package org.jetbrains.jps.model.artifact;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.ex.JpsElementTypeWithDummyProperties;
/**
* @author nik
*/
public class DirectoryArtifactType extends JpsArtifactType<JpsDummyElement> {
public class DirectoryArtifactType extends JpsElementTypeWithDummyProperties implements JpsArtifactType<JpsDummyElement> {
public static final DirectoryArtifactType INSTANCE = new DirectoryArtifactType();
}
@@ -16,10 +16,11 @@
package org.jetbrains.jps.model.artifact;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.ex.JpsElementTypeWithDummyProperties;
/**
* @author nik
*/
public class JarArtifactType extends JpsArtifactType<JpsDummyElement> {
public class JarArtifactType extends JpsElementTypeWithDummyProperties implements JpsArtifactType<JpsDummyElement> {
public static final JarArtifactType INSTANCE = new JarArtifactType();
}
@@ -21,5 +21,5 @@ import org.jetbrains.jps.model.JpsElementType;
/**
* @author nik
*/
public abstract class JpsArtifactType<P extends JpsElement> extends JpsElementType<P> {
public interface JpsArtifactType<P extends JpsElement> extends JpsElementType<P> {
}
@@ -0,0 +1,34 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.model.ex;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.JpsElementType;
/**
* @author nik
*/
public abstract class JpsElementTypeBase<P extends JpsElement>implements JpsElementType<P> {
private final JpsElementChildRole<P> myPropertiesRole = new JpsElementChildRole<P>();
@NotNull
@Override
public final JpsElementChildRole<P> getPropertiesRole() {
return myPropertiesRole;
}
}
@@ -0,0 +1,32 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.model.ex;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
/**
* @author nik
*/
public abstract class JpsElementTypeWithDummyProperties extends JpsElementTypeBase<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
@NotNull
@Override
public JpsDummyElement createDefaultProperties() {
return JpsElementFactory.getInstance().createDummyElement();
}
}
@@ -18,13 +18,13 @@ package org.jetbrains.jps.model.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.ex.JpsElementTypeWithDummyProperties;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
/**
* @author nik
*/
public class JavaResourceRootType extends JpsModuleSourceRootType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
public class JavaResourceRootType extends JpsElementTypeWithDummyProperties implements JpsModuleSourceRootType<JpsDummyElement> {
public static final JavaResourceRootType RESOURCE = new JavaResourceRootType();
public static final JavaResourceRootType TEST_RESOURCE = new JavaResourceRootType();
@@ -17,14 +17,14 @@ package org.jetbrains.jps.model.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.ex.JpsElementTypeBase;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
/**
* @author nik
*/
public class JavaSourceRootType extends JpsModuleSourceRootType<JpsSimpleElement<JavaSourceRootProperties>> implements JpsElementTypeWithDefaultProperties<JpsSimpleElement<JavaSourceRootProperties>> {
public class JavaSourceRootType extends JpsElementTypeBase<JpsSimpleElement<JavaSourceRootProperties>> implements JpsModuleSourceRootType<JpsSimpleElement<JavaSourceRootProperties>> {
public static final JavaSourceRootType SOURCE = new JavaSourceRootType();
public static final JavaSourceRootType TEST_SOURCE = new JavaSourceRootType();
@@ -16,13 +16,15 @@
package org.jetbrains.jps.model.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.ex.JpsElementTypeWithDummyProperties;
import org.jetbrains.jps.model.library.JpsLibraryType;
/**
* @author nik
*/
public class JpsJavaLibraryType extends JpsLibraryType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
public class JpsJavaLibraryType extends JpsElementTypeWithDummyProperties implements JpsLibraryType<JpsDummyElement> {
public static final JpsJavaLibraryType INSTANCE = new JpsJavaLibraryType();
@NotNull
@@ -18,13 +18,13 @@ package org.jetbrains.jps.model.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.ex.JpsElementTypeWithDummyProperties;
import org.jetbrains.jps.model.module.JpsModuleType;
/**
* @author nik
*/
public class JpsJavaModuleType extends JpsModuleType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
public class JpsJavaModuleType extends JpsElementTypeWithDummyProperties implements JpsModuleType<JpsDummyElement> {
public static final JpsJavaModuleType INSTANCE = new JpsJavaModuleType();
@NotNull
@@ -15,12 +15,13 @@
*/
package org.jetbrains.jps.model.java.runConfiguration;
import org.jetbrains.jps.model.ex.JpsElementTypeBase;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
/**
* @author nik
*/
public class JpsApplicationRunConfigurationType extends JpsRunConfigurationType<JpsApplicationRunConfigurationProperties> {
public class JpsApplicationRunConfigurationType extends JpsElementTypeBase<JpsApplicationRunConfigurationProperties> implements JpsRunConfigurationType<JpsApplicationRunConfigurationProperties> {
public static final JpsApplicationRunConfigurationType INSTANCE = new JpsApplicationRunConfigurationType();
private JpsApplicationRunConfigurationType() {
@@ -21,5 +21,5 @@ import org.jetbrains.jps.model.JpsElementType;
/**
* @author nik
*/
public abstract class JpsLibraryType<P extends JpsElement> extends JpsElementType<P> {
public interface JpsLibraryType<P extends JpsElement> extends JpsElementType<P> {
}
@@ -17,13 +17,13 @@ package org.jetbrains.jps.model.library.sdk;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.ex.JpsElementTypeBase;
import org.jetbrains.jps.model.library.JpsLibraryType;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
/**
* @author nik
*/
public abstract class JpsSdkType<P extends JpsElement> extends JpsLibraryType<JpsSdk<P>> {
public abstract class JpsSdkType<P extends JpsElement> extends JpsElementTypeBase<JpsSdk<P>> implements JpsLibraryType<JpsSdk<P>> {
private final JpsElementChildRole<P> mySdkPropertiesRole = new JpsElementChildRole<P>();
public final JpsElementChildRole<P> getSdkPropertiesRole() {
@@ -17,9 +17,10 @@ package org.jetbrains.jps.model.module;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementType;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
/**
* @author nik
*/
public abstract class JpsModuleSourceRootType<P extends JpsElement> extends JpsElementType<P> {
public interface JpsModuleSourceRootType<P extends JpsElement> extends JpsElementType<P>, JpsElementTypeWithDefaultProperties<P> {
}
@@ -21,5 +21,5 @@ import org.jetbrains.jps.model.JpsElementType;
/**
* @author nik
*/
public abstract class JpsModuleType<P extends JpsElement> extends JpsElementType<P> {
public interface JpsModuleType<P extends JpsElement> extends JpsElementType<P> {
}
@@ -21,5 +21,5 @@ import org.jetbrains.jps.model.JpsElementType;
/**
* @author nik
*/
public abstract class JpsRunConfigurationType<P extends JpsElement> extends JpsElementType<P> {
public interface JpsRunConfigurationType<P extends JpsElement> extends JpsElementType<P> {
}
@@ -16,12 +16,13 @@
package org.jetbrains.jps.devkit.model;
import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.ex.JpsElementTypeBase;
import org.jetbrains.jps.model.module.JpsModuleType;
/**
* @author nik
*/
public class JpsPluginModuleType extends JpsModuleType<JpsSimpleElement<JpsPluginModuleProperties>> {
public class JpsPluginModuleType extends JpsElementTypeBase<JpsSimpleElement<JpsPluginModuleProperties>> implements JpsModuleType<JpsSimpleElement<JpsPluginModuleProperties>> {
public static final JpsPluginModuleType INSTANCE = new JpsPluginModuleType();
}
@@ -1,11 +1,12 @@
package org.jetbrains.plugins.javaFX;
import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.ex.JpsElementTypeBase;
/**
* User: anna
* Date: 3/13/13
*/
public class JpsJavaFxApplicationArtifactType extends JpsArtifactType<JpsJavaFxArtifactProperties> {
public class JpsJavaFxApplicationArtifactType extends JpsElementTypeBase<JpsJavaFxArtifactProperties> implements JpsArtifactType<JpsJavaFxArtifactProperties> {
public static final JpsJavaFxApplicationArtifactType INSTANCE = new JpsJavaFxApplicationArtifactType();
}
@@ -16,11 +16,12 @@
package org.jetbrains.plugins.javaFX.preloader;
import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.ex.JpsElementTypeBase;
/**
* User: anna
* Date: 3/13/13
*/
public class JpsJavaFxPreloaderArtifactType extends JpsArtifactType<JpsJavaFxPreloaderArtifactProperties> {
public class JpsJavaFxPreloaderArtifactType extends JpsElementTypeBase<JpsJavaFxPreloaderArtifactProperties> implements JpsArtifactType<JpsJavaFxPreloaderArtifactProperties> {
public static final JpsJavaFxPreloaderArtifactType INSTANCE = new JpsJavaFxPreloaderArtifactType();
}