本文整理汇总了Java中com.intellij.openapi.util.AtomicNotNullLazyValue类的典型用法代码示例。如果您正苦于以下问题:Java AtomicNotNullLazyValue类的具体用法?Java AtomicNotNullLazyValue怎么用?Java AtomicNotNullLazyValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AtomicNotNullLazyValue类属于com.intellij.openapi.util包,在下文中一共展示了AtomicNotNullLazyValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanTargetStorages
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public void cleanTargetStorages(BuildTarget<?> target) throws IOException {
try {
AtomicNotNullLazyValue<BuildTargetStorages> storages = myTargetStorages.remove(target);
if (storages != null) {
storages.getValue().close();
}
}
finally {
// delete all data except src-out mapping which is cleaned in a special way
final File[] targetData = myDataPaths.getTargetDataRoot(target).listFiles();
if (targetData != null) {
final File srcOutputMapRoot = getSourceToOutputMapRoot(target);
for (File dataFile : targetData) {
if (!FileUtil.filesEqual(dataFile, srcOutputMapRoot)) {
FileUtil.delete(dataFile);
}
}
}
}
}
示例2: closeSourceToOutputStorages
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
private void closeSourceToOutputStorages() throws IOException {
IOException ex = null;
try {
for (AtomicNotNullLazyValue<SourceToOutputMappingImpl> mapping : mySourceToOutputs.values()) {
try {
mapping.getValue().close();
}
catch (IOException e) {
if (ex == null) {
ex = e;
}
}
}
}
finally {
mySourceToOutputs.clear();
}
if (ex != null) {
throw ex;
}
}
示例3: fetchValue
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
private static <K, V> V fetchValue(ConcurrentMap<K, AtomicNotNullLazyValue<V>> container, K key, final LazyValueFactory<K, V> valueFactory) throws IOException {
AtomicNotNullLazyValue<V> lazy = container.get(key);
if (lazy == null) {
final AtomicNotNullLazyValue<V> newValue = valueFactory.create(key);
lazy = container.putIfAbsent(key, newValue);
if (lazy == null) {
lazy = newValue; // just initialized
}
}
try {
return lazy.getValue();
}
catch (BuildDataCorruptedException e) {
throw e.getCause();
}
}
示例4: ClsReferenceListImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsReferenceListImpl(@NotNull PsiClassReferenceListStub stub) {
super(stub);
myRefs = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl[]>() {
@NotNull
@Override
protected ClsJavaCodeReferenceElementImpl[] compute() {
String[] strings = getStub().getReferencedNames();
if (strings.length > 0) {
ClsJavaCodeReferenceElementImpl[] refs = new ClsJavaCodeReferenceElementImpl[strings.length];
for (int i = 0; i < strings.length; i++) {
refs[i] = new ClsJavaCodeReferenceElementImpl(ClsReferenceListImpl.this, strings[i]);
}
return refs;
}
else {
return EMPTY_REFS_ARRAY;
}
}
};
}
示例5: ClsMemberImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ClsMemberImpl(T stub) {
super(stub);
myDocComment = !isDeprecated() ? null : new AtomicNotNullLazyValue<PsiDocComment>() {
@NotNull
@Override
protected PsiDocComment compute() {
return new ClsDocCommentImpl(ClsMemberImpl.this);
}
};
myNameIdentifier = new AtomicNotNullLazyValue<PsiIdentifier>() {
@NotNull
@Override
protected PsiIdentifier compute() {
return new ClsIdentifierImpl(ClsMemberImpl.this, getName());
}
};
}
示例6: ClsAnnotationImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsAnnotationImpl(final PsiAnnotationStub stub) {
super(stub);
myReferenceElement = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl>() {
@NotNull
@Override
protected ClsJavaCodeReferenceElementImpl compute() {
String annotationText = getStub().getText();
int index = annotationText.indexOf('(');
String refText = index > 0 ? annotationText.substring(1, index) : annotationText.substring(1);
return new ClsJavaCodeReferenceElementImpl(ClsAnnotationImpl.this, refText);
}
};
myParameterList = new AtomicNotNullLazyValue<ClsAnnotationParameterListImpl>() {
@NotNull
@Override
protected ClsAnnotationParameterListImpl compute() {
PsiNameValuePair[] attrs = getStub().getText().indexOf('(') > 0
? PsiTreeUtil.getRequiredChildOfType(getStub().getPsiElement(), PsiAnnotationParameterList.class).getAttributes()
: PsiNameValuePair.EMPTY_ARRAY;
return new ClsAnnotationParameterListImpl(ClsAnnotationImpl.this, attrs);
}
};
}
示例7: ClsTypeElementImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
myParent = parent;
myTypeText = TypeInfo.internFrequentType(typeText);
myVariance = variance;
myChild = new AtomicNullableLazyValue<ClsElementImpl>() {
@Override
protected ClsElementImpl compute() {
return calculateChild();
}
};
myCachedType = new AtomicNotNullLazyValue<PsiType>() {
@NotNull
@Override
protected PsiType compute() {
return calculateType();
}
};
}
示例8: getValue
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
@NotNull
public NotNullLazyValue<?> getValue() {
if (value == null) {
value = new AtomicNotNullLazyValue<Object>() {
@NotNull
@Override
protected Object compute() {
try {
if (service == null) {
Class<Object> aClass = findClass(implementation);
return asInstance ? instantiate(aClass, ApplicationManager.getApplication().getPicoContainer(), true) : aClass;
}
else {
return ServiceManager.getService(findClass(service));
}
}
catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
};
}
return value;
}
示例9: fetchValue
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
private static <K, V> V fetchValue(ConcurrentMap<K, AtomicNotNullLazyValue<V>> container, K key, final LazyValueFactory<K, V> valueFactory) throws IOException {
AtomicNotNullLazyValue<V> lazy = container.get(key);
if (lazy == null) {
final AtomicNotNullLazyValue<V> newValue = valueFactory.create(key);
lazy = container.putIfAbsent(key, newValue);
if (lazy == null) {
lazy = newValue; // just initialized
}
}
try {
return lazy.getValue();
}
catch (RuntimeException e) {
final Throwable cause = e.getCause();
if (cause instanceof IOException) {
throw (IOException)cause;
}
throw e;
}
}
示例10: ClsAnnotationImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsAnnotationImpl(final PsiAnnotationStub stub) {
super(stub);
myReferenceElement = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl>() {
@NotNull
@Override
protected ClsJavaCodeReferenceElementImpl compute() {
String text = PsiTreeUtil.getRequiredChildOfType(getStub().getPsiElement(), PsiJavaCodeReferenceElement.class).getText();
return new ClsJavaCodeReferenceElementImpl(ClsAnnotationImpl.this, text);
}
};
myParameterList = new AtomicNotNullLazyValue<ClsAnnotationParameterListImpl>() {
@NotNull
@Override
protected ClsAnnotationParameterListImpl compute() {
PsiAnnotationParameterList paramList = PsiTreeUtil.getRequiredChildOfType(getStub().getPsiElement(), PsiAnnotationParameterList.class);
return new ClsAnnotationParameterListImpl(ClsAnnotationImpl.this, paramList.getAttributes());
}
};
}
示例11: ClsTypeElementImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
myParent = parent;
myTypeText = TypeInfo.internFrequentType(typeText);
myVariance = variance;
myChild = new VolatileNullableLazyValue<ClsElementImpl>() {
@Nullable
@Override
protected ClsElementImpl compute() {
return calculateChild();
}
};
myCachedType = new AtomicNotNullLazyValue<PsiType>() {
@NotNull
@Override
protected PsiType compute() {
return calculateType();
}
};
}
示例12: ConfigurableEP
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ConfigurableEP(PicoContainer picoContainer, @Nullable Project project) {
myProject = project;
myPicoContainer = picoContainer;
myFactory = new AtomicNotNullLazyValue<NullableFactory<T>>() {
@NotNull
@Override
protected NullableFactory<T> compute() {
if (providerClass != null) {
return new InstanceFromProviderFactory();
}
else if (instanceClass != null) {
return new NewInstanceFactory();
}
else if (implementationClass != null) {
return new ImplementationFactory();
}
throw new RuntimeException();
}
};
}
示例13: ConfigurableEP
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ConfigurableEP(PicoContainer picoContainer, @Nullable Project project) {
myProject = project;
myPicoContainer = picoContainer;
myFactory = new AtomicNotNullLazyValue<NullableFactory<T>>() {
@Nonnull
@Override
protected NullableFactory<T> compute() {
if (providerClass != null) {
return new InstanceFromProviderFactory();
}
else if (instanceClass != null) {
return new NewInstanceFactory();
}
else if (implementationClass != null) {
return new ImplementationFactory();
}
throw new RuntimeException();
}
};
}
示例14: ClsReferenceListImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsReferenceListImpl(@NotNull PsiClassReferenceListStub stub)
{
super(stub);
myRefs = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl[]>()
{
@NotNull
@Override
protected ClsJavaCodeReferenceElementImpl[] compute()
{
String[] strings = getStub().getReferencedNames();
if(strings.length > 0)
{
ClsJavaCodeReferenceElementImpl[] refs = new ClsJavaCodeReferenceElementImpl[strings.length];
for(int i = 0; i < strings.length; i++)
{
refs[i] = new ClsJavaCodeReferenceElementImpl(ClsReferenceListImpl.this, strings[i]);
}
return refs;
}
else
{
return EMPTY_REFS_ARRAY;
}
}
};
}
示例15: ClsMemberImpl
import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ClsMemberImpl(T stub)
{
super(stub);
myDocComment = !stub.isDeprecated() ? null : new AtomicNotNullLazyValue<PsiDocComment>()
{
@NotNull
@Override
protected PsiDocComment compute()
{
return new ClsDocCommentImpl(ClsMemberImpl.this);
}
};
myNameIdentifier = new AtomicNotNullLazyValue<PsiIdentifier>()
{
@NotNull
@Override
protected PsiIdentifier compute()
{
return new ClsIdentifierImpl(ClsMemberImpl.this, getName());
}
};
}