id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
142,600
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.getPhysicalNetworkFunctionRecords
@Help( help = "Get all the PhysicalNetworkFunctionRecords of a specific NetworkServiceRecord with id" ) public List<PhysicalNetworkFunctionRecord> getPhysicalNetworkFunctionRecords(final String idNsr) throws SDKException { String url = idNsr + "/pnfrecords"; return Arrays.asList( (PhysicalNetworkFunctionRecord[]) requestGetAll(url, PhysicalNetworkFunctionRecord.class)); }
java
@Help( help = "Get all the PhysicalNetworkFunctionRecords of a specific NetworkServiceRecord with id" ) public List<PhysicalNetworkFunctionRecord> getPhysicalNetworkFunctionRecords(final String idNsr) throws SDKException { String url = idNsr + "/pnfrecords"; return Arrays.asList( (PhysicalNetworkFunctionRecord[]) requestGetAll(url, PhysicalNetworkFunctionRecord.class)); }
[ "@", "Help", "(", "help", "=", "\"Get all the PhysicalNetworkFunctionRecords of a specific NetworkServiceRecord with id\"", ")", "public", "List", "<", "PhysicalNetworkFunctionRecord", ">", "getPhysicalNetworkFunctionRecords", "(", "final", "String", "idNsr", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/pnfrecords\"", ";", "return", "Arrays", ".", "asList", "(", "(", "PhysicalNetworkFunctionRecord", "[", "]", ")", "requestGetAll", "(", "url", ",", "PhysicalNetworkFunctionRecord", ".", "class", ")", ")", ";", "}" ]
Returns a List of all the PhysicalNetworkFunctionRecords that are contained in a particular NetworkServiceRecord. @param idNsr the ID of the NetworkServiceRecord @return a List of PhysicalNetworkFunctionRecords @throws SDKException if the request fails
[ "Returns", "a", "List", "of", "all", "the", "PhysicalNetworkFunctionRecords", "that", "are", "contained", "in", "a", "particular", "NetworkServiceRecord", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L555-L563
142,601
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.getPhysicalNetworkFunctionRecord
@Help(help = "Get the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id") public PhysicalNetworkFunctionRecord getPhysicalNetworkFunctionRecord( final String idNsr, final String idPnfr) throws SDKException { String url = idNsr + "/pnfrecords" + "/" + idPnfr; return (PhysicalNetworkFunctionRecord) requestGetWithStatusAccepted(url, PhysicalNetworkFunctionRecord.class); }
java
@Help(help = "Get the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id") public PhysicalNetworkFunctionRecord getPhysicalNetworkFunctionRecord( final String idNsr, final String idPnfr) throws SDKException { String url = idNsr + "/pnfrecords" + "/" + idPnfr; return (PhysicalNetworkFunctionRecord) requestGetWithStatusAccepted(url, PhysicalNetworkFunctionRecord.class); }
[ "@", "Help", "(", "help", "=", "\"Get the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id\"", ")", "public", "PhysicalNetworkFunctionRecord", "getPhysicalNetworkFunctionRecord", "(", "final", "String", "idNsr", ",", "final", "String", "idPnfr", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/pnfrecords\"", "+", "\"/\"", "+", "idPnfr", ";", "return", "(", "PhysicalNetworkFunctionRecord", ")", "requestGetWithStatusAccepted", "(", "url", ",", "PhysicalNetworkFunctionRecord", ".", "class", ")", ";", "}" ]
Returns a specific PhysicalNetworkFunctionRecord. @param idNsr the ID of the NetworkFunctionRecord containing the PhysicalNetworkFunctionRecord @param idPnfr the ID of the requested PhysicalNetworkFunctionRecord @return the PhysicalNetworkFunctionRecord @throws SDKException if the request fails
[ "Returns", "a", "specific", "PhysicalNetworkFunctionRecord", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L573-L579
142,602
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.deletePhysicalNetworkFunctionRecord
@Help( help = "Delete the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id" ) public void deletePhysicalNetworkFunctionRecord(final String idNsr, final String idPnfr) throws SDKException { String url = idNsr + "/pnfrecords" + "/" + idPnfr; requestDelete(url); }
java
@Help( help = "Delete the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id" ) public void deletePhysicalNetworkFunctionRecord(final String idNsr, final String idPnfr) throws SDKException { String url = idNsr + "/pnfrecords" + "/" + idPnfr; requestDelete(url); }
[ "@", "Help", "(", "help", "=", "\"Delete the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id\"", ")", "public", "void", "deletePhysicalNetworkFunctionRecord", "(", "final", "String", "idNsr", ",", "final", "String", "idPnfr", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/pnfrecords\"", "+", "\"/\"", "+", "idPnfr", ";", "requestDelete", "(", "url", ")", ";", "}" ]
Deletes a specific PhysicalNetworkFunctionRecord. @param idNsr the ID of the NetworkFunctionRecord containing the PhysicalNetworkFunctionRecord @param idPnfr the ID of the PhysicalNetworkFunctionRecord to delete @throws SDKException if the request fails
[ "Deletes", "a", "specific", "PhysicalNetworkFunctionRecord", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L588-L595
142,603
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.postPhysicalNetworkFunctionRecord
@Help( help = "Create the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id" ) public PhysicalNetworkFunctionRecord postPhysicalNetworkFunctionRecord( final String idNsr, final PhysicalNetworkFunctionRecord physicalNetworkFunctionRecord) throws SDKException { String url = idNsr + "/pnfrecords" + "/"; return (PhysicalNetworkFunctionRecord) requestPost(url, physicalNetworkFunctionRecord); }
java
@Help( help = "Create the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id" ) public PhysicalNetworkFunctionRecord postPhysicalNetworkFunctionRecord( final String idNsr, final PhysicalNetworkFunctionRecord physicalNetworkFunctionRecord) throws SDKException { String url = idNsr + "/pnfrecords" + "/"; return (PhysicalNetworkFunctionRecord) requestPost(url, physicalNetworkFunctionRecord); }
[ "@", "Help", "(", "help", "=", "\"Create the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id\"", ")", "public", "PhysicalNetworkFunctionRecord", "postPhysicalNetworkFunctionRecord", "(", "final", "String", "idNsr", ",", "final", "PhysicalNetworkFunctionRecord", "physicalNetworkFunctionRecord", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/pnfrecords\"", "+", "\"/\"", ";", "return", "(", "PhysicalNetworkFunctionRecord", ")", "requestPost", "(", "url", ",", "physicalNetworkFunctionRecord", ")", ";", "}" ]
Create a new PhysicalnetworkFunctionRecord and add it ot a NetworkServiceRecord. @param idNsr the ID of the NetworkServiceRecord @param physicalNetworkFunctionRecord the new PhysicalNetworkFunctionRecord @return the new PhysicalNetworkFunctionRecord @throws SDKException if the request fails
[ "Create", "a", "new", "PhysicalnetworkFunctionRecord", "and", "add", "it", "ot", "a", "NetworkServiceRecord", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L605-L613
142,604
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.updatePNFD
@Help( help = "Update the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id" ) public PhysicalNetworkFunctionRecord updatePNFD( final String idNsr, final String idPnfr, final PhysicalNetworkFunctionRecord physicalNetworkFunctionRecord) throws SDKException { String url = idNsr + "/pnfrecords" + "/" + idPnfr; return (PhysicalNetworkFunctionRecord) requestPut(url, physicalNetworkFunctionRecord); }
java
@Help( help = "Update the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id" ) public PhysicalNetworkFunctionRecord updatePNFD( final String idNsr, final String idPnfr, final PhysicalNetworkFunctionRecord physicalNetworkFunctionRecord) throws SDKException { String url = idNsr + "/pnfrecords" + "/" + idPnfr; return (PhysicalNetworkFunctionRecord) requestPut(url, physicalNetworkFunctionRecord); }
[ "@", "Help", "(", "help", "=", "\"Update the PhysicalNetworkFunctionRecord of a NetworkServiceRecord with specific id\"", ")", "public", "PhysicalNetworkFunctionRecord", "updatePNFD", "(", "final", "String", "idNsr", ",", "final", "String", "idPnfr", ",", "final", "PhysicalNetworkFunctionRecord", "physicalNetworkFunctionRecord", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/pnfrecords\"", "+", "\"/\"", "+", "idPnfr", ";", "return", "(", "PhysicalNetworkFunctionRecord", ")", "requestPut", "(", "url", ",", "physicalNetworkFunctionRecord", ")", ";", "}" ]
Updates a specific PhysicalNetworkFunctionRecord. @param idNsr the ID of the NetworkServiceRecord containing the PhysicalNetworkFunctionRecord @param idPnfr the ID of the PhysicalNetworkFunctionRecord to update @param physicalNetworkFunctionRecord the updated version of the PhysicalNetworkFunctionRecord @return the updated PhysicalNetworkFunctionRecord @throws SDKException if the request fails
[ "Updates", "a", "specific", "PhysicalNetworkFunctionRecord", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L624-L634
142,605
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.restartVnfr
@Help(help = "Scales out/add a VNF to a running NetworkServiceRecord with specific id") public void restartVnfr(final String idNsr, final String idVnfr, String imageName) throws SDKException { HashMap<String, Serializable> jsonBody = new HashMap<>(); jsonBody.put("imageName", imageName); String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/restart"; requestPost(url, jsonBody); }
java
@Help(help = "Scales out/add a VNF to a running NetworkServiceRecord with specific id") public void restartVnfr(final String idNsr, final String idVnfr, String imageName) throws SDKException { HashMap<String, Serializable> jsonBody = new HashMap<>(); jsonBody.put("imageName", imageName); String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/restart"; requestPost(url, jsonBody); }
[ "@", "Help", "(", "help", "=", "\"Scales out/add a VNF to a running NetworkServiceRecord with specific id\"", ")", "public", "void", "restartVnfr", "(", "final", "String", "idNsr", ",", "final", "String", "idVnfr", ",", "String", "imageName", ")", "throws", "SDKException", "{", "HashMap", "<", "String", ",", "Serializable", ">", "jsonBody", "=", "new", "HashMap", "<>", "(", ")", ";", "jsonBody", ".", "put", "(", "\"imageName\"", ",", "imageName", ")", ";", "String", "url", "=", "idNsr", "+", "\"/vnfrecords\"", "+", "\"/\"", "+", "idVnfr", "+", "\"/restart\"", ";", "requestPost", "(", "url", ",", "jsonBody", ")", ";", "}" ]
Restarts a VNFR in a running NSR. @param idNsr the ID of the NetworkServiceRecord @param idVnfr the ID of the VNFR to restart @param imageName rebuilding the VNFR with a different image if defined @throws SDKException if the request fails
[ "Restarts", "a", "VNFR", "in", "a", "running", "NSR", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L674-L681
142,606
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.upgradeVnfr
@Help(help = "Upgrades a VNFR to a defined VNFD in a running NSR with specific id") public void upgradeVnfr(final String idNsr, final String idVnfr, final String idVnfd) throws SDKException { HashMap<String, Serializable> jsonBody = new HashMap<>(); jsonBody.put("vnfdId", idVnfd); String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/upgrade"; requestPost(url, jsonBody); }
java
@Help(help = "Upgrades a VNFR to a defined VNFD in a running NSR with specific id") public void upgradeVnfr(final String idNsr, final String idVnfr, final String idVnfd) throws SDKException { HashMap<String, Serializable> jsonBody = new HashMap<>(); jsonBody.put("vnfdId", idVnfd); String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/upgrade"; requestPost(url, jsonBody); }
[ "@", "Help", "(", "help", "=", "\"Upgrades a VNFR to a defined VNFD in a running NSR with specific id\"", ")", "public", "void", "upgradeVnfr", "(", "final", "String", "idNsr", ",", "final", "String", "idVnfr", ",", "final", "String", "idVnfd", ")", "throws", "SDKException", "{", "HashMap", "<", "String", ",", "Serializable", ">", "jsonBody", "=", "new", "HashMap", "<>", "(", ")", ";", "jsonBody", ".", "put", "(", "\"vnfdId\"", ",", "idVnfd", ")", ";", "String", "url", "=", "idNsr", "+", "\"/vnfrecords\"", "+", "\"/\"", "+", "idVnfr", "+", "\"/upgrade\"", ";", "requestPost", "(", "url", ",", "jsonBody", ")", ";", "}" ]
Upgrades a VNFR of a defined VNFD in a running NSR. @param idNsr the ID of the NetworkServiceRecord @param idVnfr the ID of the VNFR to be upgraded @param idVnfd the VNFD ID to which the VNFR shall be upgraded @throws SDKException if the request fails
[ "Upgrades", "a", "VNFR", "of", "a", "defined", "VNFD", "in", "a", "running", "NSR", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L691-L698
142,607
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.updateVnfr
@Help(help = "Updates a VNFR to a defined VNFD in a running NSR with specific id") public void updateVnfr(final String idNsr, final String idVnfr) throws SDKException { String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/update"; requestPost(url); }
java
@Help(help = "Updates a VNFR to a defined VNFD in a running NSR with specific id") public void updateVnfr(final String idNsr, final String idVnfr) throws SDKException { String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/update"; requestPost(url); }
[ "@", "Help", "(", "help", "=", "\"Updates a VNFR to a defined VNFD in a running NSR with specific id\"", ")", "public", "void", "updateVnfr", "(", "final", "String", "idNsr", ",", "final", "String", "idVnfr", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/vnfrecords\"", "+", "\"/\"", "+", "idVnfr", "+", "\"/update\"", ";", "requestPost", "(", "url", ")", ";", "}" ]
Updates a VNFR of a defined VNFD in a running NSR. @param idNsr the ID of the NetworkServiceRecord @param idVnfr the ID of the VNFR to be upgraded @throws SDKException if the request fails
[ "Updates", "a", "VNFR", "of", "a", "defined", "VNFD", "in", "a", "running", "NSR", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L707-L711
142,608
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.executeScript
@Help( help = "Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id" ) public void executeScript(final String idNsr, final String idVnfr, String script) throws SDKException { String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script"; requestPost(url, script); }
java
@Help( help = "Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id" ) public void executeScript(final String idNsr, final String idVnfr, String script) throws SDKException { String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script"; requestPost(url, script); }
[ "@", "Help", "(", "help", "=", "\"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id\"", ")", "public", "void", "executeScript", "(", "final", "String", "idNsr", ",", "final", "String", "idVnfr", ",", "String", "script", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/vnfrecords\"", "+", "\"/\"", "+", "idVnfr", "+", "\"/execute-script\"", ";", "requestPost", "(", "url", ",", "script", ")", ";", "}" ]
Executes a script at runtime for a VNFR of a defined VNFD in a running NSR. @param idNsr the ID of the NetworkServiceRecord @param idVnfr the ID of the VNFR to be upgraded @param script the script to execute @throws SDKException if the request fails
[ "Executes", "a", "script", "at", "runtime", "for", "a", "VNFR", "of", "a", "defined", "VNFD", "in", "a", "running", "NSR", "." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L721-L729
142,609
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java
NetworkServiceRecordAgent.resume
@Help( help = "Resumes a NSR that failed while executing a script in a VNFR. The id in the URL specifies the Network Service Record that will be resumed." ) public void resume(final String idNsr) throws SDKException { String url = idNsr + "/resume"; requestPost(url); }
java
@Help( help = "Resumes a NSR that failed while executing a script in a VNFR. The id in the URL specifies the Network Service Record that will be resumed." ) public void resume(final String idNsr) throws SDKException { String url = idNsr + "/resume"; requestPost(url); }
[ "@", "Help", "(", "help", "=", "\"Resumes a NSR that failed while executing a script in a VNFR. The id in the URL specifies the Network Service Record that will be resumed.\"", ")", "public", "void", "resume", "(", "final", "String", "idNsr", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsr", "+", "\"/resume\"", ";", "requestPost", "(", "url", ")", ";", "}" ]
Resumes a NSR that failed while executing a script in a VNFR. The id in the URL specifies the Network Service Record that will be resumed.. @param idNsr the ID of the NetworkServiceRecord @throws SDKException if the request fails
[ "Resumes", "a", "NSR", "that", "failed", "while", "executing", "a", "script", "in", "a", "VNFR", ".", "The", "id", "in", "the", "URL", "specifies", "the", "Network", "Service", "Record", "that", "will", "be", "resumed", ".." ]
6ca6dd6b62a23940d312213d6fa489d5b636061a
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L738-L745
142,610
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/TokenParser.java
TokenParser.parse
public static Token[] parse(String text, boolean optimize) { if (text == null) { return null; } if (text.length() == 0) { Token t = new Token(text); return new Token[] { t }; } Token[] tokens = null; List<Token> tokenList = Tokenizer.tokenize(text, optimize); if (!tokenList.isEmpty()) { tokens = tokenList.toArray(new Token[0]); if (optimize) { tokens = Tokenizer.optimize(tokens); } } return tokens; }
java
public static Token[] parse(String text, boolean optimize) { if (text == null) { return null; } if (text.length() == 0) { Token t = new Token(text); return new Token[] { t }; } Token[] tokens = null; List<Token> tokenList = Tokenizer.tokenize(text, optimize); if (!tokenList.isEmpty()) { tokens = tokenList.toArray(new Token[0]); if (optimize) { tokens = Tokenizer.optimize(tokens); } } return tokens; }
[ "public", "static", "Token", "[", "]", "parse", "(", "String", "text", ",", "boolean", "optimize", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "text", ".", "length", "(", ")", "==", "0", ")", "{", "Token", "t", "=", "new", "Token", "(", "text", ")", ";", "return", "new", "Token", "[", "]", "{", "t", "}", ";", "}", "Token", "[", "]", "tokens", "=", "null", ";", "List", "<", "Token", ">", "tokenList", "=", "Tokenizer", ".", "tokenize", "(", "text", ",", "optimize", ")", ";", "if", "(", "!", "tokenList", ".", "isEmpty", "(", ")", ")", "{", "tokens", "=", "tokenList", ".", "toArray", "(", "new", "Token", "[", "0", "]", ")", ";", "if", "(", "optimize", ")", "{", "tokens", "=", "Tokenizer", ".", "optimize", "(", "tokens", ")", ";", "}", "}", "return", "tokens", ";", "}" ]
Returns an array of tokens that contains tokenized string. @param text the string to parse @param optimize whether to optimize tokens @return an array of tokens
[ "Returns", "an", "array", "of", "tokens", "that", "contains", "tokenized", "string", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/TokenParser.java#L48-L65
142,611
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/TokenParser.java
TokenParser.makeTokens
public static Token[] makeTokens(String text, boolean tokenize) { if (text == null) { return null; } Token[] tokens; if (tokenize) { tokens = parse(text); } else { tokens = new Token[1]; tokens[0] = new Token(text); } return tokens; }
java
public static Token[] makeTokens(String text, boolean tokenize) { if (text == null) { return null; } Token[] tokens; if (tokenize) { tokens = parse(text); } else { tokens = new Token[1]; tokens[0] = new Token(text); } return tokens; }
[ "public", "static", "Token", "[", "]", "makeTokens", "(", "String", "text", ",", "boolean", "tokenize", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "null", ";", "}", "Token", "[", "]", "tokens", ";", "if", "(", "tokenize", ")", "{", "tokens", "=", "parse", "(", "text", ")", ";", "}", "else", "{", "tokens", "=", "new", "Token", "[", "1", "]", ";", "tokens", "[", "0", "]", "=", "new", "Token", "(", "text", ")", ";", "}", "return", "tokens", ";", "}" ]
Convert the given string into tokens. @param text the text @param tokenize whether to tokenize @return the token[]
[ "Convert", "the", "given", "string", "into", "tokens", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/TokenParser.java#L115-L127
142,612
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java
Tokenizer.tokenize
public static List<Token> tokenize(CharSequence input, boolean textTrim) { if (input == null) { throw new IllegalArgumentException("input must not be null"); } int inputLen = input.length(); if (inputLen == 0) { List<Token> tokens = new ArrayList<>(1); tokens.add(new Token("")); return tokens; } int status = AT_TEXT; int tokenStartOffset = 0; // start position of token in the stringBuffer char symbol = Token.PARAMETER_SYMBOL; // PARAMETER_SYMBOL or ATTRIBUTE_SYMBOL char c; StringBuilder nameBuf = new StringBuilder(); StringBuilder valueBuf = new StringBuilder(); StringBuilder textBuf = new StringBuilder(); List<Token> tokens = new ArrayList<>(); for (int i = 0; i < inputLen; i++) { c = input.charAt(i); switch (status) { case AT_TEXT: textBuf.append(c); if (Token.isTokenSymbol(c)) { symbol = c; status = AT_TOKEN_SYMBOL; // abc$ --> tokenStartOffset: 3 tokenStartOffset = textBuf.length() - 1; } break; case AT_TOKEN_SYMBOL: textBuf.append(c); if (c == Token.START_BRACKET) { status = AT_TOKEN_NAME; } else { if (Token.isTokenSymbol(c)) { symbol = c; status = AT_TOKEN_SYMBOL; // abc$ --> tokenStartOffset: 3 tokenStartOffset = textBuf.length() - 1; } else { status = AT_TEXT; } } break; case AT_TOKEN_NAME: case AT_TOKEN_VALUE: textBuf.append(c); if (status == AT_TOKEN_NAME) { if (c == Token.VALUE_SEPARATOR) { status = AT_TOKEN_VALUE; break; } } if (c == Token.END_BRACKET) { if (nameBuf.length() > 0 || valueBuf.length() > 0) { // save previous non-token string if (tokenStartOffset > 0) { String text = trimBuffer(textBuf, tokenStartOffset, textTrim); Token token = new Token(text); tokens.add(token); } // save token name and default value Token token = createToken(symbol, nameBuf, valueBuf); tokens.add(token); status = AT_TEXT; textBuf.setLength(0); break; } status = AT_TEXT; break; } if (status == AT_TOKEN_NAME) { if (nameBuf.length() > MAX_TOKEN_NAME_LENGTH) { status = AT_TEXT; nameBuf.setLength(0); } nameBuf.append(c); } else { valueBuf.append(c); } break; } } if (textBuf.length() > 0) { String text = trimBuffer(textBuf, textBuf.length(), textTrim); Token token = new Token(text); tokens.add(token); } return tokens; }
java
public static List<Token> tokenize(CharSequence input, boolean textTrim) { if (input == null) { throw new IllegalArgumentException("input must not be null"); } int inputLen = input.length(); if (inputLen == 0) { List<Token> tokens = new ArrayList<>(1); tokens.add(new Token("")); return tokens; } int status = AT_TEXT; int tokenStartOffset = 0; // start position of token in the stringBuffer char symbol = Token.PARAMETER_SYMBOL; // PARAMETER_SYMBOL or ATTRIBUTE_SYMBOL char c; StringBuilder nameBuf = new StringBuilder(); StringBuilder valueBuf = new StringBuilder(); StringBuilder textBuf = new StringBuilder(); List<Token> tokens = new ArrayList<>(); for (int i = 0; i < inputLen; i++) { c = input.charAt(i); switch (status) { case AT_TEXT: textBuf.append(c); if (Token.isTokenSymbol(c)) { symbol = c; status = AT_TOKEN_SYMBOL; // abc$ --> tokenStartOffset: 3 tokenStartOffset = textBuf.length() - 1; } break; case AT_TOKEN_SYMBOL: textBuf.append(c); if (c == Token.START_BRACKET) { status = AT_TOKEN_NAME; } else { if (Token.isTokenSymbol(c)) { symbol = c; status = AT_TOKEN_SYMBOL; // abc$ --> tokenStartOffset: 3 tokenStartOffset = textBuf.length() - 1; } else { status = AT_TEXT; } } break; case AT_TOKEN_NAME: case AT_TOKEN_VALUE: textBuf.append(c); if (status == AT_TOKEN_NAME) { if (c == Token.VALUE_SEPARATOR) { status = AT_TOKEN_VALUE; break; } } if (c == Token.END_BRACKET) { if (nameBuf.length() > 0 || valueBuf.length() > 0) { // save previous non-token string if (tokenStartOffset > 0) { String text = trimBuffer(textBuf, tokenStartOffset, textTrim); Token token = new Token(text); tokens.add(token); } // save token name and default value Token token = createToken(symbol, nameBuf, valueBuf); tokens.add(token); status = AT_TEXT; textBuf.setLength(0); break; } status = AT_TEXT; break; } if (status == AT_TOKEN_NAME) { if (nameBuf.length() > MAX_TOKEN_NAME_LENGTH) { status = AT_TEXT; nameBuf.setLength(0); } nameBuf.append(c); } else { valueBuf.append(c); } break; } } if (textBuf.length() > 0) { String text = trimBuffer(textBuf, textBuf.length(), textTrim); Token token = new Token(text); tokens.add(token); } return tokens; }
[ "public", "static", "List", "<", "Token", ">", "tokenize", "(", "CharSequence", "input", ",", "boolean", "textTrim", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"input must not be null\"", ")", ";", "}", "int", "inputLen", "=", "input", ".", "length", "(", ")", ";", "if", "(", "inputLen", "==", "0", ")", "{", "List", "<", "Token", ">", "tokens", "=", "new", "ArrayList", "<>", "(", "1", ")", ";", "tokens", ".", "add", "(", "new", "Token", "(", "\"\"", ")", ")", ";", "return", "tokens", ";", "}", "int", "status", "=", "AT_TEXT", ";", "int", "tokenStartOffset", "=", "0", ";", "// start position of token in the stringBuffer", "char", "symbol", "=", "Token", ".", "PARAMETER_SYMBOL", ";", "// PARAMETER_SYMBOL or ATTRIBUTE_SYMBOL", "char", "c", ";", "StringBuilder", "nameBuf", "=", "new", "StringBuilder", "(", ")", ";", "StringBuilder", "valueBuf", "=", "new", "StringBuilder", "(", ")", ";", "StringBuilder", "textBuf", "=", "new", "StringBuilder", "(", ")", ";", "List", "<", "Token", ">", "tokens", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputLen", ";", "i", "++", ")", "{", "c", "=", "input", ".", "charAt", "(", "i", ")", ";", "switch", "(", "status", ")", "{", "case", "AT_TEXT", ":", "textBuf", ".", "append", "(", "c", ")", ";", "if", "(", "Token", ".", "isTokenSymbol", "(", "c", ")", ")", "{", "symbol", "=", "c", ";", "status", "=", "AT_TOKEN_SYMBOL", ";", "// abc$ --> tokenStartOffset: 3", "tokenStartOffset", "=", "textBuf", ".", "length", "(", ")", "-", "1", ";", "}", "break", ";", "case", "AT_TOKEN_SYMBOL", ":", "textBuf", ".", "append", "(", "c", ")", ";", "if", "(", "c", "==", "Token", ".", "START_BRACKET", ")", "{", "status", "=", "AT_TOKEN_NAME", ";", "}", "else", "{", "if", "(", "Token", ".", "isTokenSymbol", "(", "c", ")", ")", "{", "symbol", "=", "c", ";", "status", "=", "AT_TOKEN_SYMBOL", ";", "// abc$ --> tokenStartOffset: 3", "tokenStartOffset", "=", "textBuf", ".", "length", "(", ")", "-", "1", ";", "}", "else", "{", "status", "=", "AT_TEXT", ";", "}", "}", "break", ";", "case", "AT_TOKEN_NAME", ":", "case", "AT_TOKEN_VALUE", ":", "textBuf", ".", "append", "(", "c", ")", ";", "if", "(", "status", "==", "AT_TOKEN_NAME", ")", "{", "if", "(", "c", "==", "Token", ".", "VALUE_SEPARATOR", ")", "{", "status", "=", "AT_TOKEN_VALUE", ";", "break", ";", "}", "}", "if", "(", "c", "==", "Token", ".", "END_BRACKET", ")", "{", "if", "(", "nameBuf", ".", "length", "(", ")", ">", "0", "||", "valueBuf", ".", "length", "(", ")", ">", "0", ")", "{", "// save previous non-token string", "if", "(", "tokenStartOffset", ">", "0", ")", "{", "String", "text", "=", "trimBuffer", "(", "textBuf", ",", "tokenStartOffset", ",", "textTrim", ")", ";", "Token", "token", "=", "new", "Token", "(", "text", ")", ";", "tokens", ".", "add", "(", "token", ")", ";", "}", "// save token name and default value", "Token", "token", "=", "createToken", "(", "symbol", ",", "nameBuf", ",", "valueBuf", ")", ";", "tokens", ".", "add", "(", "token", ")", ";", "status", "=", "AT_TEXT", ";", "textBuf", ".", "setLength", "(", "0", ")", ";", "break", ";", "}", "status", "=", "AT_TEXT", ";", "break", ";", "}", "if", "(", "status", "==", "AT_TOKEN_NAME", ")", "{", "if", "(", "nameBuf", ".", "length", "(", ")", ">", "MAX_TOKEN_NAME_LENGTH", ")", "{", "status", "=", "AT_TEXT", ";", "nameBuf", ".", "setLength", "(", "0", ")", ";", "}", "nameBuf", ".", "append", "(", "c", ")", ";", "}", "else", "{", "valueBuf", ".", "append", "(", "c", ")", ";", "}", "break", ";", "}", "}", "if", "(", "textBuf", ".", "length", "(", ")", ">", "0", ")", "{", "String", "text", "=", "trimBuffer", "(", "textBuf", ",", "textBuf", ".", "length", "(", ")", ",", "textTrim", ")", ";", "Token", "token", "=", "new", "Token", "(", "text", ")", ";", "tokens", ".", "add", "(", "token", ")", ";", "}", "return", "tokens", ";", "}" ]
Returns a list of tokens that contains tokenized string. @param input the string to tokenize @param textTrim whether to trim text @return a list of tokens
[ "Returns", "a", "list", "of", "tokens", "that", "contains", "tokenized", "string", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java#L53-L154
142,613
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java
Tokenizer.createToken
private static Token createToken(char symbol, StringBuilder nameBuf, StringBuilder valueBuf) { String value = null; if (valueBuf.length() > 0) { value = valueBuf.toString(); valueBuf.setLength(0); // empty the value buffer } if (nameBuf.length() > 0) { TokenType type = Token.resolveTypeAsSymbol(symbol); String name = nameBuf.toString(); nameBuf.setLength(0); // empty the name buffer int offset = name.indexOf(Token.GETTER_SEPARATOR); if (offset > -1) { String name2 = name.substring(0, offset); String getter = name.substring(offset + 1); Token token = new Token(type, name2); if (!getter.isEmpty()) { token.setGetterName(getter); } token.setDefaultValue(value); return token; } else if (value != null) { TokenDirectiveType directiveType = TokenDirectiveType.resolve(name); if (directiveType != null) { String getter = null; String defaultValue = null; offset = value.indexOf(Token.GETTER_SEPARATOR); if (offset > -1) { String value2 = value.substring(0, offset); String getter2 = value.substring(offset + 1); value = value2; offset = getter2.indexOf(Token.VALUE_SEPARATOR); if (offset > -1) { String getter3 = getter2.substring(0, offset); String value3 = getter2.substring(offset + 1); if (!getter3.isEmpty()) { getter = getter3; } if (!value3.isEmpty()) { defaultValue = value3; } } else { if (!getter2.isEmpty()) { getter = getter2; } } } Token token = new Token(type, directiveType, value); token.setGetterName(getter); token.setDefaultValue(defaultValue); return token; } else { Token token = new Token(type, name); token.setDefaultValue(value); return token; } } else { return new Token(type, name); } } else { // when not exists tokenName then tokenType must be TEXT type return new Token(value); } }
java
private static Token createToken(char symbol, StringBuilder nameBuf, StringBuilder valueBuf) { String value = null; if (valueBuf.length() > 0) { value = valueBuf.toString(); valueBuf.setLength(0); // empty the value buffer } if (nameBuf.length() > 0) { TokenType type = Token.resolveTypeAsSymbol(symbol); String name = nameBuf.toString(); nameBuf.setLength(0); // empty the name buffer int offset = name.indexOf(Token.GETTER_SEPARATOR); if (offset > -1) { String name2 = name.substring(0, offset); String getter = name.substring(offset + 1); Token token = new Token(type, name2); if (!getter.isEmpty()) { token.setGetterName(getter); } token.setDefaultValue(value); return token; } else if (value != null) { TokenDirectiveType directiveType = TokenDirectiveType.resolve(name); if (directiveType != null) { String getter = null; String defaultValue = null; offset = value.indexOf(Token.GETTER_SEPARATOR); if (offset > -1) { String value2 = value.substring(0, offset); String getter2 = value.substring(offset + 1); value = value2; offset = getter2.indexOf(Token.VALUE_SEPARATOR); if (offset > -1) { String getter3 = getter2.substring(0, offset); String value3 = getter2.substring(offset + 1); if (!getter3.isEmpty()) { getter = getter3; } if (!value3.isEmpty()) { defaultValue = value3; } } else { if (!getter2.isEmpty()) { getter = getter2; } } } Token token = new Token(type, directiveType, value); token.setGetterName(getter); token.setDefaultValue(defaultValue); return token; } else { Token token = new Token(type, name); token.setDefaultValue(value); return token; } } else { return new Token(type, name); } } else { // when not exists tokenName then tokenType must be TEXT type return new Token(value); } }
[ "private", "static", "Token", "createToken", "(", "char", "symbol", ",", "StringBuilder", "nameBuf", ",", "StringBuilder", "valueBuf", ")", "{", "String", "value", "=", "null", ";", "if", "(", "valueBuf", ".", "length", "(", ")", ">", "0", ")", "{", "value", "=", "valueBuf", ".", "toString", "(", ")", ";", "valueBuf", ".", "setLength", "(", "0", ")", ";", "// empty the value buffer", "}", "if", "(", "nameBuf", ".", "length", "(", ")", ">", "0", ")", "{", "TokenType", "type", "=", "Token", ".", "resolveTypeAsSymbol", "(", "symbol", ")", ";", "String", "name", "=", "nameBuf", ".", "toString", "(", ")", ";", "nameBuf", ".", "setLength", "(", "0", ")", ";", "// empty the name buffer", "int", "offset", "=", "name", ".", "indexOf", "(", "Token", ".", "GETTER_SEPARATOR", ")", ";", "if", "(", "offset", ">", "-", "1", ")", "{", "String", "name2", "=", "name", ".", "substring", "(", "0", ",", "offset", ")", ";", "String", "getter", "=", "name", ".", "substring", "(", "offset", "+", "1", ")", ";", "Token", "token", "=", "new", "Token", "(", "type", ",", "name2", ")", ";", "if", "(", "!", "getter", ".", "isEmpty", "(", ")", ")", "{", "token", ".", "setGetterName", "(", "getter", ")", ";", "}", "token", ".", "setDefaultValue", "(", "value", ")", ";", "return", "token", ";", "}", "else", "if", "(", "value", "!=", "null", ")", "{", "TokenDirectiveType", "directiveType", "=", "TokenDirectiveType", ".", "resolve", "(", "name", ")", ";", "if", "(", "directiveType", "!=", "null", ")", "{", "String", "getter", "=", "null", ";", "String", "defaultValue", "=", "null", ";", "offset", "=", "value", ".", "indexOf", "(", "Token", ".", "GETTER_SEPARATOR", ")", ";", "if", "(", "offset", ">", "-", "1", ")", "{", "String", "value2", "=", "value", ".", "substring", "(", "0", ",", "offset", ")", ";", "String", "getter2", "=", "value", ".", "substring", "(", "offset", "+", "1", ")", ";", "value", "=", "value2", ";", "offset", "=", "getter2", ".", "indexOf", "(", "Token", ".", "VALUE_SEPARATOR", ")", ";", "if", "(", "offset", ">", "-", "1", ")", "{", "String", "getter3", "=", "getter2", ".", "substring", "(", "0", ",", "offset", ")", ";", "String", "value3", "=", "getter2", ".", "substring", "(", "offset", "+", "1", ")", ";", "if", "(", "!", "getter3", ".", "isEmpty", "(", ")", ")", "{", "getter", "=", "getter3", ";", "}", "if", "(", "!", "value3", ".", "isEmpty", "(", ")", ")", "{", "defaultValue", "=", "value3", ";", "}", "}", "else", "{", "if", "(", "!", "getter2", ".", "isEmpty", "(", ")", ")", "{", "getter", "=", "getter2", ";", "}", "}", "}", "Token", "token", "=", "new", "Token", "(", "type", ",", "directiveType", ",", "value", ")", ";", "token", ".", "setGetterName", "(", "getter", ")", ";", "token", ".", "setDefaultValue", "(", "defaultValue", ")", ";", "return", "token", ";", "}", "else", "{", "Token", "token", "=", "new", "Token", "(", "type", ",", "name", ")", ";", "token", ".", "setDefaultValue", "(", "value", ")", ";", "return", "token", ";", "}", "}", "else", "{", "return", "new", "Token", "(", "type", ",", "name", ")", ";", "}", "}", "else", "{", "// when not exists tokenName then tokenType must be TEXT type", "return", "new", "Token", "(", "value", ")", ";", "}", "}" ]
Create a token. @param symbol the token symbol @param nameBuf the name buffer @param valueBuf the value buffer @return the token
[ "Create", "a", "token", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java#L164-L228
142,614
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java
Tokenizer.optimize
public static Token[] optimize(Token[] tokens) { if (tokens == null) { return null; } String firstVal = null; String lastVal = null; if (tokens.length == 1) { if (tokens[0].getType() == TokenType.TEXT) { firstVal = tokens[0].getDefaultValue(); } } else if (tokens.length > 1) { if (tokens[0].getType() == TokenType.TEXT) { firstVal = tokens[0].getDefaultValue(); } if (tokens[tokens.length - 1].getType() == TokenType.TEXT) { lastVal = tokens[tokens.length - 1].getDefaultValue(); } } if (firstVal != null) { String text = trimLeadingWhitespace(firstVal); if (!Objects.equals(firstVal, text)) { tokens[0] = new Token(text); } } if (lastVal != null && !lastVal.isEmpty()) { String text = trimTrailingWhitespace(lastVal); if (!Objects.equals(lastVal, text)) { tokens[tokens.length - 1] = new Token(text); } } return tokens; }
java
public static Token[] optimize(Token[] tokens) { if (tokens == null) { return null; } String firstVal = null; String lastVal = null; if (tokens.length == 1) { if (tokens[0].getType() == TokenType.TEXT) { firstVal = tokens[0].getDefaultValue(); } } else if (tokens.length > 1) { if (tokens[0].getType() == TokenType.TEXT) { firstVal = tokens[0].getDefaultValue(); } if (tokens[tokens.length - 1].getType() == TokenType.TEXT) { lastVal = tokens[tokens.length - 1].getDefaultValue(); } } if (firstVal != null) { String text = trimLeadingWhitespace(firstVal); if (!Objects.equals(firstVal, text)) { tokens[0] = new Token(text); } } if (lastVal != null && !lastVal.isEmpty()) { String text = trimTrailingWhitespace(lastVal); if (!Objects.equals(lastVal, text)) { tokens[tokens.length - 1] = new Token(text); } } return tokens; }
[ "public", "static", "Token", "[", "]", "optimize", "(", "Token", "[", "]", "tokens", ")", "{", "if", "(", "tokens", "==", "null", ")", "{", "return", "null", ";", "}", "String", "firstVal", "=", "null", ";", "String", "lastVal", "=", "null", ";", "if", "(", "tokens", ".", "length", "==", "1", ")", "{", "if", "(", "tokens", "[", "0", "]", ".", "getType", "(", ")", "==", "TokenType", ".", "TEXT", ")", "{", "firstVal", "=", "tokens", "[", "0", "]", ".", "getDefaultValue", "(", ")", ";", "}", "}", "else", "if", "(", "tokens", ".", "length", ">", "1", ")", "{", "if", "(", "tokens", "[", "0", "]", ".", "getType", "(", ")", "==", "TokenType", ".", "TEXT", ")", "{", "firstVal", "=", "tokens", "[", "0", "]", ".", "getDefaultValue", "(", ")", ";", "}", "if", "(", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ".", "getType", "(", ")", "==", "TokenType", ".", "TEXT", ")", "{", "lastVal", "=", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ".", "getDefaultValue", "(", ")", ";", "}", "}", "if", "(", "firstVal", "!=", "null", ")", "{", "String", "text", "=", "trimLeadingWhitespace", "(", "firstVal", ")", ";", "if", "(", "!", "Objects", ".", "equals", "(", "firstVal", ",", "text", ")", ")", "{", "tokens", "[", "0", "]", "=", "new", "Token", "(", "text", ")", ";", "}", "}", "if", "(", "lastVal", "!=", "null", "&&", "!", "lastVal", ".", "isEmpty", "(", ")", ")", "{", "String", "text", "=", "trimTrailingWhitespace", "(", "lastVal", ")", ";", "if", "(", "!", "Objects", ".", "equals", "(", "lastVal", ",", "text", ")", ")", "{", "tokens", "[", "tokens", ".", "length", "-", "1", "]", "=", "new", "Token", "(", "text", ")", ";", "}", "}", "return", "tokens", ";", "}" ]
Returns an array of tokens that is optimized. Eliminates unnecessary white spaces for the first and last tokens. @param tokens the tokens before optimizing @return the optimized tokens
[ "Returns", "an", "array", "of", "tokens", "that", "is", "optimized", ".", "Eliminates", "unnecessary", "white", "spaces", "for", "the", "first", "and", "last", "tokens", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java#L300-L336
142,615
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java
Tokenizer.trimLeadingWhitespace
private static String trimLeadingWhitespace(String string) { if (string.isEmpty()) { return string; } int start = 0; char c; for (int i = 0; i < string.length(); i++) { c = string.charAt(i); if (!Character.isWhitespace(c)) { start = i; break; } } if (start == 0) { return string; } return string.substring(start); }
java
private static String trimLeadingWhitespace(String string) { if (string.isEmpty()) { return string; } int start = 0; char c; for (int i = 0; i < string.length(); i++) { c = string.charAt(i); if (!Character.isWhitespace(c)) { start = i; break; } } if (start == 0) { return string; } return string.substring(start); }
[ "private", "static", "String", "trimLeadingWhitespace", "(", "String", "string", ")", "{", "if", "(", "string", ".", "isEmpty", "(", ")", ")", "{", "return", "string", ";", "}", "int", "start", "=", "0", ";", "char", "c", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "i", "++", ")", "{", "c", "=", "string", ".", "charAt", "(", "i", ")", ";", "if", "(", "!", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "start", "=", "i", ";", "break", ";", "}", "}", "if", "(", "start", "==", "0", ")", "{", "return", "string", ";", "}", "return", "string", ".", "substring", "(", "start", ")", ";", "}" ]
Returns a string that contains a copy of a specified string without leading whitespaces. @param string the string to trim leading whitespaces @return a string with leading whitespaces trimmed
[ "Returns", "a", "string", "that", "contains", "a", "copy", "of", "a", "specified", "string", "without", "leading", "whitespaces", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java#L345-L366
142,616
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java
Tokenizer.trimTrailingWhitespace
private static String trimTrailingWhitespace(String string) { int end = 0; char c; for (int i = string.length() - 1; i >= 0; i--) { c = string.charAt(i); if (!Character.isWhitespace(c)) { end = i; break; } } if (end == 0) { return string; } return string.substring(0, end + 1); }
java
private static String trimTrailingWhitespace(String string) { int end = 0; char c; for (int i = string.length() - 1; i >= 0; i--) { c = string.charAt(i); if (!Character.isWhitespace(c)) { end = i; break; } } if (end == 0) { return string; } return string.substring(0, end + 1); }
[ "private", "static", "String", "trimTrailingWhitespace", "(", "String", "string", ")", "{", "int", "end", "=", "0", ";", "char", "c", ";", "for", "(", "int", "i", "=", "string", ".", "length", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "c", "=", "string", ".", "charAt", "(", "i", ")", ";", "if", "(", "!", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "end", "=", "i", ";", "break", ";", "}", "}", "if", "(", "end", "==", "0", ")", "{", "return", "string", ";", "}", "return", "string", ".", "substring", "(", "0", ",", "end", "+", "1", ")", ";", "}" ]
Returns a string that contains a copy of a specified string without trailing whitespaces. @param string the string to trim trailing whitespaces @return a string with trailing whitespaces trimmed
[ "Returns", "a", "string", "that", "contains", "a", "copy", "of", "a", "specified", "string", "without", "trailing", "whitespaces", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/expr/token/Tokenizer.java#L375-L392
142,617
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranDtdResolver.java
AspectranDtdResolver.resolveEntity
@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException { if (validating) { try { InputSource source = null; if (publicId != null) { String path = doctypeMap.get(publicId.toUpperCase()); source = getInputSource(path); } if (source == null && systemId != null) { String path = doctypeMap.get(systemId.toUpperCase()); source = getInputSource(path); } return source; } catch (Exception e) { throw new SAXException(e.toString()); } } else { return new InputSource(new StringReader("")); } }
java
@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException { if (validating) { try { InputSource source = null; if (publicId != null) { String path = doctypeMap.get(publicId.toUpperCase()); source = getInputSource(path); } if (source == null && systemId != null) { String path = doctypeMap.get(systemId.toUpperCase()); source = getInputSource(path); } return source; } catch (Exception e) { throw new SAXException(e.toString()); } } else { return new InputSource(new StringReader("")); } }
[ "@", "Override", "public", "InputSource", "resolveEntity", "(", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "if", "(", "validating", ")", "{", "try", "{", "InputSource", "source", "=", "null", ";", "if", "(", "publicId", "!=", "null", ")", "{", "String", "path", "=", "doctypeMap", ".", "get", "(", "publicId", ".", "toUpperCase", "(", ")", ")", ";", "source", "=", "getInputSource", "(", "path", ")", ";", "}", "if", "(", "source", "==", "null", "&&", "systemId", "!=", "null", ")", "{", "String", "path", "=", "doctypeMap", ".", "get", "(", "systemId", ".", "toUpperCase", "(", ")", ")", ";", "source", "=", "getInputSource", "(", "path", ")", ";", "}", "return", "source", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SAXException", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "}", "else", "{", "return", "new", "InputSource", "(", "new", "StringReader", "(", "\"\"", ")", ")", ";", "}", "}" ]
Converts a public DTD into a local one. @param publicId unused but required by EntityResolver interface @param systemId the DTD that is being requested @return the InputSource for the DTD @throws SAXException if anything goes wrong
[ "Converts", "a", "public", "DTD", "into", "a", "local", "one", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranDtdResolver.java#L61-L81
142,618
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/aspect/pointcut/PointcutFactory.java
PointcutFactory.createPointcut
public static Pointcut createPointcut(PointcutRule pointcutRule) { if (pointcutRule.getPointcutType() == PointcutType.REGEXP) { return createRegexpPointcut(pointcutRule.getPointcutPatternRuleList()); } else { return createWildcardPointcut(pointcutRule.getPointcutPatternRuleList()); } }
java
public static Pointcut createPointcut(PointcutRule pointcutRule) { if (pointcutRule.getPointcutType() == PointcutType.REGEXP) { return createRegexpPointcut(pointcutRule.getPointcutPatternRuleList()); } else { return createWildcardPointcut(pointcutRule.getPointcutPatternRuleList()); } }
[ "public", "static", "Pointcut", "createPointcut", "(", "PointcutRule", "pointcutRule", ")", "{", "if", "(", "pointcutRule", ".", "getPointcutType", "(", ")", "==", "PointcutType", ".", "REGEXP", ")", "{", "return", "createRegexpPointcut", "(", "pointcutRule", ".", "getPointcutPatternRuleList", "(", ")", ")", ";", "}", "else", "{", "return", "createWildcardPointcut", "(", "pointcutRule", ".", "getPointcutPatternRuleList", "(", ")", ")", ";", "}", "}" ]
Creates a new Pointcut instance. @param pointcutRule the pointcut rule @return the pointcut
[ "Creates", "a", "new", "Pointcut", "instance", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/aspect/pointcut/PointcutFactory.java#L35-L41
142,619
aspectran/aspectran
with-freemarker/src/main/java/com/aspectran/freemarker/directive/AbstractTrimDirectiveModel.java
AbstractTrimDirectiveModel.parseStringParameter
@SuppressWarnings("rawtypes") protected String parseStringParameter(Map params, String paramName) { Object paramModel = params.get(paramName); if (paramModel == null) { return null; } if (!(paramModel instanceof SimpleScalar)) { throw new IllegalArgumentException(paramName + " must be string"); } return ((SimpleScalar)paramModel).getAsString(); }
java
@SuppressWarnings("rawtypes") protected String parseStringParameter(Map params, String paramName) { Object paramModel = params.get(paramName); if (paramModel == null) { return null; } if (!(paramModel instanceof SimpleScalar)) { throw new IllegalArgumentException(paramName + " must be string"); } return ((SimpleScalar)paramModel).getAsString(); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "protected", "String", "parseStringParameter", "(", "Map", "params", ",", "String", "paramName", ")", "{", "Object", "paramModel", "=", "params", ".", "get", "(", "paramName", ")", ";", "if", "(", "paramModel", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "!", "(", "paramModel", "instanceof", "SimpleScalar", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "paramName", "+", "\" must be string\"", ")", ";", "}", "return", "(", "(", "SimpleScalar", ")", "paramModel", ")", ".", "getAsString", "(", ")", ";", "}" ]
Parse string parameter. @param params the params @param paramName the param name @return the string
[ "Parse", "string", "parameter", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-freemarker/src/main/java/com/aspectran/freemarker/directive/AbstractTrimDirectiveModel.java#L77-L87
142,620
aspectran/aspectran
with-freemarker/src/main/java/com/aspectran/freemarker/directive/AbstractTrimDirectiveModel.java
AbstractTrimDirectiveModel.parseSequenceParameter
@SuppressWarnings("rawtypes") protected String[] parseSequenceParameter(Map params, String paramName) throws TemplateModelException { Object paramModel = params.get(paramName); if (paramModel == null) { return null; } if (!(paramModel instanceof SimpleSequence)) { throw new IllegalArgumentException(paramName + " must be sequence"); } List<String> list = transformSimpleSequenceAsStringList((SimpleSequence)paramModel, paramName); return list.toArray(new String[0]); }
java
@SuppressWarnings("rawtypes") protected String[] parseSequenceParameter(Map params, String paramName) throws TemplateModelException { Object paramModel = params.get(paramName); if (paramModel == null) { return null; } if (!(paramModel instanceof SimpleSequence)) { throw new IllegalArgumentException(paramName + " must be sequence"); } List<String> list = transformSimpleSequenceAsStringList((SimpleSequence)paramModel, paramName); return list.toArray(new String[0]); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "protected", "String", "[", "]", "parseSequenceParameter", "(", "Map", "params", ",", "String", "paramName", ")", "throws", "TemplateModelException", "{", "Object", "paramModel", "=", "params", ".", "get", "(", "paramName", ")", ";", "if", "(", "paramModel", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "!", "(", "paramModel", "instanceof", "SimpleSequence", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "paramName", "+", "\" must be sequence\"", ")", ";", "}", "List", "<", "String", ">", "list", "=", "transformSimpleSequenceAsStringList", "(", "(", "SimpleSequence", ")", "paramModel", ",", "paramName", ")", ";", "return", "list", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ";", "}" ]
Parse sequence parameter. @param params the params @param paramName the param name @return the string [ ] @throws TemplateModelException the template model exception
[ "Parse", "sequence", "parameter", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-freemarker/src/main/java/com/aspectran/freemarker/directive/AbstractTrimDirectiveModel.java#L97-L108
142,621
aspectran/aspectran
with-freemarker/src/main/java/com/aspectran/freemarker/directive/AbstractTrimDirectiveModel.java
AbstractTrimDirectiveModel.transformSimpleSequenceAsStringList
private List<String> transformSimpleSequenceAsStringList(SimpleSequence sequence, String paramName) throws TemplateModelException { List<String> list = new ArrayList<>(); int size = sequence.size(); for (int i = 0; i < size; i++) { TemplateModel model = sequence.get(i); if (!(model instanceof SimpleScalar)) { throw new IllegalArgumentException(paramName + "'s item must be string"); } list.add(((SimpleScalar)model).getAsString()); } return list; }
java
private List<String> transformSimpleSequenceAsStringList(SimpleSequence sequence, String paramName) throws TemplateModelException { List<String> list = new ArrayList<>(); int size = sequence.size(); for (int i = 0; i < size; i++) { TemplateModel model = sequence.get(i); if (!(model instanceof SimpleScalar)) { throw new IllegalArgumentException(paramName + "'s item must be string"); } list.add(((SimpleScalar)model).getAsString()); } return list; }
[ "private", "List", "<", "String", ">", "transformSimpleSequenceAsStringList", "(", "SimpleSequence", "sequence", ",", "String", "paramName", ")", "throws", "TemplateModelException", "{", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "size", "=", "sequence", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "TemplateModel", "model", "=", "sequence", ".", "get", "(", "i", ")", ";", "if", "(", "!", "(", "model", "instanceof", "SimpleScalar", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "paramName", "+", "\"'s item must be string\"", ")", ";", "}", "list", ".", "add", "(", "(", "(", "SimpleScalar", ")", "model", ")", ".", "getAsString", "(", ")", ")", ";", "}", "return", "list", ";", "}" ]
Transform simple sequence as string list. @param sequence the sequence @param paramName the param name @return the list @throws TemplateModelException the template model exception
[ "Transform", "simple", "sequence", "as", "string", "list", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/with-freemarker/src/main/java/com/aspectran/freemarker/directive/AbstractTrimDirectiveModel.java#L118-L130
142,622
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/EchoActionRule.java
EchoActionRule.newAttributeItemRule
public ItemRule newAttributeItemRule(String attributeName) { ItemRule itemRule = new ItemRule(); itemRule.setName(attributeName); addAttributeItemRule(itemRule); return itemRule; }
java
public ItemRule newAttributeItemRule(String attributeName) { ItemRule itemRule = new ItemRule(); itemRule.setName(attributeName); addAttributeItemRule(itemRule); return itemRule; }
[ "public", "ItemRule", "newAttributeItemRule", "(", "String", "attributeName", ")", "{", "ItemRule", "itemRule", "=", "new", "ItemRule", "(", ")", ";", "itemRule", ".", "setName", "(", "attributeName", ")", ";", "addAttributeItemRule", "(", "itemRule", ")", ";", "return", "itemRule", ";", "}" ]
Adds a new attribute rule with the specified name and returns it. @param attributeName the attribute name @return the attribute item rule
[ "Adds", "a", "new", "attribute", "rule", "with", "the", "specified", "name", "and", "returns", "it", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/EchoActionRule.java#L76-L81
142,623
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/EchoActionRule.java
EchoActionRule.newInstance
public static EchoActionRule newInstance(String id, Boolean hidden) { EchoActionRule echoActionRule = new EchoActionRule(); echoActionRule.setActionId(id); echoActionRule.setHidden(hidden); return echoActionRule; }
java
public static EchoActionRule newInstance(String id, Boolean hidden) { EchoActionRule echoActionRule = new EchoActionRule(); echoActionRule.setActionId(id); echoActionRule.setHidden(hidden); return echoActionRule; }
[ "public", "static", "EchoActionRule", "newInstance", "(", "String", "id", ",", "Boolean", "hidden", ")", "{", "EchoActionRule", "echoActionRule", "=", "new", "EchoActionRule", "(", ")", ";", "echoActionRule", ".", "setActionId", "(", "id", ")", ";", "echoActionRule", ".", "setHidden", "(", "hidden", ")", ";", "return", "echoActionRule", ";", "}" ]
Returns a new derived instance of EchoActionRule. @param id the action id @param hidden whether to hide result of the action @return the echo action rule
[ "Returns", "a", "new", "derived", "instance", "of", "EchoActionRule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/EchoActionRule.java#L140-L145
142,624
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/EnvironmentRule.java
EnvironmentRule.newInstance
public static EnvironmentRule newInstance(String profile) { EnvironmentRule environmentRule = new EnvironmentRule(); environmentRule.setProfile(profile); return environmentRule; }
java
public static EnvironmentRule newInstance(String profile) { EnvironmentRule environmentRule = new EnvironmentRule(); environmentRule.setProfile(profile); return environmentRule; }
[ "public", "static", "EnvironmentRule", "newInstance", "(", "String", "profile", ")", "{", "EnvironmentRule", "environmentRule", "=", "new", "EnvironmentRule", "(", ")", ";", "environmentRule", ".", "setProfile", "(", "profile", ")", ";", "return", "environmentRule", ";", "}" ]
Returns a new instance of EnvironmentRule. @param profile the profile @return an instance of EnvironmentRule
[ "Returns", "a", "new", "instance", "of", "EnvironmentRule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/EnvironmentRule.java#L71-L75
142,625
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java
DispatchRule.getName
public String getName(Activity activity) { if (nameTokens != null && nameTokens.length > 0) { TokenEvaluator evaluator = new TokenExpression(activity); return evaluator.evaluateAsString(nameTokens); } else { return name; } }
java
public String getName(Activity activity) { if (nameTokens != null && nameTokens.length > 0) { TokenEvaluator evaluator = new TokenExpression(activity); return evaluator.evaluateAsString(nameTokens); } else { return name; } }
[ "public", "String", "getName", "(", "Activity", "activity", ")", "{", "if", "(", "nameTokens", "!=", "null", "&&", "nameTokens", ".", "length", ">", "0", ")", "{", "TokenEvaluator", "evaluator", "=", "new", "TokenExpression", "(", "activity", ")", ";", "return", "evaluator", ".", "evaluateAsString", "(", "nameTokens", ")", ";", "}", "else", "{", "return", "name", ";", "}", "}" ]
Gets the dispatch name. @param activity the activity @return the dispatch name
[ "Gets", "the", "dispatch", "name", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java#L67-L74
142,626
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java
DispatchRule.setName
public void setName(String name) { this.name = name; List<Token> tokens = Tokenizer.tokenize(name, true); int tokenCount = 0; for (Token t : tokens) { if (t.getType() != TokenType.TEXT) { tokenCount++; } } if (tokenCount > 0) { this.nameTokens = tokens.toArray(new Token[0]); } else { this.nameTokens = null; } }
java
public void setName(String name) { this.name = name; List<Token> tokens = Tokenizer.tokenize(name, true); int tokenCount = 0; for (Token t : tokens) { if (t.getType() != TokenType.TEXT) { tokenCount++; } } if (tokenCount > 0) { this.nameTokens = tokens.toArray(new Token[0]); } else { this.nameTokens = null; } }
[ "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "List", "<", "Token", ">", "tokens", "=", "Tokenizer", ".", "tokenize", "(", "name", ",", "true", ")", ";", "int", "tokenCount", "=", "0", ";", "for", "(", "Token", "t", ":", "tokens", ")", "{", "if", "(", "t", ".", "getType", "(", ")", "!=", "TokenType", ".", "TEXT", ")", "{", "tokenCount", "++", ";", "}", "}", "if", "(", "tokenCount", ">", "0", ")", "{", "this", ".", "nameTokens", "=", "tokens", ".", "toArray", "(", "new", "Token", "[", "0", "]", ")", ";", "}", "else", "{", "this", ".", "nameTokens", "=", "null", ";", "}", "}" ]
Sets the dispatch name. @param name the new dispatch name
[ "Sets", "the", "dispatch", "name", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java#L81-L98
142,627
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java
DispatchRule.replicate
public static DispatchRule replicate(DispatchRule dispatchRule) { DispatchRule dr = new DispatchRule(); dr.setName(dispatchRule.getName(), dispatchRule.getNameTokens()); dr.setContentType(dispatchRule.getContentType()); dr.setEncoding(dispatchRule.getEncoding()); dr.setDefaultResponse(dispatchRule.getDefaultResponse()); dr.setActionList(dispatchRule.getActionList()); return dr; }
java
public static DispatchRule replicate(DispatchRule dispatchRule) { DispatchRule dr = new DispatchRule(); dr.setName(dispatchRule.getName(), dispatchRule.getNameTokens()); dr.setContentType(dispatchRule.getContentType()); dr.setEncoding(dispatchRule.getEncoding()); dr.setDefaultResponse(dispatchRule.getDefaultResponse()); dr.setActionList(dispatchRule.getActionList()); return dr; }
[ "public", "static", "DispatchRule", "replicate", "(", "DispatchRule", "dispatchRule", ")", "{", "DispatchRule", "dr", "=", "new", "DispatchRule", "(", ")", ";", "dr", ".", "setName", "(", "dispatchRule", ".", "getName", "(", ")", ",", "dispatchRule", ".", "getNameTokens", "(", ")", ")", ";", "dr", ".", "setContentType", "(", "dispatchRule", ".", "getContentType", "(", ")", ")", ";", "dr", ".", "setEncoding", "(", "dispatchRule", ".", "getEncoding", "(", ")", ")", ";", "dr", ".", "setDefaultResponse", "(", "dispatchRule", ".", "getDefaultResponse", "(", ")", ")", ";", "dr", ".", "setActionList", "(", "dispatchRule", ".", "getActionList", "(", ")", ")", ";", "return", "dr", ";", "}" ]
Returns a new derived instance of DispatchRule. @param dispatchRule an instance of DispatchRule @return the dispatch rule
[ "Returns", "a", "new", "derived", "instance", "of", "DispatchRule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java#L269-L277
142,628
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java
AbstractSessionHandler.newSession
@Override public Session newSession(String id) { long created = System.currentTimeMillis(); Session session = sessionCache.newSession(id, created, (defaultMaxIdleSecs > 0 ? defaultMaxIdleSecs * 1000L : -1)); try { sessionCache.put(id, session); sessionsCreatedStats.increment(); for (SessionListener listener : sessionListeners) { listener.sessionCreated(session); } return session; } catch (Exception e) { log.warn("Failed to create a new session", e); return null; } }
java
@Override public Session newSession(String id) { long created = System.currentTimeMillis(); Session session = sessionCache.newSession(id, created, (defaultMaxIdleSecs > 0 ? defaultMaxIdleSecs * 1000L : -1)); try { sessionCache.put(id, session); sessionsCreatedStats.increment(); for (SessionListener listener : sessionListeners) { listener.sessionCreated(session); } return session; } catch (Exception e) { log.warn("Failed to create a new session", e); return null; } }
[ "@", "Override", "public", "Session", "newSession", "(", "String", "id", ")", "{", "long", "created", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Session", "session", "=", "sessionCache", ".", "newSession", "(", "id", ",", "created", ",", "(", "defaultMaxIdleSecs", ">", "0", "?", "defaultMaxIdleSecs", "*", "1000L", ":", "-", "1", ")", ")", ";", "try", "{", "sessionCache", ".", "put", "(", "id", ",", "session", ")", ";", "sessionsCreatedStats", ".", "increment", "(", ")", ";", "for", "(", "SessionListener", "listener", ":", "sessionListeners", ")", "{", "listener", ".", "sessionCreated", "(", "session", ")", ";", "}", "return", "session", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"Failed to create a new session\"", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Create an entirely new Session. @param id identity of session to create @return the new session object
[ "Create", "an", "entirely", "new", "Session", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java#L130-L147
142,629
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java
AbstractSessionHandler.removeSession
private Session removeSession(String id) { try { Session session = sessionCache.delete(id); if (session != null) { session.beginInvalidate(); for (int i = sessionListeners.size() - 1; i >= 0; i--) { sessionListeners.get(i).sessionDestroyed(session); } } return session; } catch (Exception e) { log.warn("Failed to delete session", e); return null; } }
java
private Session removeSession(String id) { try { Session session = sessionCache.delete(id); if (session != null) { session.beginInvalidate(); for (int i = sessionListeners.size() - 1; i >= 0; i--) { sessionListeners.get(i).sessionDestroyed(session); } } return session; } catch (Exception e) { log.warn("Failed to delete session", e); return null; } }
[ "private", "Session", "removeSession", "(", "String", "id", ")", "{", "try", "{", "Session", "session", "=", "sessionCache", ".", "delete", "(", "id", ")", ";", "if", "(", "session", "!=", "null", ")", "{", "session", ".", "beginInvalidate", "(", ")", ";", "for", "(", "int", "i", "=", "sessionListeners", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "sessionListeners", ".", "get", "(", "i", ")", ".", "sessionDestroyed", "(", "session", ")", ";", "}", "}", "return", "session", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"Failed to delete session\"", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Remove session from manager. @param id the session to remove @return if the session was removed
[ "Remove", "session", "from", "manager", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java#L190-L204
142,630
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java
AbstractSessionHandler.addEventListener
@Override public void addEventListener(EventListener listener) { if (listener instanceof SessionListener) { sessionListeners.add((SessionListener)listener); } if (listener instanceof SessionAttributeListener) { sessionAttributeListeners.add((SessionAttributeListener)listener); } }
java
@Override public void addEventListener(EventListener listener) { if (listener instanceof SessionListener) { sessionListeners.add((SessionListener)listener); } if (listener instanceof SessionAttributeListener) { sessionAttributeListeners.add((SessionAttributeListener)listener); } }
[ "@", "Override", "public", "void", "addEventListener", "(", "EventListener", "listener", ")", "{", "if", "(", "listener", "instanceof", "SessionListener", ")", "{", "sessionListeners", ".", "add", "(", "(", "SessionListener", ")", "listener", ")", ";", "}", "if", "(", "listener", "instanceof", "SessionAttributeListener", ")", "{", "sessionAttributeListeners", ".", "add", "(", "(", "SessionAttributeListener", ")", "listener", ")", ";", "}", "}" ]
Adds an event listener for session-related events. @param listener the session event listener @see #removeEventListener(EventListener)
[ "Adds", "an", "event", "listener", "for", "session", "-", "related", "events", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java#L218-L226
142,631
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java
AbstractSessionHandler.removeEventListener
@Override public void removeEventListener(EventListener listener) { if (listener instanceof SessionListener) { sessionListeners.remove(listener); } if (listener instanceof SessionAttributeListener) { sessionAttributeListeners.remove(listener); } }
java
@Override public void removeEventListener(EventListener listener) { if (listener instanceof SessionListener) { sessionListeners.remove(listener); } if (listener instanceof SessionAttributeListener) { sessionAttributeListeners.remove(listener); } }
[ "@", "Override", "public", "void", "removeEventListener", "(", "EventListener", "listener", ")", "{", "if", "(", "listener", "instanceof", "SessionListener", ")", "{", "sessionListeners", ".", "remove", "(", "listener", ")", ";", "}", "if", "(", "listener", "instanceof", "SessionAttributeListener", ")", "{", "sessionAttributeListeners", ".", "remove", "(", "listener", ")", ";", "}", "}" ]
Removes an event listener for for session-related events. @param listener the session event listener to remove @see #addEventListener(EventListener)
[ "Removes", "an", "event", "listener", "for", "for", "session", "-", "related", "events", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java#L234-L242
142,632
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/BeanReferenceException.java
BeanReferenceException.getMessage
private static String getMessage(Collection<Object> brokenReferences) { StringBuilder sb = new StringBuilder(); for (Object o : brokenReferences) { if (sb.length() > 0) { sb.append(", "); } sb.append(o); } return "Unable to resolve reference to bean [" + sb.toString() + "]"; }
java
private static String getMessage(Collection<Object> brokenReferences) { StringBuilder sb = new StringBuilder(); for (Object o : brokenReferences) { if (sb.length() > 0) { sb.append(", "); } sb.append(o); } return "Unable to resolve reference to bean [" + sb.toString() + "]"; }
[ "private", "static", "String", "getMessage", "(", "Collection", "<", "Object", ">", "brokenReferences", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "o", ":", "brokenReferences", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "\", \"", ")", ";", "}", "sb", ".", "append", "(", "o", ")", ";", "}", "return", "\"Unable to resolve reference to bean [\"", "+", "sb", ".", "toString", "(", ")", "+", "\"]\"", ";", "}" ]
Gets the detail message. @param brokenReferences the list of beans that can not find @return the message
[ "Gets", "the", "detail", "message", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/BeanReferenceException.java#L54-L63
142,633
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java
AspectranNodeParser.parse
public void parse(RuleAppender ruleAppender) throws Exception { InputStream inputStream = null; try { ruleAppender.setNodeTracker(parser.getNodeTracker()); inputStream = ruleAppender.getInputStream(); InputSource inputSource = new InputSource(inputStream); inputSource.setSystemId(ruleAppender.getQualifiedName()); parser.parse(inputSource); } catch (Exception e) { throw new Exception("Error parsing aspectran configuration", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { // ignore } } } }
java
public void parse(RuleAppender ruleAppender) throws Exception { InputStream inputStream = null; try { ruleAppender.setNodeTracker(parser.getNodeTracker()); inputStream = ruleAppender.getInputStream(); InputSource inputSource = new InputSource(inputStream); inputSource.setSystemId(ruleAppender.getQualifiedName()); parser.parse(inputSource); } catch (Exception e) { throw new Exception("Error parsing aspectran configuration", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { // ignore } } } }
[ "public", "void", "parse", "(", "RuleAppender", "ruleAppender", ")", "throws", "Exception", "{", "InputStream", "inputStream", "=", "null", ";", "try", "{", "ruleAppender", ".", "setNodeTracker", "(", "parser", ".", "getNodeTracker", "(", ")", ")", ";", "inputStream", "=", "ruleAppender", ".", "getInputStream", "(", ")", ";", "InputSource", "inputSource", "=", "new", "InputSource", "(", "inputStream", ")", ";", "inputSource", ".", "setSystemId", "(", "ruleAppender", ".", "getQualifiedName", "(", ")", ")", ";", "parser", ".", "parse", "(", "inputSource", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Exception", "(", "\"Error parsing aspectran configuration\"", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "inputStream", "!=", "null", ")", "{", "try", "{", "inputStream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// ignore", "}", "}", "}", "}" ]
Parses the aspectran configuration. @param ruleAppender the rule appender @throws Exception the exception
[ "Parses", "the", "aspectran", "configuration", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java#L184-L204
142,634
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java
AspectranNodeParser.addDescriptionNodelets
private void addDescriptionNodelets() { parser.setXpath("/aspectran/description"); parser.addNodelet(attrs -> { String style = attrs.get("style"); parser.pushObject(style); }); parser.addNodeEndlet(text -> { String style = parser.popObject(); if (style != null) { text = TextStyler.styling(text, style); } if (StringUtils.hasText(text)) { assistant.getAssistantLocal().setDescription(text); } }); }
java
private void addDescriptionNodelets() { parser.setXpath("/aspectran/description"); parser.addNodelet(attrs -> { String style = attrs.get("style"); parser.pushObject(style); }); parser.addNodeEndlet(text -> { String style = parser.popObject(); if (style != null) { text = TextStyler.styling(text, style); } if (StringUtils.hasText(text)) { assistant.getAssistantLocal().setDescription(text); } }); }
[ "private", "void", "addDescriptionNodelets", "(", ")", "{", "parser", ".", "setXpath", "(", "\"/aspectran/description\"", ")", ";", "parser", ".", "addNodelet", "(", "attrs", "->", "{", "String", "style", "=", "attrs", ".", "get", "(", "\"style\"", ")", ";", "parser", ".", "pushObject", "(", "style", ")", ";", "}", ")", ";", "parser", ".", "addNodeEndlet", "(", "text", "->", "{", "String", "style", "=", "parser", ".", "popObject", "(", ")", ";", "if", "(", "style", "!=", "null", ")", "{", "text", "=", "TextStyler", ".", "styling", "(", "text", ",", "style", ")", ";", "}", "if", "(", "StringUtils", ".", "hasText", "(", "text", ")", ")", "{", "assistant", ".", "getAssistantLocal", "(", ")", ".", "setDescription", "(", "text", ")", ";", "}", "}", ")", ";", "}" ]
Adds the description nodelets.
[ "Adds", "the", "description", "nodelets", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java#L209-L224
142,635
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java
AspectranNodeParser.addSettingsNodelets
private void addSettingsNodelets() { parser.setXpath("/aspectran/settings"); parser.addNodeEndlet(text -> { assistant.applySettings(); }); parser.setXpath("/aspectran/settings/setting"); parser.addNodelet(attrs -> { String name = attrs.get("name"); String value = attrs.get("value"); assistant.putSetting(name, value); parser.pushObject(name); }); parser.addNodeEndlet(text -> { String name = parser.popObject(); if (text != null) { assistant.putSetting(name, text); } }); }
java
private void addSettingsNodelets() { parser.setXpath("/aspectran/settings"); parser.addNodeEndlet(text -> { assistant.applySettings(); }); parser.setXpath("/aspectran/settings/setting"); parser.addNodelet(attrs -> { String name = attrs.get("name"); String value = attrs.get("value"); assistant.putSetting(name, value); parser.pushObject(name); }); parser.addNodeEndlet(text -> { String name = parser.popObject(); if (text != null) { assistant.putSetting(name, text); } }); }
[ "private", "void", "addSettingsNodelets", "(", ")", "{", "parser", ".", "setXpath", "(", "\"/aspectran/settings\"", ")", ";", "parser", ".", "addNodeEndlet", "(", "text", "->", "{", "assistant", ".", "applySettings", "(", ")", ";", "}", ")", ";", "parser", ".", "setXpath", "(", "\"/aspectran/settings/setting\"", ")", ";", "parser", ".", "addNodelet", "(", "attrs", "->", "{", "String", "name", "=", "attrs", ".", "get", "(", "\"name\"", ")", ";", "String", "value", "=", "attrs", ".", "get", "(", "\"value\"", ")", ";", "assistant", ".", "putSetting", "(", "name", ",", "value", ")", ";", "parser", ".", "pushObject", "(", "name", ")", ";", "}", ")", ";", "parser", ".", "addNodeEndlet", "(", "text", "->", "{", "String", "name", "=", "parser", ".", "popObject", "(", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "assistant", ".", "putSetting", "(", "name", ",", "text", ")", ";", "}", "}", ")", ";", "}" ]
Adds the settings nodelets.
[ "Adds", "the", "settings", "nodelets", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java#L229-L248
142,636
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java
AspectranNodeParser.addTypeAliasNodelets
private void addTypeAliasNodelets() { parser.setXpath("/aspectran/typeAliases"); parser.addNodeEndlet(text -> { if (StringUtils.hasLength(text)) { Parameters parameters = new VariableParameters(text); for (String alias : parameters.getParameterNameSet()) { assistant.addTypeAlias(alias, parameters.getString(alias)); } } }); parser.setXpath("/aspectran/typeAliases/typeAlias"); parser.addNodelet(attrs -> { String alias = attrs.get("alias"); String type = attrs.get("type"); assistant.addTypeAlias(alias, type); }); }
java
private void addTypeAliasNodelets() { parser.setXpath("/aspectran/typeAliases"); parser.addNodeEndlet(text -> { if (StringUtils.hasLength(text)) { Parameters parameters = new VariableParameters(text); for (String alias : parameters.getParameterNameSet()) { assistant.addTypeAlias(alias, parameters.getString(alias)); } } }); parser.setXpath("/aspectran/typeAliases/typeAlias"); parser.addNodelet(attrs -> { String alias = attrs.get("alias"); String type = attrs.get("type"); assistant.addTypeAlias(alias, type); }); }
[ "private", "void", "addTypeAliasNodelets", "(", ")", "{", "parser", ".", "setXpath", "(", "\"/aspectran/typeAliases\"", ")", ";", "parser", ".", "addNodeEndlet", "(", "text", "->", "{", "if", "(", "StringUtils", ".", "hasLength", "(", "text", ")", ")", "{", "Parameters", "parameters", "=", "new", "VariableParameters", "(", "text", ")", ";", "for", "(", "String", "alias", ":", "parameters", ".", "getParameterNameSet", "(", ")", ")", "{", "assistant", ".", "addTypeAlias", "(", "alias", ",", "parameters", ".", "getString", "(", "alias", ")", ")", ";", "}", "}", "}", ")", ";", "parser", ".", "setXpath", "(", "\"/aspectran/typeAliases/typeAlias\"", ")", ";", "parser", ".", "addNodelet", "(", "attrs", "->", "{", "String", "alias", "=", "attrs", ".", "get", "(", "\"alias\"", ")", ";", "String", "type", "=", "attrs", ".", "get", "(", "\"type\"", ")", ";", "assistant", ".", "addTypeAlias", "(", "alias", ",", "type", ")", ";", "}", ")", ";", "}" ]
Adds the type alias nodelets.
[ "Adds", "the", "type", "alias", "nodelets", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java#L253-L270
142,637
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java
AspectranNodeParser.addAppendNodelets
private void addAppendNodelets() { parser.setXpath("/aspectran/append"); parser.addNodelet(attrs -> { String file = attrs.get("file"); String resource = attrs.get("resource"); String url = attrs.get("url"); String format = attrs.get("format"); String profile = attrs.get("profile"); RuleAppendHandler appendHandler = assistant.getRuleAppendHandler(); if (appendHandler != null) { AppendRule appendRule = AppendRule.newInstance(file, resource, url, format, profile); appendHandler.pending(appendRule); } }); }
java
private void addAppendNodelets() { parser.setXpath("/aspectran/append"); parser.addNodelet(attrs -> { String file = attrs.get("file"); String resource = attrs.get("resource"); String url = attrs.get("url"); String format = attrs.get("format"); String profile = attrs.get("profile"); RuleAppendHandler appendHandler = assistant.getRuleAppendHandler(); if (appendHandler != null) { AppendRule appendRule = AppendRule.newInstance(file, resource, url, format, profile); appendHandler.pending(appendRule); } }); }
[ "private", "void", "addAppendNodelets", "(", ")", "{", "parser", ".", "setXpath", "(", "\"/aspectran/append\"", ")", ";", "parser", ".", "addNodelet", "(", "attrs", "->", "{", "String", "file", "=", "attrs", ".", "get", "(", "\"file\"", ")", ";", "String", "resource", "=", "attrs", ".", "get", "(", "\"resource\"", ")", ";", "String", "url", "=", "attrs", ".", "get", "(", "\"url\"", ")", ";", "String", "format", "=", "attrs", ".", "get", "(", "\"format\"", ")", ";", "String", "profile", "=", "attrs", ".", "get", "(", "\"profile\"", ")", ";", "RuleAppendHandler", "appendHandler", "=", "assistant", ".", "getRuleAppendHandler", "(", ")", ";", "if", "(", "appendHandler", "!=", "null", ")", "{", "AppendRule", "appendRule", "=", "AppendRule", ".", "newInstance", "(", "file", ",", "resource", ",", "url", ",", "format", ",", "profile", ")", ";", "appendHandler", ".", "pending", "(", "appendRule", ")", ";", "}", "}", ")", ";", "}" ]
Adds the append nodelets.
[ "Adds", "the", "append", "nodelets", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranNodeParser.java#L317-L332
142,638
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/FilenameUtils.java
FilenameUtils.getFullPath
public static String getFullPath(String filename) { if (filename == null) { return null; } int index = indexOfLastSeparator(filename); if (index < 0) { return StringUtils.EMPTY; } return filename.substring(0, index); }
java
public static String getFullPath(String filename) { if (filename == null) { return null; } int index = indexOfLastSeparator(filename); if (index < 0) { return StringUtils.EMPTY; } return filename.substring(0, index); }
[ "public", "static", "String", "getFullPath", "(", "String", "filename", ")", "{", "if", "(", "filename", "==", "null", ")", "{", "return", "null", ";", "}", "int", "index", "=", "indexOfLastSeparator", "(", "filename", ")", ";", "if", "(", "index", "<", "0", ")", "{", "return", "StringUtils", ".", "EMPTY", ";", "}", "return", "filename", ".", "substring", "(", "0", ",", "index", ")", ";", "}" ]
Gets the path from a full filename. @param filename a full filename @return the path
[ "Gets", "the", "path", "from", "a", "full", "filename", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/FilenameUtils.java#L200-L209
142,639
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/FilenameUtils.java
FilenameUtils.isValidFileExtension
public static boolean isValidFileExtension(String filename, String allowedFileExtensions, String deniedFileExtensions) { if (filename == null) { return false; } String ext = getExtension(filename).toLowerCase(); if (allowedFileExtensions != null && !allowedFileExtensions.isEmpty()) { if (ext.length() == 0) { return false; } StringTokenizer st = new StringTokenizer(allowedFileExtensions.toLowerCase(), EXTENSIONS_SEPARATORS); while (st.hasMoreTokens()) { String ext2 = st.nextToken(); if (ext.equals(ext2)) { return true; } } return false; } if (deniedFileExtensions != null && !deniedFileExtensions.isEmpty()) { if (ext.length() == 0) { return true; } StringTokenizer st = new StringTokenizer(deniedFileExtensions.toLowerCase(), EXTENSIONS_SEPARATORS); while (st.hasMoreTokens()) { String ext2 = st.nextToken(); if (ext.equals(ext2)) { return false; } } return true; } return true; }
java
public static boolean isValidFileExtension(String filename, String allowedFileExtensions, String deniedFileExtensions) { if (filename == null) { return false; } String ext = getExtension(filename).toLowerCase(); if (allowedFileExtensions != null && !allowedFileExtensions.isEmpty()) { if (ext.length() == 0) { return false; } StringTokenizer st = new StringTokenizer(allowedFileExtensions.toLowerCase(), EXTENSIONS_SEPARATORS); while (st.hasMoreTokens()) { String ext2 = st.nextToken(); if (ext.equals(ext2)) { return true; } } return false; } if (deniedFileExtensions != null && !deniedFileExtensions.isEmpty()) { if (ext.length() == 0) { return true; } StringTokenizer st = new StringTokenizer(deniedFileExtensions.toLowerCase(), EXTENSIONS_SEPARATORS); while (st.hasMoreTokens()) { String ext2 = st.nextToken(); if (ext.equals(ext2)) { return false; } } return true; } return true; }
[ "public", "static", "boolean", "isValidFileExtension", "(", "String", "filename", ",", "String", "allowedFileExtensions", ",", "String", "deniedFileExtensions", ")", "{", "if", "(", "filename", "==", "null", ")", "{", "return", "false", ";", "}", "String", "ext", "=", "getExtension", "(", "filename", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "allowedFileExtensions", "!=", "null", "&&", "!", "allowedFileExtensions", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "ext", ".", "length", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "allowedFileExtensions", ".", "toLowerCase", "(", ")", ",", "EXTENSIONS_SEPARATORS", ")", ";", "while", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "ext2", "=", "st", ".", "nextToken", "(", ")", ";", "if", "(", "ext", ".", "equals", "(", "ext2", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "if", "(", "deniedFileExtensions", "!=", "null", "&&", "!", "deniedFileExtensions", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "ext", ".", "length", "(", ")", "==", "0", ")", "{", "return", "true", ";", "}", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "deniedFileExtensions", ".", "toLowerCase", "(", ")", ",", "EXTENSIONS_SEPARATORS", ")", ";", "while", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "ext2", "=", "st", ".", "nextToken", "(", ")", ";", "if", "(", "ext", ".", "equals", "(", "ext2", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "return", "true", ";", "}" ]
Checks whether the extension of the filename is valid. The extension check is case-sensitive on all platforms. @param filename the filename to query, null returns false @param allowedFileExtensions the allowed file extensions @param deniedFileExtensions the denied file extensions @return true if is valid file extension; false otherwise
[ "Checks", "whether", "the", "extension", "of", "the", "filename", "is", "valid", ".", "The", "extension", "check", "is", "case", "-", "sensitive", "on", "all", "platforms", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/FilenameUtils.java#L237-L277
142,640
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/FilenameUtils.java
FilenameUtils.getUniqueFile
public static File getUniqueFile(File srcFile, char extSeparator) throws IOException { if (srcFile == null) { throw new IllegalArgumentException("srcFile must not be null"); } String path = getFullPath(srcFile.getCanonicalPath()); String name = removeExtension(srcFile.getName()); String ext = getExtension(srcFile.getName()); String newName; if (ext != null && !ext.isEmpty()) { newName = name + extSeparator + ext; } else { newName = name; } int count = 0; File destFile = new File(path, newName); while (destFile.exists()) { count++; if (ext != null && !ext.isEmpty()) { newName = name + "-" + count + extSeparator + ext; } else { newName = name + "-" + count; } destFile = new File(path, newName); } return (count == 0 ? srcFile : destFile); }
java
public static File getUniqueFile(File srcFile, char extSeparator) throws IOException { if (srcFile == null) { throw new IllegalArgumentException("srcFile must not be null"); } String path = getFullPath(srcFile.getCanonicalPath()); String name = removeExtension(srcFile.getName()); String ext = getExtension(srcFile.getName()); String newName; if (ext != null && !ext.isEmpty()) { newName = name + extSeparator + ext; } else { newName = name; } int count = 0; File destFile = new File(path, newName); while (destFile.exists()) { count++; if (ext != null && !ext.isEmpty()) { newName = name + "-" + count + extSeparator + ext; } else { newName = name + "-" + count; } destFile = new File(path, newName); } return (count == 0 ? srcFile : destFile); }
[ "public", "static", "File", "getUniqueFile", "(", "File", "srcFile", ",", "char", "extSeparator", ")", "throws", "IOException", "{", "if", "(", "srcFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"srcFile must not be null\"", ")", ";", "}", "String", "path", "=", "getFullPath", "(", "srcFile", ".", "getCanonicalPath", "(", ")", ")", ";", "String", "name", "=", "removeExtension", "(", "srcFile", ".", "getName", "(", ")", ")", ";", "String", "ext", "=", "getExtension", "(", "srcFile", ".", "getName", "(", ")", ")", ";", "String", "newName", ";", "if", "(", "ext", "!=", "null", "&&", "!", "ext", ".", "isEmpty", "(", ")", ")", "{", "newName", "=", "name", "+", "extSeparator", "+", "ext", ";", "}", "else", "{", "newName", "=", "name", ";", "}", "int", "count", "=", "0", ";", "File", "destFile", "=", "new", "File", "(", "path", ",", "newName", ")", ";", "while", "(", "destFile", ".", "exists", "(", ")", ")", "{", "count", "++", ";", "if", "(", "ext", "!=", "null", "&&", "!", "ext", ".", "isEmpty", "(", ")", ")", "{", "newName", "=", "name", "+", "\"-\"", "+", "count", "+", "extSeparator", "+", "ext", ";", "}", "else", "{", "newName", "=", "name", "+", "\"-\"", "+", "count", ";", "}", "destFile", "=", "new", "File", "(", "path", ",", "newName", ")", ";", "}", "return", "(", "count", "==", "0", "?", "srcFile", ":", "destFile", ")", ";", "}" ]
Returns a file name that does not overlap in the specified directory. If a duplicate file name exists, it is returned by appending a number after the file name. @param srcFile the file to seek @param extSeparator the extension separator @return an unique file @throws IOException if failed to obtain an unique file
[ "Returns", "a", "file", "name", "that", "does", "not", "overlap", "in", "the", "specified", "directory", ".", "If", "a", "duplicate", "file", "name", "exists", "it", "is", "returned", "by", "appending", "a", "number", "after", "the", "file", "name", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/FilenameUtils.java#L300-L330
142,641
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/ShellCommandInterpreter.java
ShellCommandInterpreter.execute
private void execute(Command command, CommandLineParser lineParser) { ConsoleWrapper wrappedConsole = new ConsoleWrapper(console); PrintWriter outputWriter = null; try { ParsedOptions options = lineParser.parseOptions(command.getOptions()); outputWriter = OutputRedirection.determineOutputWriter(lineParser.getRedirectionList(), wrappedConsole); wrappedConsole.setWriter(outputWriter); command.execute(options, wrappedConsole); } catch (ConsoleTerminatedException e) { throw e; } catch (OptionParserException e) { wrappedConsole.writeError(e.getMessage()); command.printHelp(wrappedConsole); } catch (Exception e) { log.error("Failed to execute command: " + lineParser.getCommandLine(), e); } finally { if (outputWriter != null) { outputWriter.close(); } } }
java
private void execute(Command command, CommandLineParser lineParser) { ConsoleWrapper wrappedConsole = new ConsoleWrapper(console); PrintWriter outputWriter = null; try { ParsedOptions options = lineParser.parseOptions(command.getOptions()); outputWriter = OutputRedirection.determineOutputWriter(lineParser.getRedirectionList(), wrappedConsole); wrappedConsole.setWriter(outputWriter); command.execute(options, wrappedConsole); } catch (ConsoleTerminatedException e) { throw e; } catch (OptionParserException e) { wrappedConsole.writeError(e.getMessage()); command.printHelp(wrappedConsole); } catch (Exception e) { log.error("Failed to execute command: " + lineParser.getCommandLine(), e); } finally { if (outputWriter != null) { outputWriter.close(); } } }
[ "private", "void", "execute", "(", "Command", "command", ",", "CommandLineParser", "lineParser", ")", "{", "ConsoleWrapper", "wrappedConsole", "=", "new", "ConsoleWrapper", "(", "console", ")", ";", "PrintWriter", "outputWriter", "=", "null", ";", "try", "{", "ParsedOptions", "options", "=", "lineParser", ".", "parseOptions", "(", "command", ".", "getOptions", "(", ")", ")", ";", "outputWriter", "=", "OutputRedirection", ".", "determineOutputWriter", "(", "lineParser", ".", "getRedirectionList", "(", ")", ",", "wrappedConsole", ")", ";", "wrappedConsole", ".", "setWriter", "(", "outputWriter", ")", ";", "command", ".", "execute", "(", "options", ",", "wrappedConsole", ")", ";", "}", "catch", "(", "ConsoleTerminatedException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "OptionParserException", "e", ")", "{", "wrappedConsole", ".", "writeError", "(", "e", ".", "getMessage", "(", ")", ")", ";", "command", ".", "printHelp", "(", "wrappedConsole", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Failed to execute command: \"", "+", "lineParser", ".", "getCommandLine", "(", ")", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "outputWriter", "!=", "null", ")", "{", "outputWriter", ".", "close", "(", ")", ";", "}", "}", "}" ]
Executes a command built into Aspectran Shell. @param command an instance of the built-in command to be executed @param lineParser the command line parser
[ "Executes", "a", "command", "built", "into", "Aspectran", "Shell", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/ShellCommandInterpreter.java#L166-L186
142,642
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/ShellCommandInterpreter.java
ShellCommandInterpreter.execute
private void execute(TransletCommandLine transletCommandLine) { if (transletCommandLine.getRequestName() != null) { try { service.translate(transletCommandLine, console); } catch (TransletNotFoundException e) { console.writeError("No command or translet mapped to '" + e.getTransletName() + "'"); } catch (ConsoleTerminatedException e) { throw e; } catch (Exception e) { log.error("Failed to execute command: " + transletCommandLine.getLineParser().getCommandLine(), e); } } else { console.writeError("No command or translet mapped to '" + transletCommandLine.getLineParser().getCommandLine() + "'"); } }
java
private void execute(TransletCommandLine transletCommandLine) { if (transletCommandLine.getRequestName() != null) { try { service.translate(transletCommandLine, console); } catch (TransletNotFoundException e) { console.writeError("No command or translet mapped to '" + e.getTransletName() + "'"); } catch (ConsoleTerminatedException e) { throw e; } catch (Exception e) { log.error("Failed to execute command: " + transletCommandLine.getLineParser().getCommandLine(), e); } } else { console.writeError("No command or translet mapped to '" + transletCommandLine.getLineParser().getCommandLine() + "'"); } }
[ "private", "void", "execute", "(", "TransletCommandLine", "transletCommandLine", ")", "{", "if", "(", "transletCommandLine", ".", "getRequestName", "(", ")", "!=", "null", ")", "{", "try", "{", "service", ".", "translate", "(", "transletCommandLine", ",", "console", ")", ";", "}", "catch", "(", "TransletNotFoundException", "e", ")", "{", "console", ".", "writeError", "(", "\"No command or translet mapped to '\"", "+", "e", ".", "getTransletName", "(", ")", "+", "\"'\"", ")", ";", "}", "catch", "(", "ConsoleTerminatedException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Failed to execute command: \"", "+", "transletCommandLine", ".", "getLineParser", "(", ")", ".", "getCommandLine", "(", ")", ",", "e", ")", ";", "}", "}", "else", "{", "console", ".", "writeError", "(", "\"No command or translet mapped to '\"", "+", "transletCommandLine", ".", "getLineParser", "(", ")", ".", "getCommandLine", "(", ")", "+", "\"'\"", ")", ";", "}", "}" ]
Executes a Translet defined in Aspectran. @param transletCommandLine the {@code TransletCommandLine} instance
[ "Executes", "a", "Translet", "defined", "in", "Aspectran", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/ShellCommandInterpreter.java#L193-L209
142,643
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/BeanRule.java
BeanRule.setBeanClass
public void setBeanClass(Class<?> beanClass) { this.beanClass = beanClass; this.className = beanClass.getName(); this.factoryBean = FactoryBean.class.isAssignableFrom(beanClass); this.disposableBean = DisposableBean.class.isAssignableFrom(beanClass); this.initializableBean = InitializableBean.class.isAssignableFrom(beanClass); this.initializableTransletBean = InitializableTransletBean.class.isAssignableFrom(beanClass); }
java
public void setBeanClass(Class<?> beanClass) { this.beanClass = beanClass; this.className = beanClass.getName(); this.factoryBean = FactoryBean.class.isAssignableFrom(beanClass); this.disposableBean = DisposableBean.class.isAssignableFrom(beanClass); this.initializableBean = InitializableBean.class.isAssignableFrom(beanClass); this.initializableTransletBean = InitializableTransletBean.class.isAssignableFrom(beanClass); }
[ "public", "void", "setBeanClass", "(", "Class", "<", "?", ">", "beanClass", ")", "{", "this", ".", "beanClass", "=", "beanClass", ";", "this", ".", "className", "=", "beanClass", ".", "getName", "(", ")", ";", "this", ".", "factoryBean", "=", "FactoryBean", ".", "class", ".", "isAssignableFrom", "(", "beanClass", ")", ";", "this", ".", "disposableBean", "=", "DisposableBean", ".", "class", ".", "isAssignableFrom", "(", "beanClass", ")", ";", "this", ".", "initializableBean", "=", "InitializableBean", ".", "class", ".", "isAssignableFrom", "(", "beanClass", ")", ";", "this", ".", "initializableTransletBean", "=", "InitializableTransletBean", ".", "class", ".", "isAssignableFrom", "(", "beanClass", ")", ";", "}" ]
Sets the bean class. @param beanClass the new bean class
[ "Sets", "the", "bean", "class", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanRule.java#L170-L177
142,644
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/BeanRule.java
BeanRule.newConstructorArgumentItemRule
public ItemRule newConstructorArgumentItemRule() { ItemRule itemRule = new ItemRule(); itemRule.setAutoNamed(true); addConstructorArgumentItemRule(itemRule); return itemRule; }
java
public ItemRule newConstructorArgumentItemRule() { ItemRule itemRule = new ItemRule(); itemRule.setAutoNamed(true); addConstructorArgumentItemRule(itemRule); return itemRule; }
[ "public", "ItemRule", "newConstructorArgumentItemRule", "(", ")", "{", "ItemRule", "itemRule", "=", "new", "ItemRule", "(", ")", ";", "itemRule", ".", "setAutoNamed", "(", "true", ")", ";", "addConstructorArgumentItemRule", "(", "itemRule", ")", ";", "return", "itemRule", ";", "}" ]
Adds a new constructor argument item rule and returns it. @return the constructor argument item rule
[ "Adds", "a", "new", "constructor", "argument", "item", "rule", "and", "returns", "it", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanRule.java#L531-L536
142,645
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/BeanRule.java
BeanRule.addConstructorArgumentItemRule
public void addConstructorArgumentItemRule(ItemRule constructorArgumentItemRule) { if (constructorArgumentItemRuleMap == null) { constructorArgumentItemRuleMap = new ItemRuleMap(); } constructorArgumentItemRuleMap.putItemRule(constructorArgumentItemRule); }
java
public void addConstructorArgumentItemRule(ItemRule constructorArgumentItemRule) { if (constructorArgumentItemRuleMap == null) { constructorArgumentItemRuleMap = new ItemRuleMap(); } constructorArgumentItemRuleMap.putItemRule(constructorArgumentItemRule); }
[ "public", "void", "addConstructorArgumentItemRule", "(", "ItemRule", "constructorArgumentItemRule", ")", "{", "if", "(", "constructorArgumentItemRuleMap", "==", "null", ")", "{", "constructorArgumentItemRuleMap", "=", "new", "ItemRuleMap", "(", ")", ";", "}", "constructorArgumentItemRuleMap", ".", "putItemRule", "(", "constructorArgumentItemRule", ")", ";", "}" ]
Adds the constructor argument item rule. @param constructorArgumentItemRule the constructor argument item rule
[ "Adds", "the", "constructor", "argument", "item", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanRule.java#L543-L548
142,646
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/BeanRule.java
BeanRule.newPropertyItemRule
public ItemRule newPropertyItemRule(String propertyName) { ItemRule itemRule = new ItemRule(); itemRule.setName(propertyName); addPropertyItemRule(itemRule); return itemRule; }
java
public ItemRule newPropertyItemRule(String propertyName) { ItemRule itemRule = new ItemRule(); itemRule.setName(propertyName); addPropertyItemRule(itemRule); return itemRule; }
[ "public", "ItemRule", "newPropertyItemRule", "(", "String", "propertyName", ")", "{", "ItemRule", "itemRule", "=", "new", "ItemRule", "(", ")", ";", "itemRule", ".", "setName", "(", "propertyName", ")", ";", "addPropertyItemRule", "(", "itemRule", ")", ";", "return", "itemRule", ";", "}" ]
Adds a new property rule with the specified name and returns it. @param propertyName the property name @return the property item rule
[ "Adds", "a", "new", "property", "rule", "with", "the", "specified", "name", "and", "returns", "it", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanRule.java#L574-L579
142,647
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/BeanRule.java
BeanRule.addPropertyItemRule
public void addPropertyItemRule(ItemRule propertyItemRule) { if (propertyItemRuleMap == null) { propertyItemRuleMap = new ItemRuleMap(); } propertyItemRuleMap.putItemRule(propertyItemRule); }
java
public void addPropertyItemRule(ItemRule propertyItemRule) { if (propertyItemRuleMap == null) { propertyItemRuleMap = new ItemRuleMap(); } propertyItemRuleMap.putItemRule(propertyItemRule); }
[ "public", "void", "addPropertyItemRule", "(", "ItemRule", "propertyItemRule", ")", "{", "if", "(", "propertyItemRuleMap", "==", "null", ")", "{", "propertyItemRuleMap", "=", "new", "ItemRuleMap", "(", ")", ";", "}", "propertyItemRuleMap", ".", "putItemRule", "(", "propertyItemRule", ")", ";", "}" ]
Adds the property item rule. @param propertyItemRule the new property item rule
[ "Adds", "the", "property", "item", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanRule.java#L586-L591
142,648
aspectran/aspectran
demo/src/main/java/com/aspectran/demo/tts/TextToSpeechBean.java
TextToSpeechBean.speak
public void speak(String text) { if (voice == null) { throw new IllegalStateException("Cannot find a voice named " + voiceName); } voice.speak(text); }
java
public void speak(String text) { if (voice == null) { throw new IllegalStateException("Cannot find a voice named " + voiceName); } voice.speak(text); }
[ "public", "void", "speak", "(", "String", "text", ")", "{", "if", "(", "voice", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot find a voice named \"", "+", "voiceName", ")", ";", "}", "voice", ".", "speak", "(", "text", ")", ";", "}" ]
Synthesizes speech of the given text and plays immediately. @param text the text that will be transformed to speech
[ "Synthesizes", "speech", "of", "the", "given", "text", "and", "plays", "immediately", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/demo/src/main/java/com/aspectran/demo/tts/TextToSpeechBean.java#L128-L133
142,649
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/builder/AbstractActivityContextBuilder.java
AbstractActivityContextBuilder.createActivityContext
protected ActivityContext createActivityContext(ContextRuleAssistant assistant) throws BeanReferenceException, IllegalRuleException { initContextEnvironment(assistant); AspectranActivityContext activityContext = new AspectranActivityContext(assistant.getContextEnvironment()); AspectRuleRegistry aspectRuleRegistry = assistant.getAspectRuleRegistry(); BeanRuleRegistry beanRuleRegistry = assistant.getBeanRuleRegistry(); beanRuleRegistry.postProcess(assistant); BeanReferenceInspector beanReferenceInspector = assistant.getBeanReferenceInspector(); beanReferenceInspector.inspect(beanRuleRegistry); initAspectRuleRegistry(assistant); BeanProxifierType beanProxifierType = BeanProxifierType.resolve((String)assistant.getSetting(DefaultSettingType.BEAN_PROXIFIER)); ContextBeanRegistry contextBeanRegistry = new ContextBeanRegistry(activityContext, beanRuleRegistry, beanProxifierType); TemplateRuleRegistry templateRuleRegistry = assistant.getTemplateRuleRegistry(); ContextTemplateRenderer contextTemplateRenderer = new ContextTemplateRenderer(activityContext, templateRuleRegistry); ScheduleRuleRegistry scheduleRuleRegistry = assistant.getScheduleRuleRegistry(); TransletRuleRegistry transletRuleRegistry = assistant.getTransletRuleRegistry(); activityContext.setAspectRuleRegistry(aspectRuleRegistry); activityContext.setContextBeanRegistry(contextBeanRegistry); activityContext.setScheduleRuleRegistry(scheduleRuleRegistry); activityContext.setContextTemplateRenderer(contextTemplateRenderer); activityContext.setTransletRuleRegistry(transletRuleRegistry); activityContext.setDescription(assistant.getAssistantLocal().getDescription()); return activityContext; }
java
protected ActivityContext createActivityContext(ContextRuleAssistant assistant) throws BeanReferenceException, IllegalRuleException { initContextEnvironment(assistant); AspectranActivityContext activityContext = new AspectranActivityContext(assistant.getContextEnvironment()); AspectRuleRegistry aspectRuleRegistry = assistant.getAspectRuleRegistry(); BeanRuleRegistry beanRuleRegistry = assistant.getBeanRuleRegistry(); beanRuleRegistry.postProcess(assistant); BeanReferenceInspector beanReferenceInspector = assistant.getBeanReferenceInspector(); beanReferenceInspector.inspect(beanRuleRegistry); initAspectRuleRegistry(assistant); BeanProxifierType beanProxifierType = BeanProxifierType.resolve((String)assistant.getSetting(DefaultSettingType.BEAN_PROXIFIER)); ContextBeanRegistry contextBeanRegistry = new ContextBeanRegistry(activityContext, beanRuleRegistry, beanProxifierType); TemplateRuleRegistry templateRuleRegistry = assistant.getTemplateRuleRegistry(); ContextTemplateRenderer contextTemplateRenderer = new ContextTemplateRenderer(activityContext, templateRuleRegistry); ScheduleRuleRegistry scheduleRuleRegistry = assistant.getScheduleRuleRegistry(); TransletRuleRegistry transletRuleRegistry = assistant.getTransletRuleRegistry(); activityContext.setAspectRuleRegistry(aspectRuleRegistry); activityContext.setContextBeanRegistry(contextBeanRegistry); activityContext.setScheduleRuleRegistry(scheduleRuleRegistry); activityContext.setContextTemplateRenderer(contextTemplateRenderer); activityContext.setTransletRuleRegistry(transletRuleRegistry); activityContext.setDescription(assistant.getAssistantLocal().getDescription()); return activityContext; }
[ "protected", "ActivityContext", "createActivityContext", "(", "ContextRuleAssistant", "assistant", ")", "throws", "BeanReferenceException", ",", "IllegalRuleException", "{", "initContextEnvironment", "(", "assistant", ")", ";", "AspectranActivityContext", "activityContext", "=", "new", "AspectranActivityContext", "(", "assistant", ".", "getContextEnvironment", "(", ")", ")", ";", "AspectRuleRegistry", "aspectRuleRegistry", "=", "assistant", ".", "getAspectRuleRegistry", "(", ")", ";", "BeanRuleRegistry", "beanRuleRegistry", "=", "assistant", ".", "getBeanRuleRegistry", "(", ")", ";", "beanRuleRegistry", ".", "postProcess", "(", "assistant", ")", ";", "BeanReferenceInspector", "beanReferenceInspector", "=", "assistant", ".", "getBeanReferenceInspector", "(", ")", ";", "beanReferenceInspector", ".", "inspect", "(", "beanRuleRegistry", ")", ";", "initAspectRuleRegistry", "(", "assistant", ")", ";", "BeanProxifierType", "beanProxifierType", "=", "BeanProxifierType", ".", "resolve", "(", "(", "String", ")", "assistant", ".", "getSetting", "(", "DefaultSettingType", ".", "BEAN_PROXIFIER", ")", ")", ";", "ContextBeanRegistry", "contextBeanRegistry", "=", "new", "ContextBeanRegistry", "(", "activityContext", ",", "beanRuleRegistry", ",", "beanProxifierType", ")", ";", "TemplateRuleRegistry", "templateRuleRegistry", "=", "assistant", ".", "getTemplateRuleRegistry", "(", ")", ";", "ContextTemplateRenderer", "contextTemplateRenderer", "=", "new", "ContextTemplateRenderer", "(", "activityContext", ",", "templateRuleRegistry", ")", ";", "ScheduleRuleRegistry", "scheduleRuleRegistry", "=", "assistant", ".", "getScheduleRuleRegistry", "(", ")", ";", "TransletRuleRegistry", "transletRuleRegistry", "=", "assistant", ".", "getTransletRuleRegistry", "(", ")", ";", "activityContext", ".", "setAspectRuleRegistry", "(", "aspectRuleRegistry", ")", ";", "activityContext", ".", "setContextBeanRegistry", "(", "contextBeanRegistry", ")", ";", "activityContext", ".", "setScheduleRuleRegistry", "(", "scheduleRuleRegistry", ")", ";", "activityContext", ".", "setContextTemplateRenderer", "(", "contextTemplateRenderer", ")", ";", "activityContext", ".", "setTransletRuleRegistry", "(", "transletRuleRegistry", ")", ";", "activityContext", ".", "setDescription", "(", "assistant", ".", "getAssistantLocal", "(", ")", ".", "getDescription", "(", ")", ")", ";", "return", "activityContext", ";", "}" ]
Returns a new instance of ActivityContext. @param assistant the context rule assistant @return the activity context @throws BeanReferenceException will be thrown when cannot resolve reference to bean @throws IllegalRuleException if an illegal rule is found
[ "Returns", "a", "new", "instance", "of", "ActivityContext", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/builder/AbstractActivityContextBuilder.java#L340-L373
142,650
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/builder/AbstractActivityContextBuilder.java
AbstractActivityContextBuilder.initAspectRuleRegistry
private void initAspectRuleRegistry(ContextRuleAssistant assistant) { AspectRuleRegistry aspectRuleRegistry = assistant.getAspectRuleRegistry(); BeanRuleRegistry beanRuleRegistry = assistant.getBeanRuleRegistry(); TransletRuleRegistry transletRuleRegistry = assistant.getTransletRuleRegistry(); AspectAdviceRulePostRegister sessionScopeAspectAdviceRulePostRegister = new AspectAdviceRulePostRegister(); for (AspectRule aspectRule : aspectRuleRegistry.getAspectRules()) { PointcutRule pointcutRule = aspectRule.getPointcutRule(); if (pointcutRule != null) { Pointcut pointcut = PointcutFactory.createPointcut(pointcutRule); aspectRule.setPointcut(pointcut); } if (aspectRule.getJoinpointTargetType() == JoinpointTargetType.SESSION) { sessionScopeAspectAdviceRulePostRegister.register(aspectRule); } } AspectAdviceRulePreRegister preRegister = new AspectAdviceRulePreRegister(aspectRuleRegistry); preRegister.register(beanRuleRegistry); preRegister.register(transletRuleRegistry); // check invalid pointcut pattern boolean pointcutPatternVerifiable = assistant.isPointcutPatternVerifiable(); if (pointcutPatternVerifiable || log.isDebugEnabled()) { int invalidPointcutPatterns = 0; for (AspectRule aspectRule : aspectRuleRegistry.getAspectRules()) { Pointcut pointcut = aspectRule.getPointcut(); if (pointcut != null) { List<PointcutPatternRule> pointcutPatternRuleList = pointcut.getPointcutPatternRuleList(); if (pointcutPatternRuleList != null) { for (PointcutPatternRule ppr : pointcutPatternRuleList) { if (ppr.getBeanIdPattern() != null && ppr.getMatchedBeanCount() == 0) { invalidPointcutPatterns++; String msg = "No beans matching to '" + ppr.getBeanIdPattern() + "'; aspectRule " + aspectRule; if (pointcutPatternVerifiable) { log.error(msg); } else { log.debug(msg); } } if (ppr.getClassNamePattern() != null && ppr.getMatchedClassCount() == 0) { invalidPointcutPatterns++; String msg = "No beans matching to '@class:" + ppr.getClassNamePattern() + "'; aspectRule " + aspectRule; if (pointcutPatternVerifiable) { log.error(msg); } else { log.debug(msg); } } if (ppr.getMethodNamePattern() != null && ppr.getMatchedMethodCount() == 0) { invalidPointcutPatterns++; String msg = "No beans have methods matching to '^" + ppr.getMethodNamePattern() + "'; aspectRule " + aspectRule; if (pointcutPatternVerifiable) { log.error(msg); } else { log.debug(msg); } } } } } } if (invalidPointcutPatterns > 0) { String msg = "Invalid pointcut detected: " + invalidPointcutPatterns + "; Please check the logs for more information"; if (pointcutPatternVerifiable) { log.error(msg); throw new InvalidPointcutPatternException(msg); } else { log.debug(msg); } } } AspectAdviceRuleRegistry sessionScopeAarr = sessionScopeAspectAdviceRulePostRegister.getAspectAdviceRuleRegistry(); if (sessionScopeAarr != null) { aspectRuleRegistry.setSessionAspectAdviceRuleRegistry(sessionScopeAarr); } }
java
private void initAspectRuleRegistry(ContextRuleAssistant assistant) { AspectRuleRegistry aspectRuleRegistry = assistant.getAspectRuleRegistry(); BeanRuleRegistry beanRuleRegistry = assistant.getBeanRuleRegistry(); TransletRuleRegistry transletRuleRegistry = assistant.getTransletRuleRegistry(); AspectAdviceRulePostRegister sessionScopeAspectAdviceRulePostRegister = new AspectAdviceRulePostRegister(); for (AspectRule aspectRule : aspectRuleRegistry.getAspectRules()) { PointcutRule pointcutRule = aspectRule.getPointcutRule(); if (pointcutRule != null) { Pointcut pointcut = PointcutFactory.createPointcut(pointcutRule); aspectRule.setPointcut(pointcut); } if (aspectRule.getJoinpointTargetType() == JoinpointTargetType.SESSION) { sessionScopeAspectAdviceRulePostRegister.register(aspectRule); } } AspectAdviceRulePreRegister preRegister = new AspectAdviceRulePreRegister(aspectRuleRegistry); preRegister.register(beanRuleRegistry); preRegister.register(transletRuleRegistry); // check invalid pointcut pattern boolean pointcutPatternVerifiable = assistant.isPointcutPatternVerifiable(); if (pointcutPatternVerifiable || log.isDebugEnabled()) { int invalidPointcutPatterns = 0; for (AspectRule aspectRule : aspectRuleRegistry.getAspectRules()) { Pointcut pointcut = aspectRule.getPointcut(); if (pointcut != null) { List<PointcutPatternRule> pointcutPatternRuleList = pointcut.getPointcutPatternRuleList(); if (pointcutPatternRuleList != null) { for (PointcutPatternRule ppr : pointcutPatternRuleList) { if (ppr.getBeanIdPattern() != null && ppr.getMatchedBeanCount() == 0) { invalidPointcutPatterns++; String msg = "No beans matching to '" + ppr.getBeanIdPattern() + "'; aspectRule " + aspectRule; if (pointcutPatternVerifiable) { log.error(msg); } else { log.debug(msg); } } if (ppr.getClassNamePattern() != null && ppr.getMatchedClassCount() == 0) { invalidPointcutPatterns++; String msg = "No beans matching to '@class:" + ppr.getClassNamePattern() + "'; aspectRule " + aspectRule; if (pointcutPatternVerifiable) { log.error(msg); } else { log.debug(msg); } } if (ppr.getMethodNamePattern() != null && ppr.getMatchedMethodCount() == 0) { invalidPointcutPatterns++; String msg = "No beans have methods matching to '^" + ppr.getMethodNamePattern() + "'; aspectRule " + aspectRule; if (pointcutPatternVerifiable) { log.error(msg); } else { log.debug(msg); } } } } } } if (invalidPointcutPatterns > 0) { String msg = "Invalid pointcut detected: " + invalidPointcutPatterns + "; Please check the logs for more information"; if (pointcutPatternVerifiable) { log.error(msg); throw new InvalidPointcutPatternException(msg); } else { log.debug(msg); } } } AspectAdviceRuleRegistry sessionScopeAarr = sessionScopeAspectAdviceRulePostRegister.getAspectAdviceRuleRegistry(); if (sessionScopeAarr != null) { aspectRuleRegistry.setSessionAspectAdviceRuleRegistry(sessionScopeAarr); } }
[ "private", "void", "initAspectRuleRegistry", "(", "ContextRuleAssistant", "assistant", ")", "{", "AspectRuleRegistry", "aspectRuleRegistry", "=", "assistant", ".", "getAspectRuleRegistry", "(", ")", ";", "BeanRuleRegistry", "beanRuleRegistry", "=", "assistant", ".", "getBeanRuleRegistry", "(", ")", ";", "TransletRuleRegistry", "transletRuleRegistry", "=", "assistant", ".", "getTransletRuleRegistry", "(", ")", ";", "AspectAdviceRulePostRegister", "sessionScopeAspectAdviceRulePostRegister", "=", "new", "AspectAdviceRulePostRegister", "(", ")", ";", "for", "(", "AspectRule", "aspectRule", ":", "aspectRuleRegistry", ".", "getAspectRules", "(", ")", ")", "{", "PointcutRule", "pointcutRule", "=", "aspectRule", ".", "getPointcutRule", "(", ")", ";", "if", "(", "pointcutRule", "!=", "null", ")", "{", "Pointcut", "pointcut", "=", "PointcutFactory", ".", "createPointcut", "(", "pointcutRule", ")", ";", "aspectRule", ".", "setPointcut", "(", "pointcut", ")", ";", "}", "if", "(", "aspectRule", ".", "getJoinpointTargetType", "(", ")", "==", "JoinpointTargetType", ".", "SESSION", ")", "{", "sessionScopeAspectAdviceRulePostRegister", ".", "register", "(", "aspectRule", ")", ";", "}", "}", "AspectAdviceRulePreRegister", "preRegister", "=", "new", "AspectAdviceRulePreRegister", "(", "aspectRuleRegistry", ")", ";", "preRegister", ".", "register", "(", "beanRuleRegistry", ")", ";", "preRegister", ".", "register", "(", "transletRuleRegistry", ")", ";", "// check invalid pointcut pattern", "boolean", "pointcutPatternVerifiable", "=", "assistant", ".", "isPointcutPatternVerifiable", "(", ")", ";", "if", "(", "pointcutPatternVerifiable", "||", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "int", "invalidPointcutPatterns", "=", "0", ";", "for", "(", "AspectRule", "aspectRule", ":", "aspectRuleRegistry", ".", "getAspectRules", "(", ")", ")", "{", "Pointcut", "pointcut", "=", "aspectRule", ".", "getPointcut", "(", ")", ";", "if", "(", "pointcut", "!=", "null", ")", "{", "List", "<", "PointcutPatternRule", ">", "pointcutPatternRuleList", "=", "pointcut", ".", "getPointcutPatternRuleList", "(", ")", ";", "if", "(", "pointcutPatternRuleList", "!=", "null", ")", "{", "for", "(", "PointcutPatternRule", "ppr", ":", "pointcutPatternRuleList", ")", "{", "if", "(", "ppr", ".", "getBeanIdPattern", "(", ")", "!=", "null", "&&", "ppr", ".", "getMatchedBeanCount", "(", ")", "==", "0", ")", "{", "invalidPointcutPatterns", "++", ";", "String", "msg", "=", "\"No beans matching to '\"", "+", "ppr", ".", "getBeanIdPattern", "(", ")", "+", "\"'; aspectRule \"", "+", "aspectRule", ";", "if", "(", "pointcutPatternVerifiable", ")", "{", "log", ".", "error", "(", "msg", ")", ";", "}", "else", "{", "log", ".", "debug", "(", "msg", ")", ";", "}", "}", "if", "(", "ppr", ".", "getClassNamePattern", "(", ")", "!=", "null", "&&", "ppr", ".", "getMatchedClassCount", "(", ")", "==", "0", ")", "{", "invalidPointcutPatterns", "++", ";", "String", "msg", "=", "\"No beans matching to '@class:\"", "+", "ppr", ".", "getClassNamePattern", "(", ")", "+", "\"'; aspectRule \"", "+", "aspectRule", ";", "if", "(", "pointcutPatternVerifiable", ")", "{", "log", ".", "error", "(", "msg", ")", ";", "}", "else", "{", "log", ".", "debug", "(", "msg", ")", ";", "}", "}", "if", "(", "ppr", ".", "getMethodNamePattern", "(", ")", "!=", "null", "&&", "ppr", ".", "getMatchedMethodCount", "(", ")", "==", "0", ")", "{", "invalidPointcutPatterns", "++", ";", "String", "msg", "=", "\"No beans have methods matching to '^\"", "+", "ppr", ".", "getMethodNamePattern", "(", ")", "+", "\"'; aspectRule \"", "+", "aspectRule", ";", "if", "(", "pointcutPatternVerifiable", ")", "{", "log", ".", "error", "(", "msg", ")", ";", "}", "else", "{", "log", ".", "debug", "(", "msg", ")", ";", "}", "}", "}", "}", "}", "}", "if", "(", "invalidPointcutPatterns", ">", "0", ")", "{", "String", "msg", "=", "\"Invalid pointcut detected: \"", "+", "invalidPointcutPatterns", "+", "\"; Please check the logs for more information\"", ";", "if", "(", "pointcutPatternVerifiable", ")", "{", "log", ".", "error", "(", "msg", ")", ";", "throw", "new", "InvalidPointcutPatternException", "(", "msg", ")", ";", "}", "else", "{", "log", ".", "debug", "(", "msg", ")", ";", "}", "}", "}", "AspectAdviceRuleRegistry", "sessionScopeAarr", "=", "sessionScopeAspectAdviceRulePostRegister", ".", "getAspectAdviceRuleRegistry", "(", ")", ";", "if", "(", "sessionScopeAarr", "!=", "null", ")", "{", "aspectRuleRegistry", ".", "setSessionAspectAdviceRuleRegistry", "(", "sessionScopeAarr", ")", ";", "}", "}" ]
Initialize the aspect rule registry. @param assistant the context rule assistant
[ "Initialize", "the", "aspect", "rule", "registry", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/builder/AbstractActivityContextBuilder.java#L423-L504
142,651
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java
RedirectRule.getPath
public String getPath(Activity activity) { if (pathTokens != null && pathTokens.length > 0) { TokenEvaluator evaluator = new TokenExpression(activity); return evaluator.evaluateAsString(pathTokens); } else { return path; } }
java
public String getPath(Activity activity) { if (pathTokens != null && pathTokens.length > 0) { TokenEvaluator evaluator = new TokenExpression(activity); return evaluator.evaluateAsString(pathTokens); } else { return path; } }
[ "public", "String", "getPath", "(", "Activity", "activity", ")", "{", "if", "(", "pathTokens", "!=", "null", "&&", "pathTokens", ".", "length", ">", "0", ")", "{", "TokenEvaluator", "evaluator", "=", "new", "TokenExpression", "(", "activity", ")", ";", "return", "evaluator", ".", "evaluateAsString", "(", "pathTokens", ")", ";", "}", "else", "{", "return", "path", ";", "}", "}" ]
Gets the redirect path. @param activity the activity @return the redirect path
[ "Gets", "the", "redirect", "path", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java#L88-L95
142,652
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java
RedirectRule.setPath
public void setPath(String path) { this.path = path; List<Token> tokens = Tokenizer.tokenize(path, true); int tokenCount = 0; for (Token t : tokens) { if (t.getType() != TokenType.TEXT) { tokenCount++; } } if (tokenCount > 0) { this.pathTokens = tokens.toArray(new Token[0]); } else { this.pathTokens = null; } }
java
public void setPath(String path) { this.path = path; List<Token> tokens = Tokenizer.tokenize(path, true); int tokenCount = 0; for (Token t : tokens) { if (t.getType() != TokenType.TEXT) { tokenCount++; } } if (tokenCount > 0) { this.pathTokens = tokens.toArray(new Token[0]); } else { this.pathTokens = null; } }
[ "public", "void", "setPath", "(", "String", "path", ")", "{", "this", ".", "path", "=", "path", ";", "List", "<", "Token", ">", "tokens", "=", "Tokenizer", ".", "tokenize", "(", "path", ",", "true", ")", ";", "int", "tokenCount", "=", "0", ";", "for", "(", "Token", "t", ":", "tokens", ")", "{", "if", "(", "t", ".", "getType", "(", ")", "!=", "TokenType", ".", "TEXT", ")", "{", "tokenCount", "++", ";", "}", "}", "if", "(", "tokenCount", ">", "0", ")", "{", "this", ".", "pathTokens", "=", "tokens", ".", "toArray", "(", "new", "Token", "[", "0", "]", ")", ";", "}", "else", "{", "this", ".", "pathTokens", "=", "null", ";", "}", "}" ]
Sets the redirect path. @param path the redirect path
[ "Sets", "the", "redirect", "path", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java#L102-L117
142,653
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java
RedirectRule.newParameterItemRule
public ItemRule newParameterItemRule(String parameterName) { ItemRule itemRule = new ItemRule(); itemRule.setName(parameterName); addParameterItemRule(itemRule); return itemRule; }
java
public ItemRule newParameterItemRule(String parameterName) { ItemRule itemRule = new ItemRule(); itemRule.setName(parameterName); addParameterItemRule(itemRule); return itemRule; }
[ "public", "ItemRule", "newParameterItemRule", "(", "String", "parameterName", ")", "{", "ItemRule", "itemRule", "=", "new", "ItemRule", "(", ")", ";", "itemRule", ".", "setName", "(", "parameterName", ")", ";", "addParameterItemRule", "(", "itemRule", ")", ";", "return", "itemRule", ";", "}" ]
Adds a new parameter rule with the specified name and returns it. @param parameterName the parameter name @return the parameter item rule
[ "Adds", "a", "new", "parameter", "rule", "with", "the", "specified", "name", "and", "returns", "it", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java#L229-L234
142,654
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java
RedirectRule.addParameterItemRule
public void addParameterItemRule(ItemRule parameterItemRule) { if (parameterItemRuleMap == null) { parameterItemRuleMap = new ItemRuleMap(); } parameterItemRuleMap.putItemRule(parameterItemRule); }
java
public void addParameterItemRule(ItemRule parameterItemRule) { if (parameterItemRuleMap == null) { parameterItemRuleMap = new ItemRuleMap(); } parameterItemRuleMap.putItemRule(parameterItemRule); }
[ "public", "void", "addParameterItemRule", "(", "ItemRule", "parameterItemRule", ")", "{", "if", "(", "parameterItemRuleMap", "==", "null", ")", "{", "parameterItemRuleMap", "=", "new", "ItemRuleMap", "(", ")", ";", "}", "parameterItemRuleMap", ".", "putItemRule", "(", "parameterItemRule", ")", ";", "}" ]
Adds the parameter item rule. @param parameterItemRule the parameter item rule
[ "Adds", "the", "parameter", "item", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java#L241-L246
142,655
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java
RedirectRule.setParameters
public void setParameters(Map<String, String> parameters) { if (parameters == null || parameters.isEmpty()) { this.parameterItemRuleMap = null; } else { ItemRuleMap itemRuleMap = new ItemRuleMap(); for (Map.Entry<String, String> entry : parameters.entrySet()) { ItemRule ir = new ItemRule(); ir.setTokenize(false); ir.setName(entry.getKey()); ir.setValue(entry.getValue()); itemRuleMap.putItemRule(ir); } this.parameterItemRuleMap = itemRuleMap; } }
java
public void setParameters(Map<String, String> parameters) { if (parameters == null || parameters.isEmpty()) { this.parameterItemRuleMap = null; } else { ItemRuleMap itemRuleMap = new ItemRuleMap(); for (Map.Entry<String, String> entry : parameters.entrySet()) { ItemRule ir = new ItemRule(); ir.setTokenize(false); ir.setName(entry.getKey()); ir.setValue(entry.getValue()); itemRuleMap.putItemRule(ir); } this.parameterItemRuleMap = itemRuleMap; } }
[ "public", "void", "setParameters", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "if", "(", "parameters", "==", "null", "||", "parameters", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "parameterItemRuleMap", "=", "null", ";", "}", "else", "{", "ItemRuleMap", "itemRuleMap", "=", "new", "ItemRuleMap", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "parameters", ".", "entrySet", "(", ")", ")", "{", "ItemRule", "ir", "=", "new", "ItemRule", "(", ")", ";", "ir", ".", "setTokenize", "(", "false", ")", ";", "ir", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "ir", ".", "setValue", "(", "entry", ".", "getValue", "(", ")", ")", ";", "itemRuleMap", ".", "putItemRule", "(", "ir", ")", ";", "}", "this", ".", "parameterItemRuleMap", "=", "itemRuleMap", ";", "}", "}" ]
Sets the parameter map. @param parameters the parameter map
[ "Sets", "the", "parameter", "map", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/RedirectRule.java#L253-L267
142,656
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/MessageSourceSupport.java
MessageSourceSupport.formatMessage
protected String formatMessage(String msg, Object[] args, Locale locale) { if (msg == null || (!this.alwaysUseMessageFormat && (args == null || args.length == 0))) { return msg; } MessageFormat messageFormat = null; synchronized (this.messageFormatsPerMessage) { Map<Locale, MessageFormat> messageFormatsPerLocale = this.messageFormatsPerMessage.get(msg); if (messageFormatsPerLocale != null) { messageFormat = messageFormatsPerLocale.get(locale); } else { messageFormatsPerLocale = new HashMap<>(); this.messageFormatsPerMessage.put(msg, messageFormatsPerLocale); } if (messageFormat == null) { try { messageFormat = createMessageFormat(msg, locale); } catch (IllegalArgumentException ex) { // invalid message format - probably not intended for formatting, // rather using a message structure with no arguments involved if (this.alwaysUseMessageFormat) { throw ex; } // silently proceed with raw message if format not enforced messageFormat = INVALID_MESSAGE_FORMAT; } messageFormatsPerLocale.put(locale, messageFormat); } } if (messageFormat == INVALID_MESSAGE_FORMAT) { return msg; } synchronized (messageFormat) { return messageFormat.format(args); } }
java
protected String formatMessage(String msg, Object[] args, Locale locale) { if (msg == null || (!this.alwaysUseMessageFormat && (args == null || args.length == 0))) { return msg; } MessageFormat messageFormat = null; synchronized (this.messageFormatsPerMessage) { Map<Locale, MessageFormat> messageFormatsPerLocale = this.messageFormatsPerMessage.get(msg); if (messageFormatsPerLocale != null) { messageFormat = messageFormatsPerLocale.get(locale); } else { messageFormatsPerLocale = new HashMap<>(); this.messageFormatsPerMessage.put(msg, messageFormatsPerLocale); } if (messageFormat == null) { try { messageFormat = createMessageFormat(msg, locale); } catch (IllegalArgumentException ex) { // invalid message format - probably not intended for formatting, // rather using a message structure with no arguments involved if (this.alwaysUseMessageFormat) { throw ex; } // silently proceed with raw message if format not enforced messageFormat = INVALID_MESSAGE_FORMAT; } messageFormatsPerLocale.put(locale, messageFormat); } } if (messageFormat == INVALID_MESSAGE_FORMAT) { return msg; } synchronized (messageFormat) { return messageFormat.format(args); } }
[ "protected", "String", "formatMessage", "(", "String", "msg", ",", "Object", "[", "]", "args", ",", "Locale", "locale", ")", "{", "if", "(", "msg", "==", "null", "||", "(", "!", "this", ".", "alwaysUseMessageFormat", "&&", "(", "args", "==", "null", "||", "args", ".", "length", "==", "0", ")", ")", ")", "{", "return", "msg", ";", "}", "MessageFormat", "messageFormat", "=", "null", ";", "synchronized", "(", "this", ".", "messageFormatsPerMessage", ")", "{", "Map", "<", "Locale", ",", "MessageFormat", ">", "messageFormatsPerLocale", "=", "this", ".", "messageFormatsPerMessage", ".", "get", "(", "msg", ")", ";", "if", "(", "messageFormatsPerLocale", "!=", "null", ")", "{", "messageFormat", "=", "messageFormatsPerLocale", ".", "get", "(", "locale", ")", ";", "}", "else", "{", "messageFormatsPerLocale", "=", "new", "HashMap", "<>", "(", ")", ";", "this", ".", "messageFormatsPerMessage", ".", "put", "(", "msg", ",", "messageFormatsPerLocale", ")", ";", "}", "if", "(", "messageFormat", "==", "null", ")", "{", "try", "{", "messageFormat", "=", "createMessageFormat", "(", "msg", ",", "locale", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "// invalid message format - probably not intended for formatting,", "// rather using a message structure with no arguments involved", "if", "(", "this", ".", "alwaysUseMessageFormat", ")", "{", "throw", "ex", ";", "}", "// silently proceed with raw message if format not enforced", "messageFormat", "=", "INVALID_MESSAGE_FORMAT", ";", "}", "messageFormatsPerLocale", ".", "put", "(", "locale", ",", "messageFormat", ")", ";", "}", "}", "if", "(", "messageFormat", "==", "INVALID_MESSAGE_FORMAT", ")", "{", "return", "msg", ";", "}", "synchronized", "(", "messageFormat", ")", "{", "return", "messageFormat", ".", "format", "(", "args", ")", ";", "}", "}" ]
Format the given message String, using cached MessageFormats. By default invoked for passed-in default messages, to resolve any argument placeholders found in them. @param msg the message to format @param args array of arguments that will be filled in for params within the message, or {@code null} if none @param locale the Locale used for formatting @return the formatted message (with resolved arguments)
[ "Format", "the", "given", "message", "String", "using", "cached", "MessageFormats", ".", "By", "default", "invoked", "for", "passed", "-", "in", "default", "messages", "to", "resolve", "any", "argument", "placeholders", "found", "in", "them", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/MessageSourceSupport.java#L112-L146
142,657
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/MessageSourceSupport.java
MessageSourceSupport.createMessageFormat
protected MessageFormat createMessageFormat(String msg, Locale locale) { return new MessageFormat((msg != null ? msg : ""), locale); }
java
protected MessageFormat createMessageFormat(String msg, Locale locale) { return new MessageFormat((msg != null ? msg : ""), locale); }
[ "protected", "MessageFormat", "createMessageFormat", "(", "String", "msg", ",", "Locale", "locale", ")", "{", "return", "new", "MessageFormat", "(", "(", "msg", "!=", "null", "?", "msg", ":", "\"\"", ")", ",", "locale", ")", ";", "}" ]
Create a MessageFormat for the given message and Locale. @param msg the message to create a MessageFormat for @param locale the Locale to create a MessageFormat for @return the MessageFormat instance
[ "Create", "a", "MessageFormat", "for", "the", "given", "message", "and", "Locale", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/MessageSourceSupport.java#L155-L157
142,658
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ClassUtils.java
ClassUtils.createInstance
public static <T> T createInstance(Class<T> cls) { Constructor<T> ctor; try { ctor = findConstructor(cls); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Class " + cls.getName() + " has no default (no arg) constructor"); } try { return ctor.newInstance(); } catch (Exception e) { ExceptionUtils.unwrapAndThrowAsIAE(e, "Unable to instantiate class " + cls.getName() + ": " + e.getMessage()); throw new IllegalArgumentException(e); } }
java
public static <T> T createInstance(Class<T> cls) { Constructor<T> ctor; try { ctor = findConstructor(cls); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Class " + cls.getName() + " has no default (no arg) constructor"); } try { return ctor.newInstance(); } catch (Exception e) { ExceptionUtils.unwrapAndThrowAsIAE(e, "Unable to instantiate class " + cls.getName() + ": " + e.getMessage()); throw new IllegalArgumentException(e); } }
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "Class", "<", "T", ">", "cls", ")", "{", "Constructor", "<", "T", ">", "ctor", ";", "try", "{", "ctor", "=", "findConstructor", "(", "cls", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Class \"", "+", "cls", ".", "getName", "(", ")", "+", "\" has no default (no arg) constructor\"", ")", ";", "}", "try", "{", "return", "ctor", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ExceptionUtils", ".", "unwrapAndThrowAsIAE", "(", "e", ",", "\"Unable to instantiate class \"", "+", "cls", ".", "getName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "}" ]
Method that can be called to try to create an instantiate of specified type. Instantiation is done using default no-argument constructor. @param <T> the generic type @param cls the class to check @return an instantiated object @throws IllegalArgumentException if instantiation fails for any reason; except for cases where constructor throws an unchecked exception (which will be passed as is)
[ "Method", "that", "can", "be", "called", "to", "try", "to", "create", "an", "instantiate", "of", "specified", "type", ".", "Instantiation", "is", "done", "using", "default", "no", "-", "argument", "constructor", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ClassUtils.java#L44-L59
142,659
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ClassUtils.java
ClassUtils.createInstance
public static <T> T createInstance(Class<T> cls, Object... args) { Class<?>[] argTypes = new Class<?>[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = args[i].getClass(); } return createInstance(cls, args, argTypes); }
java
public static <T> T createInstance(Class<T> cls, Object... args) { Class<?>[] argTypes = new Class<?>[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = args[i].getClass(); } return createInstance(cls, args, argTypes); }
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "Class", "<", "T", ">", "cls", ",", "Object", "...", "args", ")", "{", "Class", "<", "?", ">", "[", "]", "argTypes", "=", "new", "Class", "<", "?", ">", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "argTypes", "[", "i", "]", "=", "args", "[", "i", "]", ".", "getClass", "(", ")", ";", "}", "return", "createInstance", "(", "cls", ",", "args", ",", "argTypes", ")", ";", "}" ]
Method that can be called to try to create an instantiate of specified type. @param <T> the generic type @param cls the class to check @param args the arguments @return an instantiated object @throws IllegalArgumentException if instantiation fails for any reason; except for cases where constructor throws an unchecked exception (which will be passed as is)
[ "Method", "that", "can", "be", "called", "to", "try", "to", "create", "an", "instantiate", "of", "specified", "type", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ClassUtils.java#L73-L79
142,660
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ClassUtils.java
ClassUtils.findConstructor
public static <T> Constructor<T> findConstructor(Class<T> cls, Class<?>... argTypes) throws NoSuchMethodException { Constructor<T> ctor; try { ctor = cls.getDeclaredConstructor(argTypes); } catch (NoSuchMethodException e) { throw e; } catch (Exception e) { throw new IllegalArgumentException("Unable to find constructor of class " + cls.getName() + ", problem: " + e.getMessage(), ExceptionUtils.getRootCause(e)); } // must be public if (!Modifier.isPublic(ctor.getModifiers())) { throw new IllegalArgumentException("Constructor for " + cls.getName() + " is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type"); } return ctor; }
java
public static <T> Constructor<T> findConstructor(Class<T> cls, Class<?>... argTypes) throws NoSuchMethodException { Constructor<T> ctor; try { ctor = cls.getDeclaredConstructor(argTypes); } catch (NoSuchMethodException e) { throw e; } catch (Exception e) { throw new IllegalArgumentException("Unable to find constructor of class " + cls.getName() + ", problem: " + e.getMessage(), ExceptionUtils.getRootCause(e)); } // must be public if (!Modifier.isPublic(ctor.getModifiers())) { throw new IllegalArgumentException("Constructor for " + cls.getName() + " is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type"); } return ctor; }
[ "public", "static", "<", "T", ">", "Constructor", "<", "T", ">", "findConstructor", "(", "Class", "<", "T", ">", "cls", ",", "Class", "<", "?", ">", "...", "argTypes", ")", "throws", "NoSuchMethodException", "{", "Constructor", "<", "T", ">", "ctor", ";", "try", "{", "ctor", "=", "cls", ".", "getDeclaredConstructor", "(", "argTypes", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unable to find constructor of class \"", "+", "cls", ".", "getName", "(", ")", "+", "\", problem: \"", "+", "e", ".", "getMessage", "(", ")", ",", "ExceptionUtils", ".", "getRootCause", "(", "e", ")", ")", ";", "}", "// must be public", "if", "(", "!", "Modifier", ".", "isPublic", "(", "ctor", ".", "getModifiers", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Constructor for \"", "+", "cls", ".", "getName", "(", ")", "+", "\" is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type\"", ")", ";", "}", "return", "ctor", ";", "}" ]
Obtain an accessible constructor for the given class and parameters. @param cls the class to check @param argTypes the argument types of the desired constructor @param <T> the generic type @return the constructor reference @throws NoSuchMethodException if no such constructor exists
[ "Obtain", "an", "accessible", "constructor", "for", "the", "given", "class", "and", "parameters", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ClassUtils.java#L120-L137
142,661
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ClassUtils.java
ClassUtils.isLoadable
private static boolean isLoadable(Class<?> clazz, ClassLoader classLoader) { try { return (clazz == classLoader.loadClass(clazz.getName())); // Else: different class with same name found } catch (ClassNotFoundException ex) { // No corresponding class found at all return false; } }
java
private static boolean isLoadable(Class<?> clazz, ClassLoader classLoader) { try { return (clazz == classLoader.loadClass(clazz.getName())); // Else: different class with same name found } catch (ClassNotFoundException ex) { // No corresponding class found at all return false; } }
[ "private", "static", "boolean", "isLoadable", "(", "Class", "<", "?", ">", "clazz", ",", "ClassLoader", "classLoader", ")", "{", "try", "{", "return", "(", "clazz", "==", "classLoader", ".", "loadClass", "(", "clazz", ".", "getName", "(", ")", ")", ")", ";", "// Else: different class with same name found", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "// No corresponding class found at all", "return", "false", ";", "}", "}" ]
Check whether the given class is loadable in the given ClassLoader. @param clazz the class to check (typically an interface) @param classLoader the ClassLoader to check against @return true if the given class is loadable; otherwise false @since 6.0.0
[ "Check", "whether", "the", "given", "class", "is", "loadable", "in", "the", "given", "ClassLoader", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ClassUtils.java#L172-L180
142,662
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.invokeExactStaticMethod
public static Object invokeExactStaticMethod(Class<?> objectClass, String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return invokeExactStaticMethod(objectClass, methodName, EMPTY_OBJECT_ARRAY, EMPTY_CLASS_PARAMETERS); }
java
public static Object invokeExactStaticMethod(Class<?> objectClass, String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return invokeExactStaticMethod(objectClass, methodName, EMPTY_OBJECT_ARRAY, EMPTY_CLASS_PARAMETERS); }
[ "public", "static", "Object", "invokeExactStaticMethod", "(", "Class", "<", "?", ">", "objectClass", ",", "String", "methodName", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "return", "invokeExactStaticMethod", "(", "objectClass", ",", "methodName", ",", "EMPTY_OBJECT_ARRAY", ",", "EMPTY_CLASS_PARAMETERS", ")", ";", "}" ]
Invoke a static method that has no parameters. @param objectClass invoke static method on this class @param methodName get method with this name @return the value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection
[ "Invoke", "a", "static", "method", "that", "has", "no", "parameters", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L518-L521
142,663
aspectran/aspectran
web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFormDataParser.java
CommonsMultipartFormDataParser.createRequestContext
private RequestContext createRequestContext(final HttpServletRequest req) { return new RequestContext() { @Override public String getCharacterEncoding() { return req.getCharacterEncoding(); } @Override public String getContentType() { return req.getContentType(); } @Override @Deprecated public int getContentLength() { return req.getContentLength(); } @Override public InputStream getInputStream() throws IOException { return req.getInputStream(); } }; }
java
private RequestContext createRequestContext(final HttpServletRequest req) { return new RequestContext() { @Override public String getCharacterEncoding() { return req.getCharacterEncoding(); } @Override public String getContentType() { return req.getContentType(); } @Override @Deprecated public int getContentLength() { return req.getContentLength(); } @Override public InputStream getInputStream() throws IOException { return req.getInputStream(); } }; }
[ "private", "RequestContext", "createRequestContext", "(", "final", "HttpServletRequest", "req", ")", "{", "return", "new", "RequestContext", "(", ")", "{", "@", "Override", "public", "String", "getCharacterEncoding", "(", ")", "{", "return", "req", ".", "getCharacterEncoding", "(", ")", ";", "}", "@", "Override", "public", "String", "getContentType", "(", ")", "{", "return", "req", ".", "getContentType", "(", ")", ";", "}", "@", "Override", "@", "Deprecated", "public", "int", "getContentLength", "(", ")", "{", "return", "req", ".", "getContentLength", "(", ")", ";", "}", "@", "Override", "public", "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "return", "req", ".", "getInputStream", "(", ")", ";", "}", "}", ";", "}" ]
Creates a RequestContext needed by Jakarta Commons Upload. @param req the HTTP request @return a new request context
[ "Creates", "a", "RequestContext", "needed", "by", "Jakarta", "Commons", "Upload", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/support/multipart/commons/CommonsMultipartFormDataParser.java#L244-L267
142,664
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/wildcard/WildcardMatcher.java
WildcardMatcher.matches
public boolean matches(CharSequence input) { separatorCount = -1; separatorIndex = 0; if (input == null) { this.input = null; separatorFlags = null; return false; } this.input = input; separatorFlags = new int[input.length()]; boolean result = matches(pattern, input, separatorFlags); if (result) { for (int i = separatorFlags.length - 1; i >= 0; i--) { if (separatorFlags[i] > 0) { separatorCount = separatorFlags[i]; break; } } } return result; }
java
public boolean matches(CharSequence input) { separatorCount = -1; separatorIndex = 0; if (input == null) { this.input = null; separatorFlags = null; return false; } this.input = input; separatorFlags = new int[input.length()]; boolean result = matches(pattern, input, separatorFlags); if (result) { for (int i = separatorFlags.length - 1; i >= 0; i--) { if (separatorFlags[i] > 0) { separatorCount = separatorFlags[i]; break; } } } return result; }
[ "public", "boolean", "matches", "(", "CharSequence", "input", ")", "{", "separatorCount", "=", "-", "1", ";", "separatorIndex", "=", "0", ";", "if", "(", "input", "==", "null", ")", "{", "this", ".", "input", "=", "null", ";", "separatorFlags", "=", "null", ";", "return", "false", ";", "}", "this", ".", "input", "=", "input", ";", "separatorFlags", "=", "new", "int", "[", "input", ".", "length", "(", ")", "]", ";", "boolean", "result", "=", "matches", "(", "pattern", ",", "input", ",", "separatorFlags", ")", ";", "if", "(", "result", ")", "{", "for", "(", "int", "i", "=", "separatorFlags", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "separatorFlags", "[", "i", "]", ">", "0", ")", "{", "separatorCount", "=", "separatorFlags", "[", "i", "]", ";", "break", ";", "}", "}", "}", "return", "result", ";", "}" ]
Checks whether a string matches a given wildcard pattern. @param input the input string @return {@code true} if string matches the pattern, otherwise {@code false}
[ "Checks", "whether", "a", "string", "matches", "a", "given", "wildcard", "pattern", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/wildcard/WildcardMatcher.java#L45-L70
142,665
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/env/AbstractEnvironment.java
AbstractEnvironment.isProfileActive
private boolean isProfileActive(String profile) { validateProfile(profile); Set<String> currentActiveProfiles = doGetActiveProfiles(); return (currentActiveProfiles.contains(profile) || (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile))); }
java
private boolean isProfileActive(String profile) { validateProfile(profile); Set<String> currentActiveProfiles = doGetActiveProfiles(); return (currentActiveProfiles.contains(profile) || (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile))); }
[ "private", "boolean", "isProfileActive", "(", "String", "profile", ")", "{", "validateProfile", "(", "profile", ")", ";", "Set", "<", "String", ">", "currentActiveProfiles", "=", "doGetActiveProfiles", "(", ")", ";", "return", "(", "currentActiveProfiles", ".", "contains", "(", "profile", ")", "||", "(", "currentActiveProfiles", ".", "isEmpty", "(", ")", "&&", "doGetDefaultProfiles", "(", ")", ".", "contains", "(", "profile", ")", ")", ")", ";", "}" ]
Returns whether the given profile is active, or if active profiles are empty whether the profile should be active by default. @throws IllegalArgumentException per {@link #validateProfile(String)}
[ "Returns", "whether", "the", "given", "profile", "is", "active", "or", "if", "active", "profiles", "are", "empty", "whether", "the", "profile", "should", "be", "active", "by", "default", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/env/AbstractEnvironment.java#L183-L188
142,666
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/json/JsonWriter.java
JsonWriter.indent
protected void indent() throws IOException { if (prettyPrint) { for (int i = 0; i < indentDepth; i++) { writer.write(indentString); } } }
java
protected void indent() throws IOException { if (prettyPrint) { for (int i = 0; i < indentDepth; i++) { writer.write(indentString); } } }
[ "protected", "void", "indent", "(", ")", "throws", "IOException", "{", "if", "(", "prettyPrint", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indentDepth", ";", "i", "++", ")", "{", "writer", ".", "write", "(", "indentString", ")", ";", "}", "}", "}" ]
Write a tab character to a character stream. @throws IOException if an I/O error has occurred
[ "Write", "a", "tab", "character", "to", "a", "character", "stream", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L221-L227
142,667
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/json/JsonWriter.java
JsonWriter.writeName
public JsonWriter writeName(String name) throws IOException { indent(); writer.write(escape(name)); writer.write(":"); if (prettyPrint) { writer.write(" "); } willWriteValue = true; return this; }
java
public JsonWriter writeName(String name) throws IOException { indent(); writer.write(escape(name)); writer.write(":"); if (prettyPrint) { writer.write(" "); } willWriteValue = true; return this; }
[ "public", "JsonWriter", "writeName", "(", "String", "name", ")", "throws", "IOException", "{", "indent", "(", ")", ";", "writer", ".", "write", "(", "escape", "(", "name", ")", ")", ";", "writer", ".", "write", "(", "\":\"", ")", ";", "if", "(", "prettyPrint", ")", "{", "writer", ".", "write", "(", "\" \"", ")", ";", "}", "willWriteValue", "=", "true", ";", "return", "this", ";", "}" ]
Writes a key name to a character stream. @param name the string to write to a character-output stream @return this JsonWriter @throws IOException if an I/O error has occurred
[ "Writes", "a", "key", "name", "to", "a", "character", "stream", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L236-L245
142,668
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/json/JsonWriter.java
JsonWriter.openSquareBracket
public JsonWriter openSquareBracket() throws IOException { if (!willWriteValue) { indent(); } writer.write("["); nextLine(); indentDepth++; willWriteValue = false; return this; }
java
public JsonWriter openSquareBracket() throws IOException { if (!willWriteValue) { indent(); } writer.write("["); nextLine(); indentDepth++; willWriteValue = false; return this; }
[ "public", "JsonWriter", "openSquareBracket", "(", ")", "throws", "IOException", "{", "if", "(", "!", "willWriteValue", ")", "{", "indent", "(", ")", ";", "}", "writer", ".", "write", "(", "\"[\"", ")", ";", "nextLine", "(", ")", ";", "indentDepth", "++", ";", "willWriteValue", "=", "false", ";", "return", "this", ";", "}" ]
Open a single square bracket. @return this JsonWriter @throws IOException if an I/O error has occurred
[ "Open", "a", "single", "square", "bracket", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L369-L378
142,669
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/json/JsonWriter.java
JsonWriter.stringify
public static String stringify(Object object, boolean prettyPrint) throws IOException { if (prettyPrint) { return stringify(object, DEFAULT_INDENT_STRING); } else { return stringify(object, null); } }
java
public static String stringify(Object object, boolean prettyPrint) throws IOException { if (prettyPrint) { return stringify(object, DEFAULT_INDENT_STRING); } else { return stringify(object, null); } }
[ "public", "static", "String", "stringify", "(", "Object", "object", ",", "boolean", "prettyPrint", ")", "throws", "IOException", "{", "if", "(", "prettyPrint", ")", "{", "return", "stringify", "(", "object", ",", "DEFAULT_INDENT_STRING", ")", ";", "}", "else", "{", "return", "stringify", "(", "object", ",", "null", ")", ";", "}", "}" ]
Converts an object to a JSON formatted string. If pretty-printing is enabled, includes spaces, tabs and new-lines to make the format more readable. The default indentation string is a tab character. @param object an object to convert to a JSON formatted string @param prettyPrint enables or disables pretty-printing @return the JSON formatted string @throws IOException if an I/O error has occurred
[ "Converts", "an", "object", "to", "a", "JSON", "formatted", "string", ".", "If", "pretty", "-", "printing", "is", "enabled", "includes", "spaces", "tabs", "and", "new", "-", "lines", "to", "make", "the", "format", "more", "readable", ".", "The", "default", "indentation", "string", "is", "a", "tab", "character", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L497-L503
142,670
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/json/JsonWriter.java
JsonWriter.stringify
public static String stringify(Object object, String indentString) throws IOException { if (object == null) { return null; } Writer out = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(out, indentString); jsonWriter.write(object); jsonWriter.close(); return out.toString(); }
java
public static String stringify(Object object, String indentString) throws IOException { if (object == null) { return null; } Writer out = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(out, indentString); jsonWriter.write(object); jsonWriter.close(); return out.toString(); }
[ "public", "static", "String", "stringify", "(", "Object", "object", ",", "String", "indentString", ")", "throws", "IOException", "{", "if", "(", "object", "==", "null", ")", "{", "return", "null", ";", "}", "Writer", "out", "=", "new", "StringWriter", "(", ")", ";", "JsonWriter", "jsonWriter", "=", "new", "JsonWriter", "(", "out", ",", "indentString", ")", ";", "jsonWriter", ".", "write", "(", "object", ")", ";", "jsonWriter", ".", "close", "(", ")", ";", "return", "out", ".", "toString", "(", ")", ";", "}" ]
Converts an object to a JSON formatted string. If pretty-printing is enabled, includes spaces, tabs and new-lines to make the format more readable. @param object an object to convert to a JSON formatted string @param indentString the string that should be used for indentation when pretty-printing is enabled @return the JSON formatted string @throws IOException if an I/O error has occurred
[ "Converts", "an", "object", "to", "a", "JSON", "formatted", "string", ".", "If", "pretty", "-", "printing", "is", "enabled", "includes", "spaces", "tabs", "and", "new", "-", "lines", "to", "make", "the", "format", "more", "readable", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L514-L523
142,671
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.putSetting
public void putSetting(String name, String value) throws IllegalRuleException { if (StringUtils.isEmpty(name)) { throw new IllegalRuleException("Default setting name can not be null"); } DefaultSettingType settingType = DefaultSettingType.resolve(name); if (settingType == null) { throw new IllegalRuleException("No such default setting name as '" + name + "'"); } settings.put(settingType, value); }
java
public void putSetting(String name, String value) throws IllegalRuleException { if (StringUtils.isEmpty(name)) { throw new IllegalRuleException("Default setting name can not be null"); } DefaultSettingType settingType = DefaultSettingType.resolve(name); if (settingType == null) { throw new IllegalRuleException("No such default setting name as '" + name + "'"); } settings.put(settingType, value); }
[ "public", "void", "putSetting", "(", "String", "name", ",", "String", "value", ")", "throws", "IllegalRuleException", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "name", ")", ")", "{", "throw", "new", "IllegalRuleException", "(", "\"Default setting name can not be null\"", ")", ";", "}", "DefaultSettingType", "settingType", "=", "DefaultSettingType", ".", "resolve", "(", "name", ")", ";", "if", "(", "settingType", "==", "null", ")", "{", "throw", "new", "IllegalRuleException", "(", "\"No such default setting name as '\"", "+", "name", "+", "\"'\"", ")", ";", "}", "settings", ".", "put", "(", "settingType", ",", "value", ")", ";", "}" ]
Puts the setting value. @param name the name @param value the value @throws IllegalRuleException if an unknown setting name is found
[ "Puts", "the", "setting", "value", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L199-L208
142,672
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveAliasType
public String resolveAliasType(String alias) { String type = getAliasedType(alias); return (type == null ? alias: type); }
java
public String resolveAliasType(String alias) { String type = getAliasedType(alias); return (type == null ? alias: type); }
[ "public", "String", "resolveAliasType", "(", "String", "alias", ")", "{", "String", "type", "=", "getAliasedType", "(", "alias", ")", ";", "return", "(", "type", "==", "null", "?", "alias", ":", "type", ")", ";", "}" ]
Returns a type of an aliased type that is defined by assigning the type to the alias. If aliased type is not found, it returns alias. @param alias the name of the alias @return the aliased type
[ "Returns", "a", "type", "of", "an", "aliased", "type", "that", "is", "defined", "by", "assigning", "the", "type", "to", "the", "alias", ".", "If", "aliased", "type", "is", "not", "found", "it", "returns", "alias", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L273-L276
142,673
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.setAssistantLocal
private void setAssistantLocal(AssistantLocal newAssistantLocal) { this.assistantLocal = newAssistantLocal; scheduleRuleRegistry.setAssistantLocal(newAssistantLocal); transletRuleRegistry.setAssistantLocal(newAssistantLocal); templateRuleRegistry.setAssistantLocal(newAssistantLocal); }
java
private void setAssistantLocal(AssistantLocal newAssistantLocal) { this.assistantLocal = newAssistantLocal; scheduleRuleRegistry.setAssistantLocal(newAssistantLocal); transletRuleRegistry.setAssistantLocal(newAssistantLocal); templateRuleRegistry.setAssistantLocal(newAssistantLocal); }
[ "private", "void", "setAssistantLocal", "(", "AssistantLocal", "newAssistantLocal", ")", "{", "this", ".", "assistantLocal", "=", "newAssistantLocal", ";", "scheduleRuleRegistry", ".", "setAssistantLocal", "(", "newAssistantLocal", ")", ";", "transletRuleRegistry", ".", "setAssistantLocal", "(", "newAssistantLocal", ")", ";", "templateRuleRegistry", ".", "setAssistantLocal", "(", "newAssistantLocal", ")", ";", "}" ]
Sets the assistant local. @param newAssistantLocal the new assistant local
[ "Sets", "the", "assistant", "local", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L305-L310
142,674
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.backupAssistantLocal
public AssistantLocal backupAssistantLocal() { AssistantLocal oldAssistantLocal = assistantLocal; AssistantLocal newAssistantLocal = assistantLocal.replicate(); setAssistantLocal(newAssistantLocal); return oldAssistantLocal; }
java
public AssistantLocal backupAssistantLocal() { AssistantLocal oldAssistantLocal = assistantLocal; AssistantLocal newAssistantLocal = assistantLocal.replicate(); setAssistantLocal(newAssistantLocal); return oldAssistantLocal; }
[ "public", "AssistantLocal", "backupAssistantLocal", "(", ")", "{", "AssistantLocal", "oldAssistantLocal", "=", "assistantLocal", ";", "AssistantLocal", "newAssistantLocal", "=", "assistantLocal", ".", "replicate", "(", ")", ";", "setAssistantLocal", "(", "newAssistantLocal", ")", ";", "return", "oldAssistantLocal", ";", "}" ]
Backup the assistant local. @return the assistant local
[ "Backup", "the", "assistant", "local", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L317-L322
142,675
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveAdviceBeanClass
public void resolveAdviceBeanClass(AspectRule aspectRule) throws IllegalRuleException { String beanIdOrClass = aspectRule.getAdviceBeanId(); if (beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, aspectRule); if (beanClass != null) { aspectRule.setAdviceBeanClass(beanClass); reserveBeanReference(beanClass, aspectRule); } else { reserveBeanReference(beanIdOrClass, aspectRule); } } }
java
public void resolveAdviceBeanClass(AspectRule aspectRule) throws IllegalRuleException { String beanIdOrClass = aspectRule.getAdviceBeanId(); if (beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, aspectRule); if (beanClass != null) { aspectRule.setAdviceBeanClass(beanClass); reserveBeanReference(beanClass, aspectRule); } else { reserveBeanReference(beanIdOrClass, aspectRule); } } }
[ "public", "void", "resolveAdviceBeanClass", "(", "AspectRule", "aspectRule", ")", "throws", "IllegalRuleException", "{", "String", "beanIdOrClass", "=", "aspectRule", ".", "getAdviceBeanId", "(", ")", ";", "if", "(", "beanIdOrClass", "!=", "null", ")", "{", "Class", "<", "?", ">", "beanClass", "=", "resolveBeanClass", "(", "beanIdOrClass", ",", "aspectRule", ")", ";", "if", "(", "beanClass", "!=", "null", ")", "{", "aspectRule", ".", "setAdviceBeanClass", "(", "beanClass", ")", ";", "reserveBeanReference", "(", "beanClass", ",", "aspectRule", ")", ";", "}", "else", "{", "reserveBeanReference", "(", "beanIdOrClass", ",", "aspectRule", ")", ";", "}", "}", "}" ]
Resolve bean class for the aspect rule. @param aspectRule the aspect rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "the", "aspect", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L349-L360
142,676
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveActionBeanClass
public void resolveActionBeanClass(BeanMethodActionRule beanMethodActionRule) throws IllegalRuleException { String beanIdOrClass = beanMethodActionRule.getBeanId(); if (beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanMethodActionRule); if (beanClass != null) { beanMethodActionRule.setBeanClass(beanClass); reserveBeanReference(beanClass, beanMethodActionRule); } else { reserveBeanReference(beanIdOrClass, beanMethodActionRule); } } }
java
public void resolveActionBeanClass(BeanMethodActionRule beanMethodActionRule) throws IllegalRuleException { String beanIdOrClass = beanMethodActionRule.getBeanId(); if (beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanMethodActionRule); if (beanClass != null) { beanMethodActionRule.setBeanClass(beanClass); reserveBeanReference(beanClass, beanMethodActionRule); } else { reserveBeanReference(beanIdOrClass, beanMethodActionRule); } } }
[ "public", "void", "resolveActionBeanClass", "(", "BeanMethodActionRule", "beanMethodActionRule", ")", "throws", "IllegalRuleException", "{", "String", "beanIdOrClass", "=", "beanMethodActionRule", ".", "getBeanId", "(", ")", ";", "if", "(", "beanIdOrClass", "!=", "null", ")", "{", "Class", "<", "?", ">", "beanClass", "=", "resolveBeanClass", "(", "beanIdOrClass", ",", "beanMethodActionRule", ")", ";", "if", "(", "beanClass", "!=", "null", ")", "{", "beanMethodActionRule", ".", "setBeanClass", "(", "beanClass", ")", ";", "reserveBeanReference", "(", "beanClass", ",", "beanMethodActionRule", ")", ";", "}", "else", "{", "reserveBeanReference", "(", "beanIdOrClass", ",", "beanMethodActionRule", ")", ";", "}", "}", "}" ]
Resolve bean class for bean method action rule. @param beanMethodActionRule the bean method action rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "bean", "method", "action", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L368-L379
142,677
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveFactoryBeanClass
public void resolveFactoryBeanClass(BeanRule beanRule) throws IllegalRuleException { String beanIdOrClass = beanRule.getFactoryBeanId(); if (beanRule.isFactoryOffered() && beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanRule); if (beanClass != null) { beanRule.setFactoryBeanClass(beanClass); reserveBeanReference(beanClass, beanRule); } else { reserveBeanReference(beanIdOrClass, beanRule); } } }
java
public void resolveFactoryBeanClass(BeanRule beanRule) throws IllegalRuleException { String beanIdOrClass = beanRule.getFactoryBeanId(); if (beanRule.isFactoryOffered() && beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanRule); if (beanClass != null) { beanRule.setFactoryBeanClass(beanClass); reserveBeanReference(beanClass, beanRule); } else { reserveBeanReference(beanIdOrClass, beanRule); } } }
[ "public", "void", "resolveFactoryBeanClass", "(", "BeanRule", "beanRule", ")", "throws", "IllegalRuleException", "{", "String", "beanIdOrClass", "=", "beanRule", ".", "getFactoryBeanId", "(", ")", ";", "if", "(", "beanRule", ".", "isFactoryOffered", "(", ")", "&&", "beanIdOrClass", "!=", "null", ")", "{", "Class", "<", "?", ">", "beanClass", "=", "resolveBeanClass", "(", "beanIdOrClass", ",", "beanRule", ")", ";", "if", "(", "beanClass", "!=", "null", ")", "{", "beanRule", ".", "setFactoryBeanClass", "(", "beanClass", ")", ";", "reserveBeanReference", "(", "beanClass", ",", "beanRule", ")", ";", "}", "else", "{", "reserveBeanReference", "(", "beanIdOrClass", ",", "beanRule", ")", ";", "}", "}", "}" ]
Resolve bean class for factory bean rule. @param beanRule the bean rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "factory", "bean", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L387-L398
142,678
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveBeanClass
public void resolveBeanClass(ItemRule itemRule) throws IllegalRuleException { Iterator<Token[]> it = ItemRule.tokenIterator(itemRule); if (it != null) { while (it.hasNext()) { Token[] tokens = it.next(); if (tokens != null) { for (Token token : tokens) { resolveBeanClass(token); } } } } }
java
public void resolveBeanClass(ItemRule itemRule) throws IllegalRuleException { Iterator<Token[]> it = ItemRule.tokenIterator(itemRule); if (it != null) { while (it.hasNext()) { Token[] tokens = it.next(); if (tokens != null) { for (Token token : tokens) { resolveBeanClass(token); } } } } }
[ "public", "void", "resolveBeanClass", "(", "ItemRule", "itemRule", ")", "throws", "IllegalRuleException", "{", "Iterator", "<", "Token", "[", "]", ">", "it", "=", "ItemRule", ".", "tokenIterator", "(", "itemRule", ")", ";", "if", "(", "it", "!=", "null", ")", "{", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Token", "[", "]", "tokens", "=", "it", ".", "next", "(", ")", ";", "if", "(", "tokens", "!=", "null", ")", "{", "for", "(", "Token", "token", ":", "tokens", ")", "{", "resolveBeanClass", "(", "token", ")", ";", "}", "}", "}", "}", "}" ]
Resolve bean class. @param itemRule the item rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L406-L418
142,679
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveBeanClass
public void resolveBeanClass(Token[] tokens) throws IllegalRuleException { if (tokens != null) { for (Token token : tokens) { resolveBeanClass(token); } } }
java
public void resolveBeanClass(Token[] tokens) throws IllegalRuleException { if (tokens != null) { for (Token token : tokens) { resolveBeanClass(token); } } }
[ "public", "void", "resolveBeanClass", "(", "Token", "[", "]", "tokens", ")", "throws", "IllegalRuleException", "{", "if", "(", "tokens", "!=", "null", ")", "{", "for", "(", "Token", "token", ":", "tokens", ")", "{", "resolveBeanClass", "(", "token", ")", ";", "}", "}", "}" ]
Resolve bean class for token. @param tokens an array of tokens @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "token", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L426-L432
142,680
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveBeanClass
public void resolveBeanClass(AutowireRule autowireRule) throws IllegalRuleException { if (autowireRule.getTargetType() == AutowireTargetType.FIELD) { if (autowireRule.isRequired()) { Class<?>[] types = autowireRule.getTypes(); String[] qualifiers = autowireRule.getQualifiers(); reserveBeanReference(qualifiers[0], types[0], autowireRule); } } else if (autowireRule.getTargetType() == AutowireTargetType.FIELD_VALUE) { Token token = autowireRule.getToken(); resolveBeanClass(token, autowireRule); } else if (autowireRule.getTargetType() == AutowireTargetType.METHOD || autowireRule.getTargetType() == AutowireTargetType.CONSTRUCTOR) { if (autowireRule.isRequired()) { Class<?>[] types = autowireRule.getTypes(); String[] qualifiers = autowireRule.getQualifiers(); for (int i = 0; i < types.length; i++) { reserveBeanReference(qualifiers[i], types[i], autowireRule); } } } }
java
public void resolveBeanClass(AutowireRule autowireRule) throws IllegalRuleException { if (autowireRule.getTargetType() == AutowireTargetType.FIELD) { if (autowireRule.isRequired()) { Class<?>[] types = autowireRule.getTypes(); String[] qualifiers = autowireRule.getQualifiers(); reserveBeanReference(qualifiers[0], types[0], autowireRule); } } else if (autowireRule.getTargetType() == AutowireTargetType.FIELD_VALUE) { Token token = autowireRule.getToken(); resolveBeanClass(token, autowireRule); } else if (autowireRule.getTargetType() == AutowireTargetType.METHOD || autowireRule.getTargetType() == AutowireTargetType.CONSTRUCTOR) { if (autowireRule.isRequired()) { Class<?>[] types = autowireRule.getTypes(); String[] qualifiers = autowireRule.getQualifiers(); for (int i = 0; i < types.length; i++) { reserveBeanReference(qualifiers[i], types[i], autowireRule); } } } }
[ "public", "void", "resolveBeanClass", "(", "AutowireRule", "autowireRule", ")", "throws", "IllegalRuleException", "{", "if", "(", "autowireRule", ".", "getTargetType", "(", ")", "==", "AutowireTargetType", ".", "FIELD", ")", "{", "if", "(", "autowireRule", ".", "isRequired", "(", ")", ")", "{", "Class", "<", "?", ">", "[", "]", "types", "=", "autowireRule", ".", "getTypes", "(", ")", ";", "String", "[", "]", "qualifiers", "=", "autowireRule", ".", "getQualifiers", "(", ")", ";", "reserveBeanReference", "(", "qualifiers", "[", "0", "]", ",", "types", "[", "0", "]", ",", "autowireRule", ")", ";", "}", "}", "else", "if", "(", "autowireRule", ".", "getTargetType", "(", ")", "==", "AutowireTargetType", ".", "FIELD_VALUE", ")", "{", "Token", "token", "=", "autowireRule", ".", "getToken", "(", ")", ";", "resolveBeanClass", "(", "token", ",", "autowireRule", ")", ";", "}", "else", "if", "(", "autowireRule", ".", "getTargetType", "(", ")", "==", "AutowireTargetType", ".", "METHOD", "||", "autowireRule", ".", "getTargetType", "(", ")", "==", "AutowireTargetType", ".", "CONSTRUCTOR", ")", "{", "if", "(", "autowireRule", ".", "isRequired", "(", ")", ")", "{", "Class", "<", "?", ">", "[", "]", "types", "=", "autowireRule", ".", "getTypes", "(", ")", ";", "String", "[", "]", "qualifiers", "=", "autowireRule", ".", "getQualifiers", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "reserveBeanReference", "(", "qualifiers", "[", "i", "]", ",", "types", "[", "i", "]", ",", "autowireRule", ")", ";", "}", "}", "}", "}" ]
Resolve bean class for the autowire rule. @param autowireRule the autowire rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "the", "autowire", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L492-L512
142,681
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveBeanClass
public void resolveBeanClass(ScheduleRule scheduleRule) throws IllegalRuleException { String beanId = scheduleRule.getSchedulerBeanId(); if (beanId != null) { Class<?> beanClass = resolveBeanClass(beanId, scheduleRule); if (beanClass != null) { scheduleRule.setSchedulerBeanClass(beanClass); reserveBeanReference(beanClass, scheduleRule); } else { reserveBeanReference(beanId, scheduleRule); } } }
java
public void resolveBeanClass(ScheduleRule scheduleRule) throws IllegalRuleException { String beanId = scheduleRule.getSchedulerBeanId(); if (beanId != null) { Class<?> beanClass = resolveBeanClass(beanId, scheduleRule); if (beanClass != null) { scheduleRule.setSchedulerBeanClass(beanClass); reserveBeanReference(beanClass, scheduleRule); } else { reserveBeanReference(beanId, scheduleRule); } } }
[ "public", "void", "resolveBeanClass", "(", "ScheduleRule", "scheduleRule", ")", "throws", "IllegalRuleException", "{", "String", "beanId", "=", "scheduleRule", ".", "getSchedulerBeanId", "(", ")", ";", "if", "(", "beanId", "!=", "null", ")", "{", "Class", "<", "?", ">", "beanClass", "=", "resolveBeanClass", "(", "beanId", ",", "scheduleRule", ")", ";", "if", "(", "beanClass", "!=", "null", ")", "{", "scheduleRule", ".", "setSchedulerBeanClass", "(", "beanClass", ")", ";", "reserveBeanReference", "(", "beanClass", ",", "scheduleRule", ")", ";", "}", "else", "{", "reserveBeanReference", "(", "beanId", ",", "scheduleRule", ")", ";", "}", "}", "}" ]
Resolve bean class for the schedule rule. @param scheduleRule the schedule rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "the", "schedule", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L520-L531
142,682
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.resolveBeanClass
public void resolveBeanClass(TemplateRule templateRule) throws IllegalRuleException { String beanId = templateRule.getEngineBeanId(); if (beanId != null) { Class<?> beanClass = resolveBeanClass(beanId, templateRule); if (beanClass != null) { templateRule.setEngineBeanClass(beanClass); reserveBeanReference(beanClass, templateRule); } else { reserveBeanReference(beanId, templateRule); } } else { resolveBeanClass(templateRule.getTemplateTokens()); } }
java
public void resolveBeanClass(TemplateRule templateRule) throws IllegalRuleException { String beanId = templateRule.getEngineBeanId(); if (beanId != null) { Class<?> beanClass = resolveBeanClass(beanId, templateRule); if (beanClass != null) { templateRule.setEngineBeanClass(beanClass); reserveBeanReference(beanClass, templateRule); } else { reserveBeanReference(beanId, templateRule); } } else { resolveBeanClass(templateRule.getTemplateTokens()); } }
[ "public", "void", "resolveBeanClass", "(", "TemplateRule", "templateRule", ")", "throws", "IllegalRuleException", "{", "String", "beanId", "=", "templateRule", ".", "getEngineBeanId", "(", ")", ";", "if", "(", "beanId", "!=", "null", ")", "{", "Class", "<", "?", ">", "beanClass", "=", "resolveBeanClass", "(", "beanId", ",", "templateRule", ")", ";", "if", "(", "beanClass", "!=", "null", ")", "{", "templateRule", ".", "setEngineBeanClass", "(", "beanClass", ")", ";", "reserveBeanReference", "(", "beanClass", ",", "templateRule", ")", ";", "}", "else", "{", "reserveBeanReference", "(", "beanId", ",", "templateRule", ")", ";", "}", "}", "else", "{", "resolveBeanClass", "(", "templateRule", ".", "getTemplateTokens", "(", ")", ")", ";", "}", "}" ]
Resolve bean class for the template rule. @param templateRule the template rule @throws IllegalRuleException if an illegal rule is found
[ "Resolve", "bean", "class", "for", "the", "template", "rule", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L539-L552
142,683
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java
ContextRuleAssistant.getBeanRules
public Collection<BeanRule> getBeanRules() { Collection<BeanRule> idBasedBeanRules = beanRuleRegistry.getIdBasedBeanRules(); Collection<Set<BeanRule>> typeBasedBeanRules = beanRuleRegistry.getTypeBasedBeanRules(); Collection<BeanRule> configurableBeanRules = beanRuleRegistry.getConfigurableBeanRules(); int capacity = idBasedBeanRules.size(); for (Set<BeanRule> brs : typeBasedBeanRules) { capacity += brs.size(); } capacity += configurableBeanRules.size(); capacity = (int)(capacity / 0.9f) + 1; Set<BeanRule> beanRuleSet = new HashSet<>(capacity, 0.9f); beanRuleSet.addAll(idBasedBeanRules); for (Set<BeanRule> brs : typeBasedBeanRules) { beanRuleSet.addAll(brs); } beanRuleSet.addAll(configurableBeanRules); return beanRuleSet; }
java
public Collection<BeanRule> getBeanRules() { Collection<BeanRule> idBasedBeanRules = beanRuleRegistry.getIdBasedBeanRules(); Collection<Set<BeanRule>> typeBasedBeanRules = beanRuleRegistry.getTypeBasedBeanRules(); Collection<BeanRule> configurableBeanRules = beanRuleRegistry.getConfigurableBeanRules(); int capacity = idBasedBeanRules.size(); for (Set<BeanRule> brs : typeBasedBeanRules) { capacity += brs.size(); } capacity += configurableBeanRules.size(); capacity = (int)(capacity / 0.9f) + 1; Set<BeanRule> beanRuleSet = new HashSet<>(capacity, 0.9f); beanRuleSet.addAll(idBasedBeanRules); for (Set<BeanRule> brs : typeBasedBeanRules) { beanRuleSet.addAll(brs); } beanRuleSet.addAll(configurableBeanRules); return beanRuleSet; }
[ "public", "Collection", "<", "BeanRule", ">", "getBeanRules", "(", ")", "{", "Collection", "<", "BeanRule", ">", "idBasedBeanRules", "=", "beanRuleRegistry", ".", "getIdBasedBeanRules", "(", ")", ";", "Collection", "<", "Set", "<", "BeanRule", ">", ">", "typeBasedBeanRules", "=", "beanRuleRegistry", ".", "getTypeBasedBeanRules", "(", ")", ";", "Collection", "<", "BeanRule", ">", "configurableBeanRules", "=", "beanRuleRegistry", ".", "getConfigurableBeanRules", "(", ")", ";", "int", "capacity", "=", "idBasedBeanRules", ".", "size", "(", ")", ";", "for", "(", "Set", "<", "BeanRule", ">", "brs", ":", "typeBasedBeanRules", ")", "{", "capacity", "+=", "brs", ".", "size", "(", ")", ";", "}", "capacity", "+=", "configurableBeanRules", ".", "size", "(", ")", ";", "capacity", "=", "(", "int", ")", "(", "capacity", "/", "0.9f", ")", "+", "1", ";", "Set", "<", "BeanRule", ">", "beanRuleSet", "=", "new", "HashSet", "<>", "(", "capacity", ",", "0.9f", ")", ";", "beanRuleSet", ".", "addAll", "(", "idBasedBeanRules", ")", ";", "for", "(", "Set", "<", "BeanRule", ">", "brs", ":", "typeBasedBeanRules", ")", "{", "beanRuleSet", ".", "addAll", "(", "brs", ")", ";", "}", "beanRuleSet", ".", "addAll", "(", "configurableBeanRules", ")", ";", "return", "beanRuleSet", ";", "}" ]
Returns all bean rules. @return the bean rules
[ "Returns", "all", "bean", "rules", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L702-L721
142,684
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java
ResourceBundleMessageSource.resolveCode
@Override protected MessageFormat resolveCode(String code, Locale locale) { MessageFormat messageFormat = null; for (int i = 0; messageFormat == null && i < this.basenames.length; i++) { ResourceBundle bundle = getResourceBundle(this.basenames[i], locale); if (bundle != null) { messageFormat = getMessageFormat(bundle, code, locale); } } return messageFormat; }
java
@Override protected MessageFormat resolveCode(String code, Locale locale) { MessageFormat messageFormat = null; for (int i = 0; messageFormat == null && i < this.basenames.length; i++) { ResourceBundle bundle = getResourceBundle(this.basenames[i], locale); if (bundle != null) { messageFormat = getMessageFormat(bundle, code, locale); } } return messageFormat; }
[ "@", "Override", "protected", "MessageFormat", "resolveCode", "(", "String", "code", ",", "Locale", "locale", ")", "{", "MessageFormat", "messageFormat", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "messageFormat", "==", "null", "&&", "i", "<", "this", ".", "basenames", ".", "length", ";", "i", "++", ")", "{", "ResourceBundle", "bundle", "=", "getResourceBundle", "(", "this", ".", "basenames", "[", "i", "]", ",", "locale", ")", ";", "if", "(", "bundle", "!=", "null", ")", "{", "messageFormat", "=", "getMessageFormat", "(", "bundle", ",", "code", ",", "locale", ")", ";", "}", "}", "return", "messageFormat", ";", "}" ]
Resolves the given message code as key in the registered resource bundles, using a cached MessageFormat instance per message code.
[ "Resolves", "the", "given", "message", "code", "as", "key", "in", "the", "registered", "resource", "bundles", "using", "a", "cached", "MessageFormat", "instance", "per", "message", "code", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java#L228-L238
142,685
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java
ResourceBundleMessageSource.getResourceBundle
protected ResourceBundle getResourceBundle(String basename, Locale locale) { if (this.cacheMillis >= 0) { // Fresh ResourceBundle.getBundle call in order to let ResourceBundle // do its native caching, at the expense of more extensive lookup steps. return doGetBundle(basename, locale); } else { // Cache forever: prefer locale cache over repeated getBundle calls. Map<Locale, ResourceBundle> localeMap = this.cachedResourceBundles.get(basename); if (localeMap != null) { ResourceBundle bundle = localeMap.get(locale); if (bundle != null) { return bundle; } } try { ResourceBundle bundle = doGetBundle(basename, locale); if (localeMap == null) { localeMap = new ConcurrentHashMap<>(); Map<Locale, ResourceBundle> existing = this.cachedResourceBundles.putIfAbsent(basename, localeMap); if (existing != null) { localeMap = existing; } } localeMap.put(locale, bundle); return bundle; } catch (MissingResourceException ex) { log.warn("ResourceBundle [" + basename + "] not found for MessageSource: " + ex.getMessage()); // Assume bundle not found // -> do NOT throw the exception to allow for checking parent message source. return null; } } }
java
protected ResourceBundle getResourceBundle(String basename, Locale locale) { if (this.cacheMillis >= 0) { // Fresh ResourceBundle.getBundle call in order to let ResourceBundle // do its native caching, at the expense of more extensive lookup steps. return doGetBundle(basename, locale); } else { // Cache forever: prefer locale cache over repeated getBundle calls. Map<Locale, ResourceBundle> localeMap = this.cachedResourceBundles.get(basename); if (localeMap != null) { ResourceBundle bundle = localeMap.get(locale); if (bundle != null) { return bundle; } } try { ResourceBundle bundle = doGetBundle(basename, locale); if (localeMap == null) { localeMap = new ConcurrentHashMap<>(); Map<Locale, ResourceBundle> existing = this.cachedResourceBundles.putIfAbsent(basename, localeMap); if (existing != null) { localeMap = existing; } } localeMap.put(locale, bundle); return bundle; } catch (MissingResourceException ex) { log.warn("ResourceBundle [" + basename + "] not found for MessageSource: " + ex.getMessage()); // Assume bundle not found // -> do NOT throw the exception to allow for checking parent message source. return null; } } }
[ "protected", "ResourceBundle", "getResourceBundle", "(", "String", "basename", ",", "Locale", "locale", ")", "{", "if", "(", "this", ".", "cacheMillis", ">=", "0", ")", "{", "// Fresh ResourceBundle.getBundle call in order to let ResourceBundle", "// do its native caching, at the expense of more extensive lookup steps.", "return", "doGetBundle", "(", "basename", ",", "locale", ")", ";", "}", "else", "{", "// Cache forever: prefer locale cache over repeated getBundle calls.", "Map", "<", "Locale", ",", "ResourceBundle", ">", "localeMap", "=", "this", ".", "cachedResourceBundles", ".", "get", "(", "basename", ")", ";", "if", "(", "localeMap", "!=", "null", ")", "{", "ResourceBundle", "bundle", "=", "localeMap", ".", "get", "(", "locale", ")", ";", "if", "(", "bundle", "!=", "null", ")", "{", "return", "bundle", ";", "}", "}", "try", "{", "ResourceBundle", "bundle", "=", "doGetBundle", "(", "basename", ",", "locale", ")", ";", "if", "(", "localeMap", "==", "null", ")", "{", "localeMap", "=", "new", "ConcurrentHashMap", "<>", "(", ")", ";", "Map", "<", "Locale", ",", "ResourceBundle", ">", "existing", "=", "this", ".", "cachedResourceBundles", ".", "putIfAbsent", "(", "basename", ",", "localeMap", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "localeMap", "=", "existing", ";", "}", "}", "localeMap", ".", "put", "(", "locale", ",", "bundle", ")", ";", "return", "bundle", ";", "}", "catch", "(", "MissingResourceException", "ex", ")", "{", "log", ".", "warn", "(", "\"ResourceBundle [\"", "+", "basename", "+", "\"] not found for MessageSource: \"", "+", "ex", ".", "getMessage", "(", ")", ")", ";", "// Assume bundle not found", "// -> do NOT throw the exception to allow for checking parent message source.", "return", "null", ";", "}", "}", "}" ]
Return a ResourceBundle for the given basename and code, fetching already generated MessageFormats from the cache. @param basename the basename of the ResourceBundle @param locale the Locale to find the ResourceBundle for @return the resulting ResourceBundle, or {@code null} if none found for the given basename and Locale
[ "Return", "a", "ResourceBundle", "for", "the", "given", "basename", "and", "code", "fetching", "already", "generated", "MessageFormats", "from", "the", "cache", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java#L248-L281
142,686
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java
ResourceBundleMessageSource.doGetBundle
protected ResourceBundle doGetBundle(String basename, Locale locale) throws MissingResourceException { return ResourceBundle.getBundle(basename, locale, getClassLoader(), new MessageSourceControl()); }
java
protected ResourceBundle doGetBundle(String basename, Locale locale) throws MissingResourceException { return ResourceBundle.getBundle(basename, locale, getClassLoader(), new MessageSourceControl()); }
[ "protected", "ResourceBundle", "doGetBundle", "(", "String", "basename", ",", "Locale", "locale", ")", "throws", "MissingResourceException", "{", "return", "ResourceBundle", ".", "getBundle", "(", "basename", ",", "locale", ",", "getClassLoader", "(", ")", ",", "new", "MessageSourceControl", "(", ")", ")", ";", "}" ]
Obtain the resource bundle for the given basename and Locale. @param basename the basename to look for @param locale the Locale to look for @return the corresponding ResourceBundle @throws MissingResourceException if no matching bundle could be found @see java.util.ResourceBundle#getBundle(String, Locale, ClassLoader) java.util.ResourceBundle#getBundle(String, Locale, ClassLoader)
[ "Obtain", "the", "resource", "bundle", "for", "the", "given", "basename", "and", "Locale", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java#L292-L294
142,687
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java
ResourceBundleMessageSource.getMessageFormat
protected MessageFormat getMessageFormat(ResourceBundle bundle, String code, Locale locale) throws MissingResourceException { Map<String, Map<Locale, MessageFormat>> codeMap = this.cachedBundleMessageFormats.get(bundle); Map<Locale, MessageFormat> localeMap = null; if (codeMap != null) { localeMap = codeMap.get(code); if (localeMap != null) { MessageFormat result = localeMap.get(locale); if (result != null) { return result; } } } String msg = getStringOrNull(bundle, code); if (msg != null) { if (codeMap == null) { codeMap = new ConcurrentHashMap<>(); Map<String, Map<Locale, MessageFormat>> existing = this.cachedBundleMessageFormats.putIfAbsent(bundle, codeMap); if (existing != null) { codeMap = existing; } } if (localeMap == null) { localeMap = new ConcurrentHashMap<>(); Map<Locale, MessageFormat> existing = codeMap.putIfAbsent(code, localeMap); if (existing != null) { localeMap = existing; } } MessageFormat result = createMessageFormat(msg, locale); localeMap.put(locale, result); return result; } return null; }
java
protected MessageFormat getMessageFormat(ResourceBundle bundle, String code, Locale locale) throws MissingResourceException { Map<String, Map<Locale, MessageFormat>> codeMap = this.cachedBundleMessageFormats.get(bundle); Map<Locale, MessageFormat> localeMap = null; if (codeMap != null) { localeMap = codeMap.get(code); if (localeMap != null) { MessageFormat result = localeMap.get(locale); if (result != null) { return result; } } } String msg = getStringOrNull(bundle, code); if (msg != null) { if (codeMap == null) { codeMap = new ConcurrentHashMap<>(); Map<String, Map<Locale, MessageFormat>> existing = this.cachedBundleMessageFormats.putIfAbsent(bundle, codeMap); if (existing != null) { codeMap = existing; } } if (localeMap == null) { localeMap = new ConcurrentHashMap<>(); Map<Locale, MessageFormat> existing = codeMap.putIfAbsent(code, localeMap); if (existing != null) { localeMap = existing; } } MessageFormat result = createMessageFormat(msg, locale); localeMap.put(locale, result); return result; } return null; }
[ "protected", "MessageFormat", "getMessageFormat", "(", "ResourceBundle", "bundle", ",", "String", "code", ",", "Locale", "locale", ")", "throws", "MissingResourceException", "{", "Map", "<", "String", ",", "Map", "<", "Locale", ",", "MessageFormat", ">", ">", "codeMap", "=", "this", ".", "cachedBundleMessageFormats", ".", "get", "(", "bundle", ")", ";", "Map", "<", "Locale", ",", "MessageFormat", ">", "localeMap", "=", "null", ";", "if", "(", "codeMap", "!=", "null", ")", "{", "localeMap", "=", "codeMap", ".", "get", "(", "code", ")", ";", "if", "(", "localeMap", "!=", "null", ")", "{", "MessageFormat", "result", "=", "localeMap", ".", "get", "(", "locale", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "}", "String", "msg", "=", "getStringOrNull", "(", "bundle", ",", "code", ")", ";", "if", "(", "msg", "!=", "null", ")", "{", "if", "(", "codeMap", "==", "null", ")", "{", "codeMap", "=", "new", "ConcurrentHashMap", "<>", "(", ")", ";", "Map", "<", "String", ",", "Map", "<", "Locale", ",", "MessageFormat", ">", ">", "existing", "=", "this", ".", "cachedBundleMessageFormats", ".", "putIfAbsent", "(", "bundle", ",", "codeMap", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "codeMap", "=", "existing", ";", "}", "}", "if", "(", "localeMap", "==", "null", ")", "{", "localeMap", "=", "new", "ConcurrentHashMap", "<>", "(", ")", ";", "Map", "<", "Locale", ",", "MessageFormat", ">", "existing", "=", "codeMap", ".", "putIfAbsent", "(", "code", ",", "localeMap", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "localeMap", "=", "existing", ";", "}", "}", "MessageFormat", "result", "=", "createMessageFormat", "(", "msg", ",", "locale", ")", ";", "localeMap", ".", "put", "(", "locale", ",", "result", ")", ";", "return", "result", ";", "}", "return", "null", ";", "}" ]
Return a MessageFormat for the given bundle and code, fetching already generated MessageFormats from the cache. @param bundle the ResourceBundle to work on @param code the message code to retrieve @param locale the Locale to use to build the MessageFormat @return the resulting MessageFormat, or {@code null} if no message defined for the given code @throws MissingResourceException if thrown by the ResourceBundle
[ "Return", "a", "MessageFormat", "for", "the", "given", "bundle", "and", "code", "fetching", "already", "generated", "MessageFormats", "from", "the", "cache", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java#L341-L377
142,688
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/nodelet/NodeletParser.java
NodeletParser.addNodelet
public void addNodelet(String xpath, NodeletAdder nodeletAdder) { nodeletAdder.add(xpath, this); setXpath(xpath); }
java
public void addNodelet(String xpath, NodeletAdder nodeletAdder) { nodeletAdder.add(xpath, this); setXpath(xpath); }
[ "public", "void", "addNodelet", "(", "String", "xpath", ",", "NodeletAdder", "nodeletAdder", ")", "{", "nodeletAdder", ".", "add", "(", "xpath", ",", "this", ")", ";", "setXpath", "(", "xpath", ")", ";", "}" ]
Adds the nodelet. @param xpath the xpath @param nodeletAdder the nodelet adder
[ "Adds", "the", "nodelet", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/nodelet/NodeletParser.java#L142-L145
142,689
aspectran/aspectran
web/src/main/java/com/aspectran/web/activity/WebActivity.java
WebActivity.parseMultipartFormData
private void parseMultipartFormData() { String multipartFormDataParser = getSetting(MULTIPART_FORM_DATA_PARSER_SETTING_NAME); if (multipartFormDataParser == null) { throw new MultipartRequestParseException("The setting name 'multipartFormDataParser' for multipart " + "form data parsing is not specified. Please specify 'multipartFormDataParser' via Aspect so " + "that Translet can parse multipart form data."); } MultipartFormDataParser parser = getBean(multipartFormDataParser); if (parser == null) { throw new MultipartRequestParseException("No bean named '" + multipartFormDataParser + "' is defined"); } parser.parse(getRequestAdapter()); }
java
private void parseMultipartFormData() { String multipartFormDataParser = getSetting(MULTIPART_FORM_DATA_PARSER_SETTING_NAME); if (multipartFormDataParser == null) { throw new MultipartRequestParseException("The setting name 'multipartFormDataParser' for multipart " + "form data parsing is not specified. Please specify 'multipartFormDataParser' via Aspect so " + "that Translet can parse multipart form data."); } MultipartFormDataParser parser = getBean(multipartFormDataParser); if (parser == null) { throw new MultipartRequestParseException("No bean named '" + multipartFormDataParser + "' is defined"); } parser.parse(getRequestAdapter()); }
[ "private", "void", "parseMultipartFormData", "(", ")", "{", "String", "multipartFormDataParser", "=", "getSetting", "(", "MULTIPART_FORM_DATA_PARSER_SETTING_NAME", ")", ";", "if", "(", "multipartFormDataParser", "==", "null", ")", "{", "throw", "new", "MultipartRequestParseException", "(", "\"The setting name 'multipartFormDataParser' for multipart \"", "+", "\"form data parsing is not specified. Please specify 'multipartFormDataParser' via Aspect so \"", "+", "\"that Translet can parse multipart form data.\"", ")", ";", "}", "MultipartFormDataParser", "parser", "=", "getBean", "(", "multipartFormDataParser", ")", ";", "if", "(", "parser", "==", "null", ")", "{", "throw", "new", "MultipartRequestParseException", "(", "\"No bean named '\"", "+", "multipartFormDataParser", "+", "\"' is defined\"", ")", ";", "}", "parser", ".", "parse", "(", "getRequestAdapter", "(", ")", ")", ";", "}" ]
Parse the multipart form data.
[ "Parse", "the", "multipart", "form", "data", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/web/src/main/java/com/aspectran/web/activity/WebActivity.java#L167-L180
142,690
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.getHeader
@Override public String getHeader(String name) { return (headers != null ? headers.getFirst(name) : null); }
java
@Override public String getHeader(String name) { return (headers != null ? headers.getFirst(name) : null); }
[ "@", "Override", "public", "String", "getHeader", "(", "String", "name", ")", "{", "return", "(", "headers", "!=", "null", "?", "headers", ".", "getFirst", "(", "name", ")", ":", "null", ")", ";", "}" ]
Returns the value of the response header with the given name. <p>If a response header with the given name exists and contains multiple values, the value that was added first will be returned. @param name the name of the response header whose value to return @return the value of the response header with the given name, or {@code null} if no header with the given name has been set on this response
[ "Returns", "the", "value", "of", "the", "response", "header", "with", "the", "given", "name", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L77-L80
142,691
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.getHeaders
@Override public Collection<String> getHeaders(String name) { return (headers != null ? headers.get(name) : null); }
java
@Override public Collection<String> getHeaders(String name) { return (headers != null ? headers.get(name) : null); }
[ "@", "Override", "public", "Collection", "<", "String", ">", "getHeaders", "(", "String", "name", ")", "{", "return", "(", "headers", "!=", "null", "?", "headers", ".", "get", "(", "name", ")", ":", "null", ")", ";", "}" ]
Returns the values of the response header with the given name. @param name the name of the response header whose values to return @return a (possibly empty) {@code Collection} of the values of the response header with the given name
[ "Returns", "the", "values", "of", "the", "response", "header", "with", "the", "given", "name", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L89-L92
142,692
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.setHeader
@Override public void setHeader(String name, String value) { touchHeaders().set(name, value); }
java
@Override public void setHeader(String name, String value) { touchHeaders().set(name, value); }
[ "@", "Override", "public", "void", "setHeader", "(", "String", "name", ",", "String", "value", ")", "{", "touchHeaders", "(", ")", ".", "set", "(", "name", ",", "value", ")", ";", "}" ]
Set the given single header value under the given header name. @param name the header name @param value the header value to set
[ "Set", "the", "given", "single", "header", "value", "under", "the", "given", "header", "name", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L124-L127
142,693
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.addHeader
@Override public void addHeader(String name, String value) { touchHeaders().add(name, value); }
java
@Override public void addHeader(String name, String value) { touchHeaders().add(name, value); }
[ "@", "Override", "public", "void", "addHeader", "(", "String", "name", ",", "String", "value", ")", "{", "touchHeaders", "(", ")", ".", "add", "(", "name", ",", "value", ")", ";", "}" ]
Add the given single header value to the current list of values for the given header. @param name the header name @param value the header value to be added
[ "Add", "the", "given", "single", "header", "value", "to", "the", "current", "list", "of", "values", "for", "the", "given", "header", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L136-L139
142,694
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/Session.java
Session.setInactivityTimer
private void setInactivityTimer(long ms) { if (sessionInactivityTimer == null) { sessionInactivityTimer = new SessionInactivityTimer(sessionHandler.getScheduler(), this); } sessionInactivityTimer.setIdleTimeout(ms); }
java
private void setInactivityTimer(long ms) { if (sessionInactivityTimer == null) { sessionInactivityTimer = new SessionInactivityTimer(sessionHandler.getScheduler(), this); } sessionInactivityTimer.setIdleTimeout(ms); }
[ "private", "void", "setInactivityTimer", "(", "long", "ms", ")", "{", "if", "(", "sessionInactivityTimer", "==", "null", ")", "{", "sessionInactivityTimer", "=", "new", "SessionInactivityTimer", "(", "sessionHandler", ".", "getScheduler", "(", ")", ",", "this", ")", ";", "}", "sessionInactivityTimer", ".", "setIdleTimeout", "(", "ms", ")", ";", "}" ]
Set the session inactivity timer. @param ms value in millisec, -1 disables it
[ "Set", "the", "session", "inactivity", "timer", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/Session.java#L218-L223
142,695
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/Session.java
Session.stopInactivityTimer
protected void stopInactivityTimer() { try (Lock ignored = locker.lockIfNotHeld()) { if (sessionInactivityTimer != null) { sessionInactivityTimer.setIdleTimeout(-1); sessionInactivityTimer = null; if (log.isDebugEnabled()) { log.debug("Session inactivity timer stopped"); } } } }
java
protected void stopInactivityTimer() { try (Lock ignored = locker.lockIfNotHeld()) { if (sessionInactivityTimer != null) { sessionInactivityTimer.setIdleTimeout(-1); sessionInactivityTimer = null; if (log.isDebugEnabled()) { log.debug("Session inactivity timer stopped"); } } } }
[ "protected", "void", "stopInactivityTimer", "(", ")", "{", "try", "(", "Lock", "ignored", "=", "locker", ".", "lockIfNotHeld", "(", ")", ")", "{", "if", "(", "sessionInactivityTimer", "!=", "null", ")", "{", "sessionInactivityTimer", ".", "setIdleTimeout", "(", "-", "1", ")", ";", "sessionInactivityTimer", "=", "null", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Session inactivity timer stopped\"", ")", ";", "}", "}", "}", "}" ]
Stop the session inactivity timer.
[ "Stop", "the", "session", "inactivity", "timer", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/Session.java#L228-L238
142,696
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/Session.java
Session.isExpiredAt
protected boolean isExpiredAt(long time) { try (Lock ignored = locker.lockIfNotHeld()) { checkValidForRead(); return sessionData.isExpiredAt(time); } }
java
protected boolean isExpiredAt(long time) { try (Lock ignored = locker.lockIfNotHeld()) { checkValidForRead(); return sessionData.isExpiredAt(time); } }
[ "protected", "boolean", "isExpiredAt", "(", "long", "time", ")", "{", "try", "(", "Lock", "ignored", "=", "locker", ".", "lockIfNotHeld", "(", ")", ")", "{", "checkValidForRead", "(", ")", ";", "return", "sessionData", ".", "isExpiredAt", "(", "time", ")", ";", "}", "}" ]
Check to see if session has expired as at the time given. @param time the time since the epoch in ms @return true if expired
[ "Check", "to", "see", "if", "session", "has", "expired", "as", "at", "the", "time", "given", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/Session.java#L326-L331
142,697
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/Session.java
Session.isIdleLongerThan
protected boolean isIdleLongerThan (int sec) { long now = System.currentTimeMillis(); try (Lock ignored = locker.lockIfNotHeld()) { return ((sessionData.getAccessedTime() + (sec * 1000)) <= now); } }
java
protected boolean isIdleLongerThan (int sec) { long now = System.currentTimeMillis(); try (Lock ignored = locker.lockIfNotHeld()) { return ((sessionData.getAccessedTime() + (sec * 1000)) <= now); } }
[ "protected", "boolean", "isIdleLongerThan", "(", "int", "sec", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "(", "Lock", "ignored", "=", "locker", ".", "lockIfNotHeld", "(", ")", ")", "{", "return", "(", "(", "sessionData", ".", "getAccessedTime", "(", ")", "+", "(", "sec", "*", "1000", ")", ")", "<=", "now", ")", ";", "}", "}" ]
Check if the Session has been idle longer than a number of seconds. @param sec the number of seconds @return true if the session has been idle longer than the interval
[ "Check", "if", "the", "Session", "has", "been", "idle", "longer", "than", "a", "number", "of", "seconds", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/Session.java#L339-L344
142,698
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/Session.java
Session.checkValidForWrite
protected void checkValidForWrite() throws IllegalStateException { checkLocked(); if (state == State.INVALID) { throw new IllegalStateException("Not valid for write: session " + this); } if (state == State.INVALIDATING) { return; // in the process of being invalidated, listeners may try to remove attributes } if (!isResident()) { throw new IllegalStateException("Not valid for write: session " + this); } }
java
protected void checkValidForWrite() throws IllegalStateException { checkLocked(); if (state == State.INVALID) { throw new IllegalStateException("Not valid for write: session " + this); } if (state == State.INVALIDATING) { return; // in the process of being invalidated, listeners may try to remove attributes } if (!isResident()) { throw new IllegalStateException("Not valid for write: session " + this); } }
[ "protected", "void", "checkValidForWrite", "(", ")", "throws", "IllegalStateException", "{", "checkLocked", "(", ")", ";", "if", "(", "state", "==", "State", ".", "INVALID", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Not valid for write: session \"", "+", "this", ")", ";", "}", "if", "(", "state", "==", "State", ".", "INVALIDATING", ")", "{", "return", ";", "// in the process of being invalidated, listeners may try to remove attributes", "}", "if", "(", "!", "isResident", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Not valid for write: session \"", "+", "this", ")", ";", "}", "}" ]
Check that the session can be modified. @throws IllegalStateException if the session is invalid
[ "Check", "that", "the", "session", "can", "be", "modified", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/Session.java#L351-L363
142,699
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/Session.java
Session.checkValidForRead
protected void checkValidForRead() throws IllegalStateException { checkLocked(); if (state == State.INVALID) { throw new IllegalStateException("Invalid for read: session " + this); } if (state == State.INVALIDATING) { return; } if (!isResident()) { throw new IllegalStateException("Invalid for read: session " + this); } }
java
protected void checkValidForRead() throws IllegalStateException { checkLocked(); if (state == State.INVALID) { throw new IllegalStateException("Invalid for read: session " + this); } if (state == State.INVALIDATING) { return; } if (!isResident()) { throw new IllegalStateException("Invalid for read: session " + this); } }
[ "protected", "void", "checkValidForRead", "(", ")", "throws", "IllegalStateException", "{", "checkLocked", "(", ")", ";", "if", "(", "state", "==", "State", ".", "INVALID", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Invalid for read: session \"", "+", "this", ")", ";", "}", "if", "(", "state", "==", "State", ".", "INVALIDATING", ")", "{", "return", ";", "}", "if", "(", "!", "isResident", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Invalid for read: session \"", "+", "this", ")", ";", "}", "}" ]
Check that the session data can be read. @throws IllegalStateException if the session is invalid
[ "Check", "that", "the", "session", "data", "can", "be", "read", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/Session.java#L370-L382