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

项目:strictfp-back-end    文件:Article.java   
public Article(
        int id,
        @NotNull @NonNls LocalDate publishTime,
        @NotNull Author author,
        @NotNull Set<Tag> tags,
        @NotNull @NonNls String title,
        @NotNull @NonNls String brief,
        @NotNull @NonNls String content,
        int up,
        int down,
        int click) {
    this.brief = brief;
    this.title = title;
    this.tags = tags;
    this.id = id;
    this.publishDate = publishTime;
    this.content = content;
    this.up = up;
    this.down = down;
    this.click = click;
    this.author = author;
}
项目:AppleScript-IDEA    文件:AppleScriptHandlerInterleavedParameters.java   
@Override
public PsiElement setName(@NonNls @NotNull String newElementName) throws IncorrectOperationException {
  //todo implement this via rename refactor: RenamePsiElementProcessor & RenameHandler for each distinct selector
  final int selectors = getParameters().size();
  final String[] selectorNames = newElementName.split(":");
  if (selectorNames.length == selectors) {
    for (int index = 0; index < selectors; index++) {
      AppleScriptIdentifier myId = getParameters().get(index).getSelectorNameIdentifier();
      final AppleScriptIdentifier idNew = AppleScriptPsiElementFactory.createIdentifierFromText(getProject(), selectorNames[index]);
      if (idNew != null) {
        myId.replace(idNew);
      }
    }
  } else {
    AppleScriptIdentifier myIdentifier = getParameters().get(0).getSelectorNameIdentifier();
    final AppleScriptIdentifier identifierNew = AppleScriptPsiElementFactory.createIdentifierFromText(getProject(), newElementName);
    if (identifierNew != null) {
      myIdentifier.replace(identifierNew);
    }
  }
  return this;
}
项目:strictfp-back-end    文件:VerifyAccount.java   
public boolean verifyZhihuImportance(@NotNull @NonNls String username) {
    try {
        IntTokenizer tokenizer = null;
        Document page = Jsoup.parse(
                new URL(String.format(ZhihuApiRoot,username)),
                5000
        );
        Elements root = page.select("div[class='meta']");
        tokenizer = IntTokenizer.of(root.text());
        int reputationPoint = tokenizer.nextToken();
        tokenizer.nextToken();
        int likesPoint = tokenizer.nextToken();
        return (reputationPoint >= 50 && likesPoint >= 40);
    } catch (IOException e) {
        throw new RuntimeException("unable to fetch data from zhihu", e);
    }
}
项目:manifold-ij    文件:ManShortNamesCache.java   
private void findPsiClasses( @NotNull @NonNls String name, @NotNull GlobalSearchScope scope, Set<PsiClass> psiClasses, ManModule start, ManModule module )
{
  for( ITypeManifold tm: module.getTypeManifolds() )
  {
    for( String fqn: tm.getAllTypeNames() )
    {
      String simpleName = ClassUtil.extractClassName( fqn );
      if( simpleName.equals( name ) )
      {
        PsiClass psiClass = ManifoldPsiClassCache.instance().getPsiClass( scope, module, fqn );
        if( psiClass == null )
        {
          return;
        }
        psiClasses.add( psiClass );
      }
    }
  }
  for( Dependency d : module.getDependencies() )
  {
    if( module == start || d.isExported() )
    {
      findPsiClasses( name, scope, psiClasses, start, (ManModule)d.getModule() );
    }
  }
}
项目:strictfp-back-end    文件:VerifyAccount.java   
public boolean verifyStackOverFlowAccount(@NotNull @NonNls String username) {
    try {
        String url = SOFApiRoot + String.format(
                "users?order=asc&min=%s&max=%s&sort=name&inname=%s&site=stackoverflow",
                username,
                username,
                username
        );
        HttpURLConnection conn = HttpURLConnection.class.cast(new URL(url).openConnection());
        if (conn.getResponseCode() != 200) return false;
        JSONTokener tokener = new JSONTokener(new GZIPInputStream(conn.getInputStream()));
        // note that it was compressed
        JSONObject object = JSONObject.class.cast(tokener.nextValue());
        conn.disconnect();
        return object.getJSONArray("items").length() != 0;
        // 特判一下吧还是。。昨晚查询不存在用户返回的是200 ...和一个json
        // 上面打这段注释的,没注意到我判断了返回的结果是否包含有效用户吗 =-= , bug 'fixed'
    } catch (IOException e) {
        throw new RuntimeException("unable to fetch data from stackoverflow", e);
    }
}
项目: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
*/
    }
项目:strictfp-back-end    文件:Pair.java   
@Contract(pure = true)
@NotNull
@NonNls
public static String[] convert(Pair... origin) {
    String[] ret = new String[origin.length];
    for (int i = 0; i < ret.length; ++i) ret[i] = origin[i].getCombined();
    return ret;
}
项目:strictfp-back-end    文件:MySqlAdapter.java   
@Override
    public synchronized boolean insert(
            @NotNull @NonNls String tableName,
            @NotNull @NonNls String... value) {
        // TODO unsafe , needs to be fixed - phosphorus15
        try {
//          PreparedStatement preparedStatement = connection.prepareStatement();
            String boyNextDoor = "INSERT INTO " + tableName + " VALUES ( ";
            for (String val : value) execSQL(boyNextDoor + val + " )");
            return true;
        } catch (RuntimeException e) {
            return false;
        }
    }
项目:strictfp-back-end    文件:MySqlAdapter.java   
private MySqlAdapter(@NotNull @NonNls String url) {

        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            connection = DriverManager.getConnection(url, Constant.SERVER.DATABASE_USERNAME,
                    Constant.SERVER.DATABASE_PASSWORD);
            connection.setAutoCommit(false);
            statement = connection.createStatement();
        } catch (Exception e) {
            throw new RuntimeException("cannot connect to the database!", e);
        }
    }
项目:strictfp-back-end    文件:Tools.java   
/**
 * an OI-style reading method
 *
 * @param content raw
 * @return parsed int
 */
@Contract(pure = true)
public static int getValidNumber(@NotNull @NonNls char[] content) {
    int index = 0;
    int result = 0;
    int current = content[index++];
    while (!(current >= '0' && current <= '9')) current = content[index++];
    while (index <= content.length && current >= '0' && current <= '9') {
        result = (result << 3) + (result << 1) + (current - '0'); // equal to result * 10
        if (index >= content.length) break;
        current = content[index++];
    }
    return result;
}
项目:strictfp-back-end    文件:MySqlAdapter.java   
@NotNull
@Override
public ResultSet querySQL(
        @NotNull @NonNls String sql) {
    try {
        logger.info("Run SQL statement: " + sql);
        return statement.executeQuery(sql);
    } catch (SQLException e) {
        e.printStackTrace();
        throw new RuntimeException("sql error!");
    }
}
项目:manifold-ij    文件:ManShortNamesCache.java   
@NotNull
@Override
public PsiClass[] getClassesByName( @NotNull @NonNls String name, @NotNull GlobalSearchScope scope )
{
  Set<PsiClass> psiClasses = new HashSet<>();
  for( ManModule module: ManTypeFinder.findModules( scope ) )
  {
    findPsiClasses( name, scope, psiClasses, module );
  }
  return psiClasses.toArray( new PsiClass[psiClasses.size()] );
}
项目:magento2-phpstorm-plugin    文件:LineMarkerXmlTagDecorator.java   
/**
 * Get line marker text. This method should be overridden to generate user-friendly XmlTag presentation.
 */
@Override
@NotNull
@NonNls
public String getName() {
    return String.format("%s [%s] - %s", getComponentName(), getAreaName(), getDescription());
}
项目:magento2-phpstorm-plugin    文件:LineMarkerXmlTagDecorator.java   
@Override
@Contract(
        pure = true
)
public boolean textMatches(@NotNull @NonNls CharSequence charSequence) {
    return xmlTag.textMatches(charSequence);
}
项目:strictfp-back-end    文件:DatabaseAdapter.java   
@NotNull
default ResultSet selectWithExtraInfo(
        @NotNull @NonNls String tableName,
        @Nullable @NonNls String columnName,
        @NotNull @NonNls String extraInfo) {
    return querySQL(getQueryString(tableName, columnName) + extraInfo);
}
项目:magento2-phpstorm-plugin    文件:TypeConfigurationIndex.java   
@Override
@NotNull
@NonNls
public String getName() {
    String preference = xmlTag.getAttributeValue(TYPE_ATTRIBUTE);
    if (preference != null) {
        return String.format("[%s] preference %s", getAreaName(), preference);
    }
    return xmlTag.getName();
}
项目:magento2-phpstorm-plugin    文件:WebApiTypeIndex.java   
@Override
@NotNull
@NonNls
public String getName() {
    String httpMethod = this.xmlTag.getAttributeValue("method");
    String route = this.xmlTag.getAttributeValue("url");
    if (httpMethod != null && route != null) {
        return String.format("  %-7s %s", httpMethod, route);
    }
    return xmlTag.getName();
}
项目:intellij-bpmn-editor    文件:BPMNFileSchemaProvider.java   
private static XmlFile getReference(@NotNull @NonNls String url, @NotNull Module module) {
    if (url.equalsIgnoreCase("http://bpmn.sourceforge.net")) {
        return null;
    }
    final URL resource = BPMNFileSchemaProvider.class.getResource(BPMNModelConstants.BPMN_SCHEMA_BASEURI + BPMNModelConstants.BPMN_SYSTEM_ID);
    final VirtualFile fileByURL = VfsUtil.findFileByURL(resource);
    if (fileByURL == null) {
        return null;
    }

    PsiFile psiFile = PsiManager.getInstance(module.getProject()).findFile(fileByURL);
    return (XmlFile) psiFile.copy();
}
项目:hybris-integration-intellij-idea-plugin    文件:TypeSystemConverterBase.java   
@Nullable
@Override
public final DOM fromString(
    @Nullable @NonNls final String s, final ConvertContext context
) {
    if (StringUtil.isEmpty(s)) {
        return null;
    }
    return searchForName(s, context, TSMetaModelAccess.getInstance(context.getProject()).
        getTypeSystemMeta(context.getFile()));
}
项目:hybris-integration-intellij-idea-plugin    文件:CompositeConverter.java   
@Nullable
@Override
public DOM fromString(
    @Nullable @NonNls final String s, final ConvertContext context
) {
    for (TypeSystemConverterBase<? extends DOM> next : myDelegates) {
        final DOM nextResult = next.fromString(s, context);
        if (nextResult != null) {
            return nextResult;
        }
    }
    return null;
}
项目:educational-plugin    文件:EduIntellijUtils.java   
public static void addTemplate(@NotNull final Project project, @NotNull VirtualFile baseDir, @NotNull @NonNls final String templateName) {
        final FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate(templateName);
        final PsiDirectory projectDir = PsiManager.getInstance(project).findDirectory(baseDir);
        if (projectDir == null) return;
        try {
//            PsiDirectory utilDir = projectDir.findSubdirectory("util");
//            if (utilDir == null) {
//                utilDir = projectDir.createSubdirectory("util");
//            }
            FileTemplateUtil.createFromTemplate(template, templateName, null, projectDir);
        } catch (Exception exception) {
            LOG.error("Failed to create from file template ", exception);
        }

    }
项目:yii2support    文件:TestDataSource.java   
@Override
public PsiElement setName(@NonNls @NotNull String s) throws IncorrectOperationException {
    return null;
}
项目:strictfp-back-end    文件:WriterType.java   
public boolean addRefuse(@NotNull @NonNls String power) {
    return powerMap.put(power, false);
}
项目:yii2support    文件:TestNamespace.java   
@Override
public PsiElement setName(@NonNls @NotNull String s) throws IncorrectOperationException {
    return null;
}
项目:sercapnp    文件:CapnpTokenType.java   
public CapnpTokenType(@NotNull @NonNls String debugName) {
    super(debugName, CapnpLanguage.INSTANCE);
}
项目:yii2support    文件:TestColumn.java   
@Override
public PsiElement setName(@NonNls @NotNull String s) throws IncorrectOperationException {
    return null;
}
项目:strictfp-back-end    文件:Pair.java   
public Pair(
        @NotNull @NonNls String key,
        @NotNull @NonNls String value) {
    this.key = key;
    this.value = value;
}
项目:GitHub    文件:Timber.java   
/** Log a verbose message with optional format args. */
public static void v(@NonNls String message, Object... args) {
  TREE_OF_SOULS.v(message, args);
}
项目:GitHub    文件:Timber.java   
/** Log a verbose exception and a message with optional format args. */
public static void v(Throwable t, @NonNls String message, Object... args) {
  TREE_OF_SOULS.v(t, message, args);
}
项目:GitHub    文件:Timber.java   
/** Log a debug exception and a message with optional format args. */
public static void d(Throwable t, @NonNls String message, Object... args) {
  TREE_OF_SOULS.d(t, message, args);
}
项目:GitHub    文件:Timber.java   
/** Log an info message with optional format args. */
public static void i(@NonNls String message, Object... args) {
  TREE_OF_SOULS.i(message, args);
}
项目:GitHub    文件:Timber.java   
/** Log an info exception and a message with optional format args. */
public static void i(Throwable t, @NonNls String message, Object... args) {
  TREE_OF_SOULS.i(t, message, args);
}
项目:GitHub    文件:Timber.java   
/** Log a warning message with optional format args. */
public static void w(@NonNls String message, Object... args) {
  TREE_OF_SOULS.w(message, args);
}
项目:idea-onescript    文件:OneScriptTokenType.java   
public OneScriptTokenType(@NotNull @NonNls String debugName) {
    super(debugName, OneScriptLanguage.INSTANCE);
}
项目:strictfp-back-end    文件:Tag.java   
@NotNull
@NonNls
@Override
public String toString() {
    return getName();
}
项目:strictfp-back-end    文件:DatabaseAdapter.java   
@NotNull
ResultSet querySQL(@NotNull @NonNls String sql);
项目:GitHub    文件:Timber.java   
/** Log an assert message with optional format args. */
public static void wtf(@NonNls String message, Object... args) {
  TREE_OF_SOULS.wtf(message, args);
}
项目:GitHub    文件:Timber.java   
/** Log an assert exception and a message with optional format args. */
public static void wtf(Throwable t, @NonNls String message, Object... args) {
  TREE_OF_SOULS.wtf(t, message, args);
}
项目:GitHub    文件:Timber.java   
/** Log at {@code priority} a message with optional format args. */
public static void log(int priority, @NonNls String message, Object... args) {
  TREE_OF_SOULS.log(priority, message, args);
}
项目:strictfp-back-end    文件:VerifyAccount.java   
public boolean verifyZhihuAccount(@NotNull @NonNls String username) {
    return verify("https://www.zhihu.com/people/", username);
    //FIXME: 由于严重违反知乎社区规范,该用户帐号已被停用。 这个是返回200的,测试账号fu-qian-yi-55
    //回上 , 这个账号测试返回404 。。。。。 具体去看test case
}