objexj

Objex J

License

License

MIT
GroupId

GroupId

com.edugility
ArtifactId

ArtifactId

objexj
Last Version

Last Version

1.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

objexj
Objex J
Project Organization

Project Organization

Laird Nelson
Source Code Management

Source Code Management

https://github.com/ljnelson/objexj/

Download objexj

How to add to project

<!-- https://jarcasting.com/artifacts/com.edugility/objexj/ -->
<dependency>
    <groupId>com.edugility</groupId>
    <artifactId>objexj</artifactId>
    <version>1.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.edugility/objexj/
implementation 'com.edugility:objexj:1.3.0'
// https://jarcasting.com/artifacts/com.edugility/objexj/
implementation ("com.edugility:objexj:1.3.0")
'com.edugility:objexj:jar:1.3.0'
<dependency org="com.edugility" name="objexj" rev="1.3.0">
  <artifact name="objexj" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.edugility', module='objexj', version='1.3.0')
)
libraryDependencies += "com.edugility" % "objexj" % "1.3.0"
[com.edugility/objexj "1.3.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.mvel : mvel2 jar 2.1.3.Final

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

objexj

Regular Expressions for Java Objects

January 16, 2012

Laird Nelson

objexj is a small project that provides the ability to match input (a List of items) against an expression.

That of course is what regular expressions are all about.

The difference here is that you can use any Java Object you want, not just characters in a string.

The syntax hews close to Perl-compatible regular expressions, with a few modifications.

The underlying machinery is heavily inspired by Russ Cox's excellent paper entitled Regular Expression Matching: the Virtual Machine Approach.

Sample Code

@Test
public void testLastException() throws IOException {
  final String sourceCode = "^java.lang.Exception*/(java.lang.Exception(message == \"third\"))$";
  final Pattern<Exception> pattern = Pattern.compile(sourceCode);
  assertNotNull(pattern);

  final List<Exception> input = new ArrayList<Exception>();
  input.add(new IllegalStateException("first"));
  input.add(new IllegalArgumentException("second"));
  final Exception third = new RuntimeException("third");
  input.add(third);

  final Matcher<Exception> matcher = pattern.matcher(input);
  assertNotNull(matcher);

  assertEquals(2, matcher.groupCount());

  final List<Exception> group1 = matcher.group(1);
  assertNotNull(group1);
  assertEquals(1, group1.size());

  final Exception group1Exception = group1.get(0);
  assertSame(third, group1Exception);
}

Versions

Version
1.3.0
1.2.2
1.2.1
1.2.0
1.1.0
1.0.0