本文整理汇总了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;
}
示例2: isMatchedBy
import classycle.util.StringPattern; //导入方法依赖的package包/类
public boolean isMatchedBy(StringPattern pattern) {
return pattern.matches(getAttributes().getName());
}
示例3: isMatchedBy
import classycle.util.StringPattern; //导入方法依赖的package包/类
public boolean isMatchedBy(StringPattern pattern)
{
return pattern.matches(getAttributes().getName());
}
示例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;
}