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


Java StringPattern.matches方法代码示例

本文整理汇总了Java中classycle.util.StringPattern.matches方法的典型用法代码示例。如果您正苦于以下问题:Java StringPattern.matches方法的具体用法?Java StringPattern.matches怎么用?Java StringPattern.matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在classycle.util.StringPattern的用法示例。


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

示例1: createNode

import classycle.util.StringPattern; //导入方法依赖的package包/类
/**
 * Creates a new node with unresolved references.
 *
 * @param stream
 *            A just opended byte stream of a class file. If this method finishes succefully the internal pointer of
 *            the stream will point onto the superclass index.
 * @param source
 *            Optional source of the class file. Can be <code>null</code>.
 * @param size
 *            Number of bytes of the class file.
 * @param reflectionPattern
 *            Pattern used to check whether a {@link StringConstant} refer to a class. Can be <tt>null</tt>.
 * @return a node with unresolved link of all classes used by the analysed class.
 */
private static UnresolvedNode createNode(InputStream stream, String source, int size,
        StringPattern reflectionPattern) throws IOException {
    // Reads constant pool, accessFlags, and class name
    final DataInputStream dataStream = new DataInputStream(stream);
    final Constant[] pool = Constant.extractConstantPool(dataStream);
    final int accessFlags = dataStream.readUnsignedShort();
    final String name = ((ClassConstant) pool[dataStream.readUnsignedShort()]).getName();
    ClassAttributes attributes = null;
    if ((accessFlags & ACC_INTERFACE) != 0) {
        attributes = ClassAttributes.createInterface(name, source, size);
    } else {
        if ((accessFlags & ACC_ABSTRACT) != 0) {
            attributes = ClassAttributes.createAbstractClass(name, source, size);
        } else {
            attributes = ClassAttributes.createClass(name, source, size);
        }
    }

    // Creates a new node with unresolved references
    final UnresolvedNode node = new UnresolvedNode();
    node.setAttributes(attributes);
    for (int i = 0; i < pool.length; i++) {
        final Constant constant = pool[i];
        if (constant instanceof ClassConstant) {
            final ClassConstant cc = (ClassConstant) constant;
            if (!cc.getName().startsWith("[") && !cc.getName().equals(name)) {
                node.addLinkTo(cc.getName());
            }
        } else if (constant instanceof UTF8Constant) {
            parseUTF8Constant((UTF8Constant) constant, node, name);
        } else if (reflectionPattern != null && constant instanceof StringConstant) {
            final String str = ((StringConstant) constant).getString();
            if (ClassNameExtractor.isValid(str) && reflectionPattern.matches(str)) {
                node.addLinkTo(str);
            }
        }
    }
    return node;
}
 
开发者ID:sake92,项目名称:hepek-classycle,代码行数:54,代码来源:Parser.java

示例2: isMatchedBy

import classycle.util.StringPattern; //导入方法依赖的package包/类
public boolean isMatchedBy(StringPattern pattern) {
    return pattern.matches(getAttributes().getName());
}
 
开发者ID:sake92,项目名称:hepek-classycle,代码行数:4,代码来源:UnresolvedNode.java

示例3: isMatchedBy

import classycle.util.StringPattern; //导入方法依赖的package包/类
public boolean isMatchedBy(StringPattern pattern)
{
  return pattern.matches(getAttributes().getName());
}
 
开发者ID:gdela,项目名称:socomo-maven-plugin,代码行数:5,代码来源:UnresolvedNode.java

示例4: createNode

import classycle.util.StringPattern; //导入方法依赖的package包/类
/**
 *  Creates a new node with unresolved references.
 *  @param stream A just opended byte stream of a class file.
 *         If this method finishes succefully the internal pointer of the
 *         stream will point onto the superclass index.
 * @param source Optional source of the class file. Can be <code>null</code>.
 *  @param size Number of bytes of the class file.
 *  @param reflectionPattern Pattern used to check whether a
 *         {@link StringConstant} refer to a class. Can be <tt>null</tt>.
 *  @return a node with unresolved link of all classes used by the analysed
 *         class.
 */
private static UnresolvedNode createNode(InputStream stream, String source, 
                                         int size,
                                         StringPattern reflectionPattern)
                              throws IOException 
{
  // Reads constant pool, accessFlags, and class name
  DataInputStream dataStream = new DataInputStream(stream);
  Constant[] pool = Constant.extractConstantPool(dataStream);
  int accessFlags = dataStream.readUnsignedShort();
  String name =
      ((ClassConstant) pool[dataStream.readUnsignedShort()]).getName();
  ClassAttributes attributes = null;
  if ((accessFlags & ACC_INTERFACE) != 0) 
  {
    attributes = ClassAttributes.createInterface(name, source, size);
  } else 
  {
    if ((accessFlags & ACC_ABSTRACT) != 0) 
    {
      attributes = ClassAttributes.createAbstractClass(name, source, size);
    } else 
    {
      attributes = ClassAttributes.createClass(name, source, size);
    }
  }

  // Creates a new node with unresolved references
  UnresolvedNode node = new UnresolvedNode();
  node.setAttributes(attributes);
  for (int i = 0; i < pool.length; i++) 
  {
    Constant constant = pool[i];
    if (constant instanceof ClassConstant) 
    {
      ClassConstant cc = (ClassConstant) constant;
      if (!cc.getName().startsWith(("[")) && !cc.getName().equals(name)) 
      {
        node.addLinkTo(cc.getName());
      }
    } else if (constant instanceof UTF8Constant) 
    {
      parseUTF8Constant((UTF8Constant) constant, node, name);
    } else if (reflectionPattern != null 
               && constant instanceof StringConstant) 
    {
      String str = ((StringConstant) constant).getString();
      if (ClassNameExtractor.isValid(str) && reflectionPattern.matches(str)) 
      {
        node.addLinkTo(str);
      }
    }
  }
  return node;
}
 
开发者ID:gdela,项目名称:socomo-maven-plugin,代码行数:67,代码来源:Parser.java


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