当前位置: 首页>>代码示例>>Java>>正文


Java AtomicNotNullLazyValue类代码示例

本文整理汇总了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);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BuildDataManager.java

示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BuildDataManager.java

示例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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BuildDataManager.java

示例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;
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ClsReferenceListImpl.java

示例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());
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ClsMemberImpl.java

示例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);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ClsAnnotationImpl.java

示例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();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ClsTypeElementImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JsonRpcDomainBean.java

示例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;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:BuildDataManager.java

示例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());
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ClsAnnotationImpl.java

示例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();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ClsTypeElementImpl.java

示例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();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ConfigurableEP.java

示例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();
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ConfigurableEP.java

示例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;
			}
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:ClsReferenceListImpl.java

示例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());
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:ClsMemberImpl.java


注:本文中的com.intellij.openapi.util.AtomicNotNullLazyValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。