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


Java Nonnull类代码示例

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


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

示例1: legacyColors

import javax.annotation.Nonnull; //导入依赖的package包/类
@Nonnull
public static String legacyColors(@Nonnull String message) {
    StringBuilder result = new StringBuilder();
    String[] tokens = message.split("\\{|}");
    outer:
    for (String token : tokens) {
        for (TextColor color : TextColor.values()) {
            if (color.name().equalsIgnoreCase(token)) {
                result.append(color);
                continue outer;
            }
        }

        result.append(token);
    }

    return result.toString();
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:19,代码来源:Lang.java

示例2: saveAsync

import javax.annotation.Nonnull; //导入依赖的package包/类
@Nonnull
@Override
default Supplier<E> saveAsync(final E entity) {
    boolean needsId = hasNoId(entity);

    final Supplier<E> saveOperation = SaveRepository.super.saveAsync(entity);

    // if the entity has no id we need the save to complete so we can index by the generated id.
    if (needsId) {
        saveOperation.get();
    }

    final Runnable indexOperation = index(entity);

    return () -> {
        indexOperation.run();

        saveOperation.get();
        return entity;
    };
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:22,代码来源:SearchRepository.java

示例3: getField

import javax.annotation.Nonnull; //导入依赖的package包/类
@Nonnull
public synchronized Field getField(Class clazz, String name) {
    Map<String, Field> fieldsForClass = fields.get(clazz);
    if (fieldsForClass == null) {
        fieldsForClass = new HashMap<>();
        fields.put(clazz, fieldsForClass);
    }
    Field field = fieldsForClass.get(name);
    if (field == null) {
        try {
            field = clazz.getDeclaredField(name);
            field.setAccessible(true);
        } catch (NoSuchFieldException e) {
            throw new IllegalStateException(e);
        }
        fieldsForClass.put(name, field);
    }
    return field;
}
 
开发者ID:objectbox,项目名称:objectbox-java,代码行数:20,代码来源:ReflectionCache.java

示例4: queryMetadata

import javax.annotation.Nonnull; //导入依赖的package包/类
private static synchronized Single<HashMap<String, String>> queryMetadata(Database dataSource) {
  final URL url = Resources.getResource("metadata_key_value.sql");
  String query;
  try {
    query = Resources.toString(url, Charsets.UTF_8);
  } catch (final IOException ex) {
    return Single.error(ex);
  }
  return dataSource.select(query).get(new ResultSetMapper<HashMap<String, String>>() {
    @Override
    public HashMap<String, String> apply(@Nonnull ResultSet rs) throws SQLException {
      final HashMap<String, String> metadata = new LinkedHashMap<>();

      while (rs.getRow() != 0) {
        metadata.put(rs.getString("name"), rs.getString("value"));
        rs.next();
      }
      return metadata;
    }
  }).singleOrError();
}
 
开发者ID:OrdnanceSurvey,项目名称:vt-support,代码行数:22,代码来源:StorageImpl.java

示例5: getCauseEnvVars

import javax.annotation.Nonnull; //导入依赖的package包/类
/**
 * Retrieves variables describing the Run cause. 
 * @param run Run
 * @return Set of environment variables, which depends on the cause type. 
 */
@Nonnull
public static Map<String, String> getCauseEnvVars(@Nonnull Run<?, ?> run) {
    CauseAction causeAction = run.getAction(CauseAction.class);
    Map<String, String> env = new HashMap<>();
    List<String> directCauseNames = new ArrayList<>();
    Set<String> rootCauseNames = new LinkedHashSet<>();

    if (causeAction != null) {
        List<Cause> buildCauses = causeAction.getCauses();
        for (Cause cause : buildCauses) {
            directCauseNames.add(CauseHelper.getTriggerName(cause));
            CauseHelper.insertRootCauseNames(rootCauseNames, cause, 0);
        }
    } else {
        directCauseNames.add("UNKNOWN");
        rootCauseNames.add("UNKNOWN");
    }
    env.putAll(CauseHelper.buildCauseEnvironmentVariables(ENV_CAUSE, directCauseNames));
    env.putAll(CauseHelper.buildCauseEnvironmentVariables(ENV_ROOT_CAUSE, rootCauseNames));
    return env;
}
 
开发者ID:jenkinsci,项目名称:envinject-api-plugin,代码行数:27,代码来源:EnvVarsResolver.java

示例6: processBatch

import javax.annotation.Nonnull; //导入依赖的package包/类
@Override
protected CompletionStage<ProductSyncStatistics> processBatch(@Nonnull final List<ProductDraft> batch) {
    productsToSync = new HashMap<>();
    draftsToCreate = new HashSet<>();
    return productService.cacheKeysToIds()
                         .thenCompose(keyToIdCache -> {
                             final Set<String> productDraftKeys = getProductDraftKeys(batch);
                             return productService.fetchMatchingProductsByKeys(productDraftKeys)
                                                  .thenAccept(matchingProducts ->
                                                      processFetchedProducts(matchingProducts, batch))
                                                  .thenCompose(result -> createOrUpdateProducts())
                                                  .thenApply(result -> {
                                                      statistics.incrementProcessed(batch.size());
                                                      return statistics;
                                                  });
                         });
}
 
开发者ID:commercetools,项目名称:commercetools-sync-java,代码行数:18,代码来源:ProductSync.java

示例7: onFetchPage

import javax.annotation.Nonnull; //导入依赖的package包/类
@Override
public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException {
    final String pageContent = getPageHtml(downloader);
    doc = Jsoup.parse(pageContent, getCleanUrl());

    final String playerUrl;
    // TODO: use embedded videos to fetch DASH manifest for all videos
    // Check if the video is age restricted
    if (pageContent.contains("<meta property=\"og:restrictions:age")) {
        final EmbeddedInfo info = getEmbeddedInfo();
        final String videoInfoUrl = getVideoInfoUrl(getId(), info.sts);
        final String infoPageResponse = downloader.download(videoInfoUrl);
        videoInfoPage.putAll(Parser.compatParseMap(infoPageResponse));
        playerUrl = info.url;
        isAgeRestricted = true;
    } else {
        final JsonObject ytPlayerConfig = getPlayerConfig(pageContent);
        playerArgs = getPlayerArgs(ytPlayerConfig);
        playerUrl = getPlayerUrl(ytPlayerConfig);
        isAgeRestricted = false;
    }

    if (decryptionCode.isEmpty()) {
        decryptionCode = loadDecryptionCode(playerUrl);
    }
}
 
开发者ID:TeamNewPipe,项目名称:NewPipeExtractor,代码行数:27,代码来源:YoutubeStreamExtractor.java

示例8: NearestAntennaFromFree3

import javax.annotation.Nonnull; //导入依赖的package包/类
public NearestAntennaFromFree3(@Nonnull String __typename, @Nullable Coordinates15 coordinates,
    @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate,
    @Nullable String status, @Nullable Integer dist, @Nullable String insee,
    @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) {
  if (__typename == null) {
    throw new NullPointerException("__typename can't be null");
  }
  this.__typename = __typename;
  this.coordinates = coordinates;
  this.generation = generation;
  this.provider = provider;
  this.lastUpdate = lastUpdate;
  this.status = status;
  this.dist = dist;
  this.insee = insee;
  this.city = city;
  this.addressLabel = addressLabel;
  if (fragments == null) {
    throw new NullPointerException("fragments can't be null");
  }
  this.fragments = fragments;
}
 
开发者ID:gdrouet,项目名称:nightclazz-graphql,代码行数:23,代码来源:SearchQuery.java

示例9: start

import javax.annotation.Nonnull; //导入依赖的package包/类
@Override
public void start() {
    if (!this.upstreamResult.isEmpty()) {
        Futures.addCallback(Futures.allAsList(this.upstreamResult), new FutureCallback<List<TaskResult>>() {
            @Override
            public void onSuccess(@Nullable List<TaskResult> result) {
                doStart(result);
            }

            @Override
            public void onFailure(@Nonnull Throwable t) {
                result.setException(t);
            }
        });
    } else {
        doStart(ImmutableList.<TaskResult>of());
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:AbstractChainedTask.java

示例10: getUUID

import javax.annotation.Nonnull; //导入依赖的package包/类
@Nonnull
private static UUID getUUID(String input, CommandSender sender) throws InputException {
    try {
        return UUID.fromString(input);
    } catch (IllegalArgumentException ex) {
        if (sender instanceof Player) {
            Entity entity = getEntity(input, sender);

            if (entity != null) {
                return entity.getUniqueId();
            }
        }

        throw new InputException(ex);
    }
}
 
开发者ID:zachbr,项目名称:Debuggery,代码行数:17,代码来源:InputFormatter.java

示例11: gsonSave

import javax.annotation.Nonnull; //导入依赖的package包/类
public static void gsonSave(@Nonnull File file, @Nonnull ConfigurationNode node) {
    try {
        gson(file).save(node);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:lucko,项目名称:helper,代码行数:8,代码来源:Configs.java

示例12: drawLayerBounds

import javax.annotation.Nonnull; //导入依赖的package包/类
private static void drawLayerBounds(@Nonnull Canvas canvas,
                                    @Nonnull Rect bounds,
                                    int sectionNumber,
                                    @Nonnull Paint fillPaint,
                                    @Nonnull Paint outlinePaint,
                                    @Nonnull Paint textPaint) {
    Rect startRect = new Rect(bounds.left + 1, bounds.top + 1, bounds.right - 1, bounds.bottom - 1);
    canvas.drawRect(startRect, fillPaint);
    canvas.drawRect(startRect, outlinePaint);
    canvas.drawText("" + sectionNumber, bounds.left + 6, bounds.top + 21, textPaint);
}
 
开发者ID:shazam,项目名称:reflow-animator,代码行数:12,代码来源:ReflowTextAnimatorHelper.java

示例13: toString

import javax.annotation.Nonnull; //导入依赖的package包/类
@Override
@Nonnull
public String toString() {
    return "GameDefinition{" +
            "gameMode=" + gameMode +
            ", minPlayers=" + minPlayers +
            ", maxPlayers=" + maxPlayers +
            ", phases=" + phases +
            ", gameData=" + gameData +
            '}';
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:12,代码来源:GameDefinition.java

示例14: provide

import javax.annotation.Nonnull; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Nullable
public <T> T provide(@Nonnull RelativeDirection side, @Nonnull Capability<T> capability) {
	Validate.notNull(capability);
	
	for(Entry<?> entry : entries) {
		//if (side!=null) {
			if (entry.directions.contains(side) && capability.equals(entry.capability)) return (T)entry.provide();
		//} else {
		//	if (capability.equals(entry.capability)) return (T)entry.provide();
		//}
	}
	
	return null;
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:16,代码来源:CapabilityProvider.java

示例15: Configuration

import javax.annotation.Nonnull; //导入依赖的package包/类
private Configuration(@Nonnull Builder builder) {
    style = builder.style;
    classNamePolicy = builder.classNamePolicy;
    fieldNamePolicy = builder.fieldNamePolicy;
    methodNamePolicy = builder.methodNamePolicy;
    parameterNamePolicy = builder.parameterNamePolicy;
    annotationPolicies = ImmutableSet.copyOf(builder.annotationPolicies);
    jsonParser = builder.jsonParser;
    javaBuilder = builder.javaBuilder;
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:11,代码来源:Configuration.java


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