Java 类org.jetbrains.annotations.Nullable 实例源码

项目:pysonar2    文件:Parser.java   
@Nullable
private List<Node> convertListNode(@Nullable Object o) {
    if (o == null) {
        return null;
    } else {
        List<Map<String, Object>> in = (List<Map<String, Object>>) o;
        List<Node> out = new ArrayList<>();

        for (Map<String, Object> m : in) {
            Node n = convert(m);
            if (n != null) {
                out.add(n);
            }
        }

        return out;
    }
}
项目:Ballbasaur-Code-Rewrite    文件:RobotMap.java   
@JsonCreator
public RobotMap(@NotNull List<CommandButton> buttons, @Nullable SubsystemSolenoid shooter, @Nullable Pneumatics pneumatics,
                @Nullable IntakeSingleRollerPneumatic intake,
                @NotNull @JsonProperty(required = true) Logger logger,
                @NotNull @JsonProperty(required = true) MappedRunnable updater,
                @NotNull @JsonProperty(required = true) DriveTalonCluster drive,
                @NotNull @JsonProperty(required = true) OI oi,
                @NotNull @JsonProperty(required = true) YamlCommand defaultDriveCommand,
                @Nullable YamlCommand startupCommand){
    this.buttons = buttons;
    this.intake = intake;
    this.shooter = shooter;
    this.pneumatics = pneumatics;
    this.logger = logger;
    this.updater = updater;
    this.drive = drive;
    this.oi = oi;
    this.defaultDriveCommand = defaultDriveCommand.getCommand();
    this.startupCommand = startupCommand != null ? startupCommand.getCommand() : null;
}
项目:voicemenu    文件:WorkSpace_TransformationMenu.java   
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  WorkSpace_TransformationMenu.TMP_SubMenu_tva3ah_c0.TMP_Action_tva3ah_b2a.Item item = new WorkSpace_TransformationMenu.TMP_SubMenu_tva3ah_c0.TMP_Action_tva3ah_b2a.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8720745441960174133")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
项目:hybris-integration-intellij-idea-plugin    文件:ImpexPsiUtils.java   
@Nullable
@Contract("null, _ -> null")
public static PsiElement findSiblingByPredicate(
    @Nullable final PsiElement sibling,
    @NotNull final Predicate<PsiElement> predicate
) {
    if (sibling == null) {
        return null;
    } else {
        for (PsiElement child = sibling.getNextSibling(); child != null; child = child.getNextSibling()) {
            if (predicate.apply(child)) {
                return child;
            }
        }

        return null;
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultStatsCollector.java   
@Nullable
@Override
public Element getState() {
    synchronized (lock) {
        final Element element = new Element("state");

        for (Entity entity : queue) {
            final Element entityElement = new Element(TAG_ENTITY);
            entityElement.setAttribute(ATTR_ACTION, entity.getAction().name());
            entityElement.setAttribute(ATTR_DATE, entity.getDateStr());
            final String parameters = entity.getParameters();

            if (parameters != null) {
                entityElement.setAttribute(ATTR_NAME, parameters);
            }
            element.addContent(entityElement);
        }
        return element;
    }
}
项目:voicemenu    文件:Activity_TransformationMenu.java   
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a2.TMP_Action_rgk9zw_b0c.Item item = new Activity_TransformationMenu.TMP_SubMenu_rgk9zw_a2.TMP_Action_rgk9zw_b0c.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "8720745441970421370")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
项目:jmonkeybuilder-extension    文件:StaticLightProbeSceneAppState.java   
/**
 * Set the scene to put a light probe.
 *
 * @param scene the scene to put a light probe.
 */
public void setPbrScene(@Nullable final Node scene) {

    final Node prevScene = getPbrScene();

    if (prevScene != null) {
        prevScene.removeLight(lightProbe);
    }

    this.pbrScene = scene;

    if (scene != null) {
        scene.addLight(lightProbe);
    }

    this.frame = 0;
}
项目:strictfp-back-end    文件:MySqlAdapter.java   
@NotNull
    @Override
    public ResultSet select(
            @NotNull @NonNls String tableName,
            @Nullable @NonNls String columnName,
            @Nullable Pair... where) {
        StringBuilder deepDarkFantasy = new StringBuilder(getQueryString(tableName, columnName));
        if (where != null) {
            deepDarkFantasy
                    .append(" WHERE ")
                    .append(String.join(" AND ", (CharSequence[]) Pair.convert(where)));
        }
        return querySQL(deepDarkFantasy.toString());
/*
return statement.executeQuery("SELECT " +
        (columnName != null ? columnName : "*") +
        " FROM " + tableName +
        " WHERE " + String.join(" and ", Pair.convert(where))
        );
// NOTICE: HERE I IGNORED THE CASE THAT WHERE IS NULL
*/
    }
项目:voicemenu    文件:Event_TransformationMenu.java   
@Nullable
protected TransformationMenuItem createItem(TransformationMenuContext context) {
  Event_TransformationMenu.TMP_SubMenu_8shh52_a6.TMP_Action_8shh52_a0g.Item item = new Event_TransformationMenu.TMP_SubMenu_8shh52_a6.TMP_Action_8shh52_a0g.Item(context);
  String description;
  try {
    description = "single item: " + item.getLabelText("");
  } catch (Throwable t) {
    Logger.getLogger(getClass()).error("Exception while executing getText of the item " + item, t);
    return null;
  }
  context.getEditorMenuTrace().pushTraceInfo();
  try {
    context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase(description, new SNodePointer("r:7c1e5bbb-2d18-4cf3-a11d-502be6b13261(jetbrains.mps.samples.VoiceMenu.editor)", "6198827212362263672")));
    item.setTraceInfo(context.getEditorMenuTrace().getTraceInfo());
  } finally {
    context.getEditorMenuTrace().popTraceInfo();
  }
  return item;
}
项目:DeBrug    文件:ReeelGetalWaarde__BehaviorDescriptor.java   
@Override
protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) {
  int methodIndex = BH_METHODS.indexOf(method);
  if (methodIndex < 0) {
    throw new BHMethodNotFoundException(this, method);
  }
  switch (methodIndex) {
    case 0:
      return (T) ((Double) GeefWaarde_idXSBwowcV5H(node));
    default:
      throw new BHMethodNotFoundException(this, method);
  }
}
项目:intellij-csv-validator    文件:CsvQuoteValueIntentionAction.java   
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) {
    if (!super.isAvailable(project, editor, element)) {
        return false;
    }

    element = CsvIntentionHelper.getParentFieldElement(element);
    return element instanceof CsvField &&
            element.getFirstChild() != null &&
            (CsvIntentionHelper.getElementType(element.getFirstChild()) != CsvTypes.QUOTE ||
                    CsvIntentionHelper.getElementType(element.getLastChild()) != CsvTypes.QUOTE);
}
项目:RPGInventory    文件:BackpackManager.java   
@Contract("_, null -> false")
public static boolean open(Player player, @Nullable ItemStack bpItem) {
    if (ItemUtils.isEmpty(bpItem)) {
        return false;
    }

    BackpackType type;
    String bpId = ItemUtils.getTag(bpItem, ItemUtils.BACKPACK_TAG);
    if (bpId == null || (type = BackpackManager.getBackpackType(bpId)) == null) {
        return false;
    }

    Backpack backpack;
    String bpUid = ItemUtils.getTag(bpItem, ItemUtils.BACKPACK_UID_TAG);
    UUID uuid = bpUid == null ? null : UUID.fromString(bpUid);
    if (!BACKPACKS.containsKey(uuid)) {
        if (uuid == null) {
            backpack = type.createBackpack();
            ItemUtils.setTag(
                    bpItem, ItemUtils.BACKPACK_UID_TAG, backpack.getUniqueId().toString());
        } else {
            backpack = type.createBackpack(uuid);
        }

        BACKPACKS.put(backpack.getUniqueId(), backpack);
    } else {
        backpack = BACKPACKS.get(uuid);
    }

    backpack.open(player);
    return true;
}
项目:lttng-scope    文件:LamiIRQNumberAspect.java   
@Override
public @Nullable Number resolveNumber(LamiTableEntry entry) {
    LamiData data = entry.getValue(fColIndex);
    if (data instanceof LamiIRQ) {
        return (((LamiIRQ) data).getNumber());
    }

    return null;
}
项目:jmonkeybuilder    文件:FileAction.java   
public FileAction(@Nullable final ResourceElement element, @Nullable final Array<ResourceElement> elements) {
    this.element = element;
    this.elements = elements;
    setText(getName());
    setOnAction(this::execute);

    final Image icon = getIcon();
    if (icon != null) setGraphic(new ImageView(icon));
}
项目:devenv    文件:Main.java   
@Nullable
private static Command findCommand(@NotNull String name)
{
    Command[] commands = Ioc.context().findAll(Command.class);
    for (Command command : commands)
    {
        if (command.alias().contains(name))
        {
            return command;
        }
    }
    return null;
}
项目:intellij-plugin    文件:ClassNode.java   
@Nullable
@Override
public Navigatable getNavigatable() {
    PsiElement navigationElement = psiClass.getNavigationElement();
    if (navigationElement instanceof Navigatable) {
        return (Navigatable) navigationElement;
    } else {
        return null;
    }
}
项目:yii2inspections    文件:TranslationProviderUtil.java   
static public boolean isProvider(@Nullable PsiFile file) {
    //noinspection SimplifiableIfStatement - easier to read
    if (null == file || PhpFileType.INSTANCE != file.getFileType() || file.getName().equals("config.php")) {
        return false;
    }
    return file.getVirtualFile().getPath()
            .matches(".*/(translations|messages)/([a-zA-z]{2}(-[a-zA-z]{2})?)/[^/]+\\.php$");
}
项目:yii2support    文件:ClassUtils.java   
@Nullable
public static PhpClass getPhpClassByCallChain(MethodReference methodRef) {

    while (methodRef != null) {
        PhpExpression expr = methodRef.getClassReference();
        if (expr instanceof ClassReference) {
            return (PhpClass) ((ClassReference) expr).resolve();
        } else if (expr instanceof MethodReference) {
            methodRef = (MethodReference) expr;
        } else if (expr instanceof Variable) {
            PhpType type = expr.getType();
            String strType = type.toString();
            int index1 = strType.indexOf('\\');
            int index2 = strType.indexOf('.');
            if (index2 == -1)
                index2 = strType.length() - index1;

            if (index1 >= 0 && index2 >= 0 && index2 > index1) {
                String className = strType.substring(index1, index2);
                return ClassUtils.getClass(PhpIndex.getInstance(methodRef.getProject()), className);
            } else {
                return null;
            }

            // type.toString()
        } else {
            return null;
        }
    }

    return null;
}
项目:DeBrug    文件:GebeurtenisMetRechtsgevolg__BehaviorDescriptor.java   
@Override
protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) {
  int methodIndex = BH_METHODS.indexOf(method);
  if (methodIndex < 0) {
    throw new BHMethodNotFoundException(this, method);
  }
  switch (methodIndex) {
    case 0:
      return (T) ((List<SNode>) GeefLijstMetInvoerKenmerken_id6$f4rrvMdoa(node));
    default:
      throw new BHMethodNotFoundException(this, method);
  }
}
项目:dtmlibs    文件:PropertiesWrapper.java   
@Nullable
@Override
public Object getPropertyUnchecked(@NotNull String name) {
    try {
        return getProperty(name);
    } catch (Exception e) {
        return null;
    }
}
项目:CodeGen    文件:PsiUtil.java   
public static VirtualFile chooseFolder(@Nullable Project project, String title, String description, boolean showFileSystemRoots, boolean hideIgnored, @Nullable VirtualFile toSelect){
    final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    descriptor.setTitle(title);
    descriptor.setDescription(description);
    descriptor.setShowFileSystemRoots(showFileSystemRoots);
    descriptor.setHideIgnored(hideIgnored);
    return FileChooser.chooseFile(descriptor, project, toSelect);
}
项目:intellij-bpmn-editor    文件:BPMNPaletteToolWindowManager.java   
@Nullable
public BPMNFileEditor getActiveBPMNFileEditor() {
    for (FileEditor editor : myFileEditorManager.getSelectedEditors()) {
        if (editor instanceof BPMNFileEditor) {
            return (BPMNFileEditor) editor;
        }
    }

    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisApplicationSettingsForm.java   
@Nullable
@Override
protected String findItemToAdd() {
    return showEditDialog(
        "",
        "hybris.import.settings.junk.directory.popup.add.title",
        "hybris.import.settings.junk.directory.popup.add.text"
    );
}
项目:jmonkeybuilder    文件:SpatialTreeNode.java   
/**
 * Create creation menu menu.
 *
 * @param nodeTree the node tree
 * @return the menu
 */
@FXThread
protected @Nullable Menu createCreationMenu(@NotNull final NodeTree<?> nodeTree) {

    final T element = getElement();

    final Menu menu = new Menu(MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
    final Menu createControlsMenu = new Menu(MODEL_NODE_TREE_ACTION_ADD_CONTROL, new ImageView(Icons.ADD_12));

    final ObservableList<MenuItem> items = createControlsMenu.getItems();
    items.add(new CreateCustomControlAction(nodeTree, this));

    if (element.getControl(RigidBodyControl.class) == null) {
        items.add(new CreateStaticRigidBodyControlAction(nodeTree, this));
        items.add(new CreateRigidBodyControlAction(nodeTree, this));
    }

    if (element.getControl(VehicleControl.class) == null) {
        items.add(new CreateVehicleControlAction(nodeTree, this));
    }

    if (element.getControl(CharacterControl.class) == null) {
        items.add(new CreateCharacterControlAction(nodeTree, this));
    }

    if (element.getControl(MotionEvent.class) == null) {
        items.add(new CreateMotionControlAction(nodeTree, this));
    }

    items.add(new CreateLightControlAction(nodeTree, this));

    //final SkeletonControl skeletonControl = element.getControl(SkeletonControl.class);
    //if (skeletonControl != null) {
        //FIXME items.add(new CreateKinematicRagdollControlAction(nodeTree, this));
    //}

    menu.getItems().add(createControlsMenu);

    return menu;
}
项目:pysonar2    文件:Node.java   
public void addChildren(@Nullable Node... nodes) {
    if (nodes != null) {
        for (Node n : nodes) {
            if (n != null) {
                n.setParent(this);
            }
        }
    }
}
项目:lttng-scope    文件:DebugOptionsDialog.java   
protected TextFieldControl(@Nullable String labelText, ConfigOption<T> option) {
    fOption = option;

    Label label = new Label(labelText + ":"); //$NON-NLS-1$
    load();

    getChildren().addAll(label, fTextField);
    setAlignment(Pos.CENTER_LEFT);
    setSpacing(SPACING);
}
项目:reasonml-idea-plugin    文件:ParserState.java   
@Nullable
public ParserScope endUntilStartForced() {
    ParserScope scope = null;

    if (!scopes.empty()) {
        scope = scopes.peek();
        while (scope != null && scope.scopeType != startExpression) {
            scopes.pop().end();
            scope = getLatestScope();
        }
    }

    return scope;
}
项目:traute    文件:InstrumentationApplianceFinder.java   
/**
 * Checks if given {@code AST} element's modifiers contain any of the
 * {@link TrautePluginSettings#getNotNullAnnotations() NotNull} or
 * or {@link TrautePluginSettings#getNullableAnnotations() Nullable} annotation.
 *
 * @param modifiers {@code AST} element's modifiers to check
 * @return          annotations lookup result
 */
@NotNull
private Annotations findAnnotation(@Nullable ModifiersTree modifiers) {
    Set<String> annotationsInSource = extractAnnotations(modifiers);
    if (annotationsInSource.isEmpty()) {
        return Annotations.EMPTY;
    }
    return new Annotations(findMatch(annotationsInSource, context.getPluginSettings().getNotNullAnnotations()),
                           findMatch(annotationsInSource, context.getPluginSettings().getNullableAnnotations()));
}
项目:yii2inspections    文件:NamedElementUtil.java   
/** returns name identifier, which is valid for reporting */
@Nullable
static public PsiElement getNameIdentifier(@Nullable PsiNameIdentifierOwner element) {
    if (null != element) {
        PsiElement id          = element.getNameIdentifier();
        boolean isIdReportable = null != id && id.getTextLength() > 0;

        return isIdReportable ? id : null;
    }

    return null;
}
项目:jfrog-idea-plugin    文件:NpmScanManagerTests.java   
private ExternalProjectRefreshCallback getRefreshDependenciesCbk() {
    return new ExternalProjectRefreshCallback() {
        @Override
        public void onSuccess(@Nullable DataNode<ProjectData> externalProject) {
        }

        @Override
        public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) {
            fail(errorMessage + ": " + errorDetails);
        }
    };
}
项目:pysonar2    文件:Builtins.java   
/**
 * Lazily load the module.
 */
@Nullable
ModuleType getModule() {
    if (module == null) {
        createModuleType();
        initBindings();
    }
    return module;
}
项目:J-Cord    文件:Emojis.java   
/**
 * Get an emoji by name.
 *
 * @param name The name.
 * @return An emoji, or null if no name matches.
 */
@Nullable
public static Emoji getByName(String name) {
    for (Emoji emoji : EMOJIS) {
        if (emoji.getName().equals(name))
            return emoji;
    }
    return null;
}
项目:DeBrug    文件:IKorteNaam__BehaviorDescriptor.java   
@Override
protected <T> T invokeSpecial0(@NotNull SAbstractConcept concept, @NotNull SMethod<T> method, @Nullable Object[] parameters) {
  int methodIndex = BH_METHODS.indexOf(method);
  if (methodIndex < 0) {
    throw new BHMethodNotFoundException(this, method);
  }
  switch (methodIndex) {
    default:
      throw new BHMethodNotFoundException(this, method);
  }
}
项目:lttng-scope    文件:TimeGraphWidget.java   
/**
 * Set the selected state rectangle
 *
 * @param state
 *            The new selected state. It should ideally be one that's
 *            present in the scenegraph.
 * @param deselectPrevious
 *            If the previously selected interval should be unmarked as
 *            selected.
 */
public void setSelectedState(StateRectangle state, boolean deselectPrevious) {
    @Nullable StateRectangle previousSelectedState = fSelectedState;
    if (previousSelectedState != null) {
        previousSelectedState.hideTooltip();
        if (deselectPrevious) {
            previousSelectedState.setSelected(false);
        }
    }

    state.setSelected(true);
    fSelectedState = state;
}
项目:DeBrug    文件:VerplichteBevoegdheidVerplichteGehoudenheid__BehaviorDescriptor.java   
@Override
protected <T> T invokeSpecial0(@NotNull SNode node, @NotNull SMethod<T> method, @Nullable Object[] parameters) {
  int methodIndex = BH_METHODS.indexOf(method);
  if (methodIndex < 0) {
    throw new BHMethodNotFoundException(this, method);
  }
  switch (methodIndex) {
    case 0:
      return (T) ((SNode) GeefOvergang_id2hDGrbWPFpO(node));
    default:
      throw new BHMethodNotFoundException(this, method);
  }
}
项目:jfrog-idea-plugin    文件:NpmScanManager.java   
private void populateDependenciesTree(ScanTreeNode scanTreeNode, @Nullable JsonNode dependencies) {
    if (dependencies == null) {
        return;
    }
    dependencies.fields().forEachRemaining(stringJsonNodeEntry -> {
        String componentId = getComponentId(stringJsonNodeEntry);
        addSubtree(stringJsonNodeEntry, scanTreeNode, componentId); // Mutual recursive call
    });
}
项目:Shuriken    文件:Reflect.java   
@Nullable
static Method setMethodAccessible(Method method) {
    try {
        if (!method.isAccessible()) method.setAccessible(true);
        return method;
    }
    catch (NullPointerException|SecurityException ignored){}
    return null;
}
项目:JColor    文件:JColorFinder.java   
@Nullable
public static Color findColor(PsiElement element) {

    Color color = null;

    //noinspection ConstantConditions
    if (color == null) color = findInMethodCall(element, ColorARGB);
    if (color == null) color = findInMethodCall(element, ColorRGB);
    if (color == null) color = findInMethodCall(element, ColorParseColor);

    return color;
}
项目:jmonkeybuilder    文件:SceneFileEditor.java   
@Override
@FXThread
protected void updateSelection(@Nullable Spatial spatial) {

    if (spatial instanceof SceneNode || spatial instanceof SceneLayer) {
        spatial = null;
    }

    super.updateSelection(spatial);
}
项目:scmt-server    文件:Case.java   
/**
 * Gets the message link url
 * @return the message link url or null
 */
@Nullable
public String getMessageLinkUrl() {
    if (getMessageLink() == null) {
        return null;
    }
    return getMessageLink().getUrl();
}