Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Expose delimiters in CallSiteDescriptor

  • Loading branch information...
commit 23e473975dae3273a51fda645277fbeaebcaea36 1 parent 4538545
@szegedi authored
View
10 src/main/java/org/dynalang/dynalink/CallSiteDescriptor.java
@@ -50,6 +50,16 @@
public static final int NAME_OPERAND=2;
/**
+ * Character used to delimit tokens in an call site name.
+ */
+ public static final String TOKEN_DELIMITER = ":";
+
+ /**
+ * Character used to delimit operation names in a composite operation specification.
+ */
+ public static final String OPERATOR_DELIMITER = "|";
+
+ /**
* Returns the number of tokens in the name of the method at the call site. Method names are tokenized with the
* colon ":" character, i.e. "dyn:getProp:color" would be the name used to describe a method that retrieves the
* property named "color" on the object it is invoked on.
View
5 src/main/java/org/dynalang/dynalink/support/CallSiteDescriptorFactory.java
@@ -21,7 +21,6 @@
* @author Attila Szegedi
*/
public class CallSiteDescriptorFactory {
- private static final String TOKEN_DELIMITER = ":";
private static final WeakHashMap<CallSiteDescriptor, WeakReference<CallSiteDescriptor>> publicDescs =
new WeakHashMap<>();
@@ -90,7 +89,7 @@ private static boolean isPublicLookup(Lookup lookup) {
* @return an array of tokens
*/
public static String[] tokenizeName(String name) {
- final StringTokenizer tok = new StringTokenizer(name, TOKEN_DELIMITER);
+ final StringTokenizer tok = new StringTokenizer(name, CallSiteDescriptor.TOKEN_DELIMITER);
final String[] tokens = new String[tok.countTokens()];
for(int i = 0; i < tokens.length; ++i) {
String token = tok.nextToken();
@@ -110,7 +109,7 @@ private static boolean isPublicLookup(Lookup lookup) {
*/
public static List<String> tokenizeOperators(CallSiteDescriptor desc) {
final String ops = desc.getNameToken(CallSiteDescriptor.OPERATOR);
- final StringTokenizer tok = new StringTokenizer(ops, "|");
+ final StringTokenizer tok = new StringTokenizer(ops, CallSiteDescriptor.OPERATOR_DELIMITER);
final int count = tok.countTokens();
if(count == 1) {
return Collections.singletonList(ops);
Please sign in to comment.
Something went wrong with that request. Please try again.