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
partition
stringclasses
1 value
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", "SDKExcept...
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
train
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...
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
train
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", "PhysicalNe...
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
train
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", "SDKExceptio...
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
train
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", "SDKExce...
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
train
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", "=", ...
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
train
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", ")", "thro...
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
train
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", "{", "...
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
train
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", ")", "{", ...
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
train
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", ")", "...
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
train
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\"", ")", ";", ...
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
train
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", ")", "{", "val...
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
train
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", ";", "...
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
train
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",...
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
train
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", "-...
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
train
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", "(", "publicI...
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
train
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", ".",...
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
train
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"...
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
train
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", "(", ...
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
train
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", "<>", "(", ")", ...
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
train
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", ")", ";", ...
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
train
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", ")", ";", "echoActionR...
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
train
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
train
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", ")", ";", "re...
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
train
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", ";", "fo...
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
train
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", ".", "g...
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
train
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", ",", "(",...
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
train
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", "(", ")", ...
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
train
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", ")", ";", "}", "i...
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
train
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", "i...
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
train
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", "(", "s...
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
train
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", "(", ")", ")", ";", "input...
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
train
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\"", ")", ";",...
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
train
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", ...
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
train
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", ")", ")", "{", ...
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
train
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",...
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
train
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", "<", ...
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
train
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"...
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
train
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\"", ")",...
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
train
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", "{", "P...
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
train
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", ",", "conso...
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
train
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", "=", "FactoryBea...
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
train
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", "...
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
train
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", "(", ")", ";", "}", "construct...
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
train
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", ")", ";", "r...
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
train
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", "(", ...
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
train
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
train
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", "="...
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
train
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", ".", "getB...
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
train
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", ")", ";", "re...
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
train
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", ";", "fo...
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
train
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", ")", ";", ...
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
train
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", ...
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
train
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", ";"...
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
train
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", "|...
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
train
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
train
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", "(", "NoSuchMethodExcep...
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
train
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", ...
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
train
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", "...
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
train
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", "(", ")", ")", ")", ...
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
train
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", "invokeExactStaticMeth...
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
train
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", ".", "getCharac...
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
train
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", "=", "n...
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
train
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", ".", ...
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
train
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
train
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", "(", "pre...
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
train
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", "++",...
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
train
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",...
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",...
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L497-L503
train
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", "(",...
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
train
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 ...
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
train
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
train
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", ".", ...
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
train
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", "(", "newAssistantLoca...
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
train
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...
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
train
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"...
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
train
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", "(", ")", "&&"...
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
train
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", "...
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
train
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
train
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", ".", ...
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
train
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", "<", ...
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
train
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", "<", "?...
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
train
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", ">", ">", "typeB...
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
train
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", "<"...
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
train
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, ...
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
train
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", "(", ")", ",", "n...
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
train
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", ">", ">", "c...
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
train
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
train
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", "MultipartRequestP...
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
train
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
train
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
train
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
train
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
train
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", ...
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
train
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", "("...
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
train
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
train
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", "(", "(", ...
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
train
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 \"",...
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
train
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 \"", "...
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
train
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.setName
public void setName(String name) { if (name.endsWith(ARRAY_SUFFIX)) { this.name = name.substring(0, name.length() - 2); type = ItemType.ARRAY; } else if (name.endsWith(MAP_SUFFIX)) { this.name = name.substring(0, name.length() - 2); type = ItemType.MAP; } else { this.name = name; if (type == null) { type = ItemType.SINGLE; } } }
java
public void setName(String name) { if (name.endsWith(ARRAY_SUFFIX)) { this.name = name.substring(0, name.length() - 2); type = ItemType.ARRAY; } else if (name.endsWith(MAP_SUFFIX)) { this.name = name.substring(0, name.length() - 2); type = ItemType.MAP; } else { this.name = name; if (type == null) { type = ItemType.SINGLE; } } }
[ "public", "void", "setName", "(", "String", "name", ")", "{", "if", "(", "name", ".", "endsWith", "(", "ARRAY_SUFFIX", ")", ")", "{", "this", ".", "name", "=", "name", ".", "substring", "(", "0", ",", "name", ".", "length", "(", ")", "-", "2", ")...
Sets the name of the item. @param name the name to set
[ "Sets", "the", "name", "of", "the", "item", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L115-L128
train
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.getValueList
public List<String> getValueList() { if (tokensList == null) { return null; } if (tokensList.isEmpty()) { return new ArrayList<>(); } else { List<String> list = new ArrayList<>(tokensList.size()); for (Token[] tokens : tokensList) { list.add(TokenParser.toString(tokens)); } return list; } }
java
public List<String> getValueList() { if (tokensList == null) { return null; } if (tokensList.isEmpty()) { return new ArrayList<>(); } else { List<String> list = new ArrayList<>(tokensList.size()); for (Token[] tokens : tokensList) { list.add(TokenParser.toString(tokens)); } return list; } }
[ "public", "List", "<", "String", ">", "getValueList", "(", ")", "{", "if", "(", "tokensList", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "tokensList", ".", "isEmpty", "(", ")", ")", "{", "return", "new", "ArrayList", "<>", "(", ...
Returns a list of string values of this item. @return a list of string values
[ "Returns", "a", "list", "of", "string", "values", "of", "this", "item", "." ]
2d758a2a28b71ee85b42823c12dc44674d7f2c70
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L162-L175
train