1 22 package org.jboss.metadata; 23 24 46 public class MethodAttributes 47 { 48 String pattern; 49 boolean readOnly; 50 boolean idempotent; 51 int txTimeout; 52 53 public static MethodAttributes kDefaultMethodAttributes; 54 55 static 56 { 57 kDefaultMethodAttributes = new MethodAttributes(); 58 kDefaultMethodAttributes.pattern = "*"; 59 kDefaultMethodAttributes.readOnly = false; 60 kDefaultMethodAttributes.idempotent = false; 61 kDefaultMethodAttributes.txTimeout = 0; 62 } 63 64 public void setPattern(String pattern) 65 { 66 this.pattern = pattern; 67 } 68 69 public void setReadOnly(boolean readOnly) 70 { 71 this.readOnly = readOnly; 72 } 73 74 public void setIdempotent(boolean idempotent) 75 { 76 this.idempotent = idempotent; 77 } 78 79 public void setTxTimeout(int txTimeout) 80 { 81 this.txTimeout = txTimeout; 82 } 83 84 public boolean patternMatches(String methodName) 85 { 86 int ct, end; 87 88 end = pattern.length(); 89 90 if(end > methodName.length()) 91 return false; 92 93 for(ct = 0; ct < end; ct ++) 94 { 95 char c = pattern.charAt(ct); 96 if(c == '*') 97 return true; 98 if(c != methodName.charAt(ct)) 99 return false; 100 } 101 return ct == methodName.length(); 102 } 103 104 public boolean isReadOnly() 105 { 106 return readOnly; 107 } 108 109 public boolean isIdempotent() 110 { 111 return idempotent; 112 } 113 114 public int getTransactionTimeout() 115 { 116 return txTimeout; 117 } 118 } 119 | Popular Tags |