update copyrights
[fedora-idea.git] / platform / lang-api / src / com / intellij / facet / Facet.java
blob89af1731eda5248de9a3b92248b8b7c202be592b
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.intellij.facet;
19 import com.intellij.openapi.Disposable;
20 import com.intellij.openapi.util.UserDataHolderBase;
21 import com.intellij.openapi.util.UserDataHolder;
22 import com.intellij.openapi.module.Module;
23 import org.jetbrains.annotations.NotNull;
25 /**
26 * Represents a specific instance of facet
28 * @see FacetType
30 * @author nik
32 public class Facet<C extends FacetConfiguration> extends UserDataHolderBase implements UserDataHolder, Disposable {
33 public static final Facet[] EMPTY_ARRAY = new Facet[0];
34 private final @NotNull FacetType myFacetType;
35 private final @NotNull Module myModule;
36 private final @NotNull C myConfiguration;
37 private final Facet myUnderlyingFacet;
38 private String myName;
39 private boolean myImplicit;
41 public Facet(@NotNull final FacetType facetType, @NotNull final Module module, final @NotNull String name, @NotNull final C configuration, Facet underlyingFacet) {
42 myName = name;
43 myFacetType = facetType;
44 myModule = module;
45 myConfiguration = configuration;
46 myUnderlyingFacet = underlyingFacet;
49 @NotNull
50 public final FacetType getType() {
51 return myFacetType;
54 public final FacetTypeId getTypeId() {
55 return myFacetType.getId();
58 public final Facet getUnderlyingFacet() {
59 return myUnderlyingFacet;
62 @NotNull
63 public final C getConfiguration() {
64 return myConfiguration;
67 @NotNull
68 public final Module getModule() {
69 return myModule;
72 @Deprecated
73 public final boolean isImplicit() {
74 return myImplicit;
77 @Deprecated
78 public final void setImplicit(final boolean implicit) {
79 myImplicit = implicit;
82 /**
83 * Called when the module containing this facet is initialized
85 public void initFacet() {
88 /**
89 * Called when the module containing this facet is disposed
91 public void disposeFacet() {
95 public final void dispose() {
96 disposeFacet();
99 public final int hashCode() {
100 return super.hashCode();
103 @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
104 public final boolean equals(Object obj) {
105 return super.equals(obj);
108 @NotNull
109 public final String getName() {
110 return myName;
114 * Use {@link com.intellij.facet.ModifiableFacetModel#rename} to rename facets
116 final void setName(final @NotNull String name) {
117 myName = name;