本文整理汇总了Java中org.eclipse.jdt.annotation.NonNull类的典型用法代码示例。如果您正苦于以下问题:Java NonNull类的具体用法?Java NonNull怎么用?Java NonNull使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NonNull类属于org.eclipse.jdt.annotation包,在下文中一共展示了NonNull类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toAtomExpr
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/**
* Converts this tree to a {@link Variable} or a {@link FieldExpr}.
* Chained field expressions are currently unsupported.
* @param varMap variable typing
* @param sort expected type of the expression
*/
private Expression toAtomExpr(@NonNull Typing varMap, @NonNull Sort sort)
throws FormatException {
Expression result;
assert hasId();
QualName id = getId();
if (id.size() > 2) {
throw new FormatException("Nested field expression '%s' not supported", id);
} else if (id.size() > 1) {
result = new FieldExpr(hasSort(), id.get(0), id.get(1), sort);
} else {
String name = id.get(0);
Optional<Sort> varSort = varMap.getSort(name);
if (!varSort.isPresent()) {
// this is a self-field
result = new FieldExpr(hasSort(), null, name, sort);
} else if (varSort.get() != sort) {
throw new FormatException("Variable %s is of type %s, not %s", name, varSort.get()
.getName(), sort.getName());
} else {
result = toVarExpr(name, sort);
}
}
return result;
}
示例2: toVarExpr
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/**
* Converts this tree to a {@link Variable} or a {@link Parameter}.
* @param name variable name
* @param sort expected type of the expression
*/
private Expression toVarExpr(@NonNull String name, @NonNull Sort sort) throws FormatException {
Expression result;
if (name.charAt(0) == '$') {
int number;
try {
number = Integer.parseInt(name.substring(1));
} catch (NumberFormatException exc) {
throw new FormatException(
"Parameter '%s' should equal '$number' for a non-negative number",
getParseString());
}
result = new Parameter(hasSort(), number, sort);
} else {
result = new Variable(hasSort(), name, sort);
}
return result;
}
示例3: toCallLine
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/** Builds a display string for an operator without symbol. */
private @NonNull Line toCallLine() {
List<Line> result = new ArrayList<>();
result.add(Line.atom(this.op.getName() + '('));
boolean firstArg = true;
for (Expression arg : getArgs()) {
if (!firstArg) {
result.add(Line.atom(", "));
} else {
firstArg = false;
}
result.add(arg.toLine(OpKind.NONE));
}
result.add(Line.atom(")"));
return Line.composed(result);
}
示例4: computeNodeWildcard
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Result computeNodeWildcard(Wildcard expr) {
Result result = new Result();
LabelVar var = expr.getWildcardId();
Set<@NonNull TypeNode> candidates = new HashSet<>();
if (var.hasName()) {
candidates.addAll((Collection<@NonNull TypeNode>) this.varTyping.get(var));
} else {
candidates.addAll(this.typeGraph.nodeSet());
}
TypeGuard guard = expr.getWildcardGuard();
for (TypeNode typeNode : guard.filter(candidates)) {
result.add(typeNode, typeNode);
}
return result;
}
示例5: computeEdgeWildcard
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Result computeEdgeWildcard(Wildcard expr) {
Result result = new Result();
LabelVar var = expr.getWildcardId();
Set<@NonNull TypeEdge> candidates = new HashSet<>();
if (var.hasName()) {
candidates.addAll((Collection<@NonNull TypeEdge>) this.varTyping.get(var));
} else {
candidates.addAll(this.typeGraph.edgeSet());
}
TypeGuard guard = expr.getWildcardGuard();
for (TypeEdge typeEdge : guard.filter(candidates)) {
Set<TypeNode> targetTypes = typeEdge.target()
.getSubtypes();
for (TypeNode sourceType : typeEdge.source()
.getSubtypes()) {
if (expr.getKind() == EdgeRole.BINARY) {
result.add(sourceType, targetTypes);
} else {
result.add(sourceType, sourceType);
}
}
}
return result;
}
示例6: append
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/** Returns a composed line consisting of this line and an atomic line. */
public @NonNull Line append(String atom) {
Line result;
if (this == empty) {
result = Line.atom(atom);
} else if (this instanceof Atomic) {
result = Line.atom(((Atomic) this).text + atom);
} else if (this instanceof Composed) {
Line[] oldFragments = ((Composed) this).fragments;
Line[] newFragments = new Line[oldFragments.length + 1];
System.arraycopy(oldFragments, 0, newFragments, 0, oldFragments.length);
newFragments[oldFragments.length] = Line.atom(atom);
result = new Composed(newFragments);
} else {
result = new Composed(this, Line.atom(atom));
}
return result;
}
示例7: checkoutAndPull
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
public static void checkoutAndPull(@NonNull String projectRootDir,
@NonNull String branchOrCommit) {
Pair<Boolean, Path> fileExist = isFileExist(projectRootDir);
if (!fileExist.getLeft()) {
return;
}
File file = fileExist.getRight().toFile();
try (Git git = Git.open(file)) {
CmdExecResult result = CommandExecUtil.execCmd(
Constants.TOMCAT_PATH
+ "/webapps"
+ Config.getContextPath()
+ "/shell/gitCheckoutAndPull.sh "
+ file.getAbsolutePath()
+ " "
+ branchOrCommit, true);
if (result == null || !result.isSuccess()) {
logger.error("checkout failed, {}", result);
}
} catch (IOException e) {
logger.error("error occurred, {}", e);
}
}
示例8: getTokenFamily
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/** Returns the fixed default token family for a given token type. */
@NonNull
TokenFamily getTokenFamily(TokenType type) {
if (this.typeFamilyMap == null) {
Map<TokenType,TokenFamily> result = this.typeFamilyMap = new HashMap<>();
for (TokenType t : getTokenTypes()) {
if (t.parsable()) {
result.put(t, getTokenFamily(t.symbol()));
} else {
assert t.claz() == TokenClaz.CONST || t.claz() == NAME;
result.put(t, new TokenFamily(t));
}
}
}
assert this.typeFamilyMap.containsKey(type);
TokenFamily result = this.typeFamilyMap.get(type);
assert result != null;
return result;
}
示例9: createNode
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/**
* Returns a suitable node with a number obtained from a dispenser.
* Typically the node will get the first available number,
* but if node numbers may be unsuitable for some reason then
* the dispenser may be invoked multiple times.
* @throws NoSuchElementException if the dispenser runs out of numbers
*/
public @NonNull N createNode(Dispenser dispenser) {
@Nullable N result = null;
do {
int nr = dispenser.getNext();
result = getNode(nr);
if (result == null) {
// create a new node of the correct type
result = newNode(nr);
registerNode(result);
} else if (!isAllowed(result)) {
// do not use the existing node with this number
result = null;
}
} while (result == null);
return result;
}
示例10: hasTaskChanged
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
@Override
public boolean hasTaskChanged(@NonNull TaskRepository taskRepository, @NonNull ITask task,
@NonNull TaskData taskData) {
Date changedAtTaskData = taskData.getAttributeMapper()
.getDateValue(taskData.getRoot().getAttribute(TaskAttribute.DATE_MODIFICATION));
Date changedAtTask = task.getModificationDate();
if (changedAtTask == null || changedAtTaskData == null)
return true;
if (!changedAtTask.equals(changedAtTaskData))
return true;
return false;
}
示例11: getTaskGroupStatusList
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
@NonNull
public List<TaskGroupStatus> getTaskGroupStatusList(@NonNull App app) {
ArrayList<TaskGroupStatus> list = new ArrayList<>();
TaskGroupStatus status = new TaskGroupStatus();
status.setApp(app);
status.setBranchName("testBranch");
status.setCreateTime(System.currentTimeMillis());
status.setStatus(TaskGroupStatus.Status.RUNNING);
status.setSuccessTaskCount(1);
status.setTaskCount(3);
status.setTaskGroupId(1);
status.setUser(new User());
status.setVersionName("1.2.3");
list.add(status);
return list;
}
示例12: queryTasks
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/**
* Queries tasks and returns a list of CharmTasks
*
* @param monitor
* monitor for indicating the progress
* @param query
* query-object which contains the query parameters
* @return List of CharmTasks
* @throws CharmException
* Error occurred while querying tasks
*/
public CharmQueryResults queryTasks(IProgressMonitor monitor, @NonNull IRepositoryQuery query)
throws CharmException {
Response response = buildWebTarget("/tasks", CharmQueryMessageBodyReader.class,
CharmErrorMessageBodyReader.class)
.queryParam("developer", query.getAttribute(CharmCorePlugin.QUERY_KEY_DEVELOPER))
.queryParam("object_id", query.getAttribute(CharmCorePlugin.QUERY_KEY_OBJECT_ID))
.queryParam("proc_type", query.getAttribute(CharmCorePlugin.QUERY_KEY_PROC_TYPE))
.queryParam("status", query.getAttribute(CharmCorePlugin.QUERY_KEY_STATUS))
.queryParam("priority", query.getAttribute(CharmCorePlugin.QUERY_KEY_PRIORITY))
.request(MediaType.APPLICATION_XML).get();
if (response.getStatus() == 200) {
return (CharmQueryResults) response.readEntity(CharmQueryResults.class);
} else {
handleError(response);
}
return null;
}
示例13: getAttachment
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/**
* Get an attachment it it's origin-format as a byte-array
*
* @param task
* Charm Task of attachment
* @param attachmentAttribute
* attachment Attributes
* @param monitor
* monitor for indicating progress
* @return attachment as byte array
* @throws CharmException
* error while reading attachment
* @throws IOException
*/
public InputStream getAttachment(@NonNull ITask task, @NonNull TaskAttribute attachmentAttribute,
@Nullable IProgressMonitor monitor) throws CharmException {
String attachmentId = attachmentAttribute.getValue();
String taskId = attachmentAttribute.getTaskData().getRoot().getAttribute(CharmTaskAttribute.GUID).getValue();
Response response = buildWebTarget("/task/" + taskId + "/attachment/" + attachmentId + "/download")
.request(MediaType.WILDCARD).get();
if (response.getStatus() == 200) {
return (InputStream) response.getEntity();
} else {
handleError(response);
}
return null;
}
示例14: putAttachmentData
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
/**
* Uploads an attachment to the repository
*
* @param task
* attached task
* @param filename
* @param mimeType
* @param description
* @param attachment
* @param monitor
* @throws CharmHttpException
*/
public void putAttachmentData(@NonNull ITask task, String filename, String mimeType, String description,
byte[] attachment, @Nullable IProgressMonitor monitor) throws CharmHttpException {
CharmAttachmentPost charmAttachment = new CharmAttachmentPost();
charmAttachment.setDescription(description);
charmAttachment.setMimeType(mimeType);
charmAttachment.setName(filename);
charmAttachment.setPayload(Base64.getEncoder().encodeToString(attachment));
Response response = buildWebTarget("/task/" + task.getTaskId() + "/attachment", CharmAttachmentPostWriter.class,
CharmErrorMessageBodyReader.class).request(MediaType.APPLICATION_XML)
.post(Entity.entity(charmAttachment, MediaType.APPLICATION_XML));
if (response.getStatus() != 200) {
handleError(response);
}
}
示例15: paintComponent
import org.eclipse.jdt.annotation.NonNull; //导入依赖的package包/类
@Override
protected void paintComponent(@NonNull final Graphics g) {
super.paintComponent(g);
if (hovered) {
g.setColor(new Color(0, 0, 0, 0.4f));
g.fillRect(0, 0, getWidth(), getHeight());
}
final Graphics2D g2 = (Graphics2D) g;
final Composite oldComp = g2.getComposite();
if (!hovered)
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
if (icon != null)
g.drawImage(icon, (getWidth() - ICON_SIZE) / 2, PADDING_Y, ICON_SIZE, ICON_SIZE, null);
if (isExpandable) {
// g.drawImage(expandIcon, (getWidth() + ICON_SIZE) / 2 - EXPAND_ICON_SIZE / 2, PADDING_Y + ICON_SIZE - EXPAND_ICON_SIZE, EXPAND_ICON_SIZE, EXPAND_ICON_SIZE, null);
final int expandX = (getWidth() + ICON_SIZE) / 2, expandY = PADDING_Y + ICON_SIZE;
final int expandSize = 10;
g.setColor(Color.white);
g2.setStroke(new BasicStroke(3, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10));
g.drawPolyline(
new int[] {expandX - expandSize / 2, expandX, expandX + expandSize / 2},
new int[] {expandY - expandSize / 2, expandY, expandY - expandSize / 2}, 3);
g.setColor(Color.black);
g2.setStroke(new BasicStroke(1.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10));
g.drawPolyline(
new int[] {expandX - expandSize / 2, expandX, expandX + expandSize / 2},
new int[] {expandY - expandSize / 2, expandY, expandY - expandSize / 2}, 3);
}
g2.setComposite(oldComp);
}