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
;
26 * Represents a specific instance of facet
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
) {
43 myFacetType
= facetType
;
45 myConfiguration
= configuration
;
46 myUnderlyingFacet
= underlyingFacet
;
50 public final FacetType
getType() {
54 public final FacetTypeId
getTypeId() {
55 return myFacetType
.getId();
58 public final Facet
getUnderlyingFacet() {
59 return myUnderlyingFacet
;
63 public final C
getConfiguration() {
64 return myConfiguration
;
68 public final Module
getModule() {
73 public final boolean isImplicit() {
78 public final void setImplicit(final boolean implicit
) {
79 myImplicit
= implicit
;
83 * Called when the module containing this facet is initialized
85 public void initFacet() {
89 * Called when the module containing this facet is disposed
91 public void disposeFacet() {
95 public final void dispose() {
99 public final int hashCode() {
100 return super.hashCode();
103 @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
104 public final boolean equals(Object obj
) {
105 return super.equals(obj
);
109 public final String
getName() {
114 * Use {@link com.intellij.facet.ModifiableFacetModel#rename} to rename facets
116 final void setName(final @NotNull String name
) {