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


Java NonNull类代码示例

本文整理汇总了Java中com.android.annotations.NonNull的典型用法代码示例。如果您正苦于以下问题:Java NonNull类的具体用法?Java NonNull怎么用?Java NonNull使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NonNull类属于com.android.annotations包,在下文中一共展示了NonNull类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPropertyMajor

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Utility method to parse the {@link PkgProps#PKG_REVISION} property as a major
 * revision (major integer, no minor/micro/preview parts.)
 *
 * @param props The properties to parse.
 * @return A {@link MajorRevision} or null if there is no such property or it couldn't be parsed.
 * @param propKey The name of the property. Must not be null.
 */
@Nullable
public static MajorRevision getPropertyMajor(
        @Nullable Properties props,
        @NonNull String propKey) {
    String revStr = getProperty(props, propKey, null);

    MajorRevision rev = null;
    if (revStr != null) {
        try {
            rev = MajorRevision.parseRevision(revStr);
        } catch (NumberFormatException ignore) {}
    }

    return rev;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:24,代码来源:PackageParserUtils.java

示例2: reportTrySeparateByRole

import com.android.annotations.NonNull; //导入依赖的package包/类
private void reportTrySeparateByRole(@NonNull WriteFieldGroupMethod method) {
    // ISSUE レポート
    String contents = mContext.getJavaFile().getText();
    int startOffset = method.getMethod().getNameIdentifier().getTextRange().getStartOffset();
    int endOffset = method.getMethod().getNameIdentifier().getTextRange().getEndOffset();
    String fieldNames = getWriteFieldNames(method);
    String message = "メソッドが変更するフィールド変数(状態)は、他のメソッドと完全独立でも完全共有でもありません。\n"
            + "このメソッドが変更するフィールド変数(状態)は、他のメソッドとの間で共有の一部に過不足があります。\n"
            + "これはメソッドの責務(役割)が明確に区別されておらず、責務(役割)が混在していることを示すので、\n"
            + "先ずはメソッドや変更フィールド変数(状態)の分割や統合をおすすめします。\n"
            + fieldNames;
    Location location = createLocation(mContext.file, contents, startOffset, endOffset);

    mContext.report(TRY_SEPARATE_BY_ROLE_ISSUE, location, message);
    Debug.report("TrySeparateByRole", method);
}
 
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:17,代码来源:SharingGroupClassificationDetector.java

示例3: createSupportFiles

import com.android.annotations.NonNull; //导入依赖的package包/类
private void createSupportFiles(@NonNull CommandLineLauncher launcher,
        @NonNull Map<String, String> env) throws IOException, InterruptedException {
    // get the generated BC files.
    File rawFolder = new File(mResOutputDir, SdkConstants.FD_RES_RAW);

    SourceSearcher searcher = new SourceSearcher(Collections.singletonList(rawFolder), EXT_BC);
    FileGatherer fileGatherer = new FileGatherer();
    searcher.search(fileGatherer);

    for (File bcFile : fileGatherer.getFiles()) {
        String name = bcFile.getName();
        String objName = name.replaceAll("\\.bc", ".o");
        String soName = "librs." + name.replaceAll("\\.bc", ".so");

        for (Abi abi : ABIS) {
            File objFile = createSupportObjFile(bcFile, abi, objName, launcher, env);
            createSupportLibFile(objFile, abi, soName, launcher, env);
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:RenderScriptProcessor.java

示例4: hasResourceItem

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Returns true if this resource repository contains a resource of the given
 * name.
 *
 * @param type the type of resource to look up
 * @param name the name of the resource
 * @return true if the resource is known
 */
public boolean hasResourceItem(@NonNull ResourceType type, @NonNull String name) {
    ensureInitialized();

    Map<String, ResourceItem> map = mResourceMap.get(type);

    if (map != null) {

        ResourceItem resourceItem = map.get(name);
        if (resourceItem != null) {
            return true;
        }
    }

    return false;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:24,代码来源:ResourceRepository.java

示例5: getExtraDirs

import com.android.annotations.NonNull; //导入依赖的package包/类
@NonNull
private List<File> getExtraDirs(@NonNull File extrasFolder) {
    List<File> extraDirs = new ArrayList<File>();
    // All OEM provided device profiles are in
    // $SDK/extras/$VENDOR/$ITEM/devices.xml
    if (extrasFolder != null && extrasFolder.isDirectory()) {
        for (File vendor : extrasFolder.listFiles()) {
            if (vendor.isDirectory()) {
                for (File item : vendor.listFiles()) {
                    if (item.isDirectory() && isDevicesExtra(item)) {
                        extraDirs.add(item);
                    }
                }
            }
        }
    }

    return extraDirs;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:DeviceManager.java

示例6: appendXmlAttributeValue

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Appends text to the given {@link StringBuilder} and escapes it as required for a
 * DOM attribute node.
 *
 * @param sb the string builder
 * @param attrValue the attribute value to be appended and escaped
 */
public static void appendXmlAttributeValue(@NonNull StringBuilder sb,
        @NonNull String attrValue) {
    int n = attrValue.length();
    // &, ", ' and < are illegal in attributes; see http://www.w3.org/TR/REC-xml/#NT-AttValue
    // (' legal in a " string and " is legal in a ' string but here we'll stay on the safe
    // side)
    for (int i = 0; i < n; i++) {
        char c = attrValue.charAt(i);
        if (c == '"') {
            sb.append(QUOT_ENTITY);
        } else if (c == '<') {
            sb.append(LT_ENTITY);
        } else if (c == '\'') {
            sb.append(APOS_ENTITY);
        } else if (c == '&') {
            sb.append(AMP_ENTITY);
        } else {
            sb.append(c);
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:XmlUtils.java

示例7: getPrivateField

import com.android.annotations.NonNull; //导入依赖的package包/类
@Nullable
public static Object getPrivateField(
        @Nullable Object targetObject,
        @NonNull Class targetClass,
        @NonNull String fieldName) {

    try {
        Field declaredField = getField(targetClass, fieldName);
        return declaredField.get(targetObject);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:meili,项目名称:Aceso,代码行数:14,代码来源:AndroidInstantRuntime.java

示例8: calculateNodeOperationType

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Calculate the effective node operation type for a higher priority node when a lower priority
 * node is queried for merge.
 * @param higherPriority the higher priority node which may have a {@link NodeOperationType}
 *                       declaration and may also have a {@link Selector} declaration.
 * @param lowerPriority the lower priority node that is elected for merging with the higher
 *                      priority node.
 * @return the effective {@link NodeOperationType} that should be used to affect higher and
 * lower priority nodes merging.
 */
private static NodeOperationType calculateNodeOperationType(
        @NonNull XmlElement higherPriority,
        @NonNull XmlElement lowerPriority) {

    NodeOperationType operationType = higherPriority.getOperationType();
    // if the operation's selector exists and the lower priority node is not selected,
    // we revert to default operation type which is merge.
    if (higherPriority.supportsSelector()
            && higherPriority.mSelector != null
            && !higherPriority.mSelector.appliesTo(lowerPriority)) {
        operationType = NodeOperationType.MERGE;
    }
    return operationType;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:XmlElement.java

示例9: recursiveSkip

import com.android.annotations.NonNull; //导入依赖的package包/类
private static void recursiveSkip(
        @NonNull MutableDependencyDataMap mutableDependencyDataMap,
        @NonNull List<DependencyNode> nodes,
        @NonNull Map<Object, Dependency> dependencyMap,
        boolean skipAndroidDependency,
        boolean skipJavaDependency) {
    for (DependencyNode node : nodes) {
        Dependency dep = dependencyMap.get(node.getAddress());

        if (skipAndroidDependency) {
            if (dep instanceof AndroidDependency) {
                mutableDependencyDataMap.skip(dep);
            }
        }

        if (skipJavaDependency) {
            if (dep instanceof JavaDependency) {
                mutableDependencyDataMap.skip(dep);
            }
        }

        recursiveSkip(
                mutableDependencyDataMap,
                node.getDependencies(),
                dependencyMap,
                skipAndroidDependency,
                skipJavaDependency);
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:30,代码来源:DependencyManager.java

示例10: start

import com.android.annotations.NonNull; //导入依赖的package包/类
@Override
public void start(@NonNull DocumentBuilderFactory factory) throws ConsumerException {
    super.start(factory);
    mValuesResMap = ArrayListMultimap.create();
    mQualifierWithDeletedValues = Sets.newHashSet();
    mFactory = factory;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:8,代码来源:MergedResourceWriter.java

示例11: add

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Adds the non-qualifiers from the given config.
 * Qualifiers that are null in the given config do not change in the receiver.
 */
public void add(@NonNull FolderConfiguration config) {
    for (int i = 0 ; i < INDEX_COUNT ; i++) {
        if (config.mQualifiers[i] != null) {
            mQualifiers[i] = config.mQualifiers[i];
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:FolderConfiguration.java

示例12: newSample

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Create a new sample package descriptor.
 *
 * @param version The android version of the sample package.
 * @param revision The revision of the sample package.
 * @param minToolsRev An optional {@code min-tools-rev}.
 *                    Use {@link FullRevision#NOT_SPECIFIED} to indicate
 *                    there is no requirement.
 * @return A {@link PkgDesc} describing this sample package.
 */
@NonNull
public static Builder newSample(@NonNull AndroidVersion version,
                                @NonNull MajorRevision revision,
                                @NonNull FullRevision minToolsRev) {
    Builder p = new Builder(PkgType.PKG_SAMPLE);
    p.mAndroidVersion = version;
    p.mMajorRevision  = revision;
    p.mMinToolsRev    = minToolsRev;
    return p;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:PkgDesc.java

示例13: execute

import com.android.annotations.NonNull; //导入依赖的package包/类
@Override
public void execute(@NonNull CopyAwoSolibTask copyAwoSolibTask) {

    //            final File mainJniOutputFolder = libVariantContext.getBaseVariantData().ndkCompileTask.getSoFolder();
    copyAwoSolibTask.outputDir = new File(awbBundle.getAndroidLibrary().getJniFolder(), "lib");

    copyAwoSolibTask.awbBundle = awbBundle;

    final VariantConfiguration<CoreBuildType, CoreProductFlavor, CoreProductFlavor> config = libVariantContext
            .getVariantConfiguration();
    copyAwoSolibTask.setVariantName(config.getFullName());
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:13,代码来源:CopyAwoSolibTask.java

示例14: extractLocalVariable

import com.android.annotations.NonNull; //导入依赖的package包/类
private static void extractLocalVariable(@NonNull PsiElement element, List<PsiLocalVariable> variables) {
    for (PsiElement child : element.getChildren()) {
        if (child instanceof PsiLocalVariable) {
            variables.add((PsiLocalVariable) child);
            continue;
        }
        extractLocalVariable(child, variables);
    }
}
 
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:10,代码来源:ElementUtil.java

示例15: createDebugStore

import com.android.annotations.NonNull; //导入依赖的package包/类
/**
 * Creates a new debug store with the location, keyalias, and passwords specified in the
 * config.
 *
 * @param signingConfig The signing config
 * @param logger a logger object to receive the log of the creation.
 * @throws KeytoolException
 */
public static boolean createDebugStore(@Nullable String storeType, @NonNull File storeFile,
                                       @NonNull String storePassword, @NonNull String keyPassword,
                                       @NonNull String keyAlias,
                                       @NonNull ILogger logger) throws KeytoolException {

    return createNewStore(storeType, storeFile, storePassword, keyPassword, keyAlias,
                          CERTIFICATE_DESC, 30 /* validity*/, logger);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:17,代码来源:KeystoreHelper.java


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