public Class define() {
		process();

		if ((!proxetta.isForced()) && (!isProxyApplied())) {
			if (log.isDebugEnabled()) {
				log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName));
			}

			if (targetClass != null) {
				return targetClass;
			}

			if (targetClassName != null) {
				try {
					return ClassLoaderUtil.loadClass(targetClassName);
				} catch (ClassNotFoundException cnfex) {
					throw new ProxettaException(cnfex);
				}
			}
		}

		if (log.isDebugEnabled()) {
			log.debug("Proxy created: " + StringUtil.toSafeString(targetClassName));
		}

		try {
			ClassLoader classLoader = proxetta.getClassLoader();

			if (classLoader == null) {
				classLoader = ClassLoaderUtil.getDefaultClassLoader();

				if ((classLoader == null) && (targetClass != null)) {
					classLoader = targetClass.getClassLoader();
				}
			}

			final byte[] bytes = toByteArray();

			dumpClassInDebugFolder(bytes);

			return DefineClass.of(getProxyClassName(), bytes, classLoader);
		} catch (Exception ex) {
			throw new ProxettaException("Class definition failed", ex);
		}
	}

public
Class
define
(
)
{
process
(
)
;
if
(
(
!
proxetta
.
isForced
(
)
)
&&
(
!
isProxyApplied
(
)
)
)
{
if
(
log
.
isDebugEnabled
(
)
)
{
log
.
debug
(
"Proxy not applied: "
+
StringUtil
.
toSafeString
(
targetClassName
)
)
;
}
if
(
targetClass
!=
)
{
return
targetClass
;
}
if
(
targetClassName
!=
)
{
try
{
return
ClassLoaderUtil
.
loadClass
(
targetClassName
)
;
}
catch
(
ClassNotFoundException
cnfex
)
{
throw
new
ProxettaException
(
cnfex
)
;
}
}
}
if
(
log
.
isDebugEnabled
(
)
)
{
log
.
debug
(
"Proxy created: "
+
StringUtil
.
toSafeString
(
targetClassName
)
)
;
}
try
{
ClassLoader
classLoader
=
proxetta
.
getClassLoader
(
)
;
if
(
classLoader
==
)
{
classLoader
=
ClassLoaderUtil
.
getDefaultClassLoader
(
)
;
if
(
(
classLoader
==
)
&&
(
targetClass
!=
)
)
{
classLoader
=
targetClass
.
getClassLoader
(
)
;
}
}
final
byte
[
]
bytes
=
toByteArray
(
)
;
dumpClassInDebugFolder
(
bytes
)
;
return
DefineClass
.
of
(
getProxyClassName
(
)
,
bytes
,
classLoader
)
;
}
catch
(
Exception
ex
)
{
throw
new
ProxettaException
(
"Class definition failed"
,
ex
)
;
}
}


public Object newInstance() {
		Class type = define();
		try {
			return ClassUtil.newInstance(type);
		} catch (Exception ex) {
			throw new ProxettaException("Invalid Proxetta class", ex);
		}
	}

public
Object
newInstance
(
)
{
Class
type
=
define
(
)
;
try
{
return
ClassUtil
.
newInstance
(
type
)
;
}
catch
(
Exception
ex
)
{
throw
new
ProxettaException
(
"Invalid Proxetta class"
,
ex
)
;
}
}

Creates new instance of created class.
Assumes default no-arg constructor.

Creates new instance of created class . Assumes default no - arg constructor .


protected void dumpClassInDebugFolder(final byte[] bytes) {
		File debugFolder = proxetta.getDebugFolder();
		if (debugFolder == null) {
			return;
		}

		if (!debugFolder.exists() || !debugFolder.isDirectory()) {
			log.warn("Invalid debug folder: " + debugFolder);
		}

		String fileName = proxyClassName;
		if (fileName == null) {
			fileName = "proxetta-" + System.currentTimeMillis();
		}

		fileName += ".class";

		File file = new File(debugFolder, fileName);
		try {
			FileUtil.writeBytes(file, bytes);
		} catch (IOException ioex) {
			log.warn("Error writing class as " + file, ioex);
		}
	}

protected
void
dumpClassInDebugFolder
(
final
byte
[
]
bytes
)
{
File
debugFolder
=
proxetta
.
getDebugFolder
(
)
;
if
(
debugFolder
==
)
{
return
;
}
if
(
!
debugFolder
.
exists
(
)
||
!
debugFolder
.
isDirectory
(
)
)
{
log
.
warn
(
"Invalid debug folder: "
+
debugFolder
)
;
}
String
fileName
=
proxyClassName
;
if
(
fileName
==
)
{
fileName
=
"proxetta-"
+
System
.
currentTimeMillis
(
)
;
}
fileName
+=
".class"
;
File
file
=
new
File
(
debugFolder
,
fileName
)
;
try
{
FileUtil
.
writeBytes
(
file
,
bytes
)
;
}
catch
(
IOException
ioex
)
{
log
.
warn
(
"Error writing class as "
+
file
,
ioex
)
;
}
}

Writes created class content to output folder for debugging purposes.

Writes created class content to output folder for debugging purposes .


public T from(final String personalName, final String from) {
		return from(new EmailAddress(personalName, from));
	}

public T from ( final String personalName , final String from ) { return from ( new EmailAddress ( personalName , from ) ) ; }

Sets the FROM address by providing personal name and address.

@param personalName personal name.
@param from         email address.
@return this
@see #from(EmailAddress)

Sets the FROM address by providing personal name and address .


public T to(final EmailAddress to) {
		this.to = ArraysUtil.append(this.to, to);
		return _this();
	}

public T to ( final EmailAddress to ) { this . to = ArraysUtil . append ( this . to , to ) ; return _this ( ) ; }

Appends TO address.

@param to {@link EmailAddress} to add.
@return this


public T to(final String personalName, final String to) {
		return to(new EmailAddress(personalName, to));
	}

public T to ( final String personalName , final String to ) { return to ( new EmailAddress ( personalName , to ) ) ; }

Appends TO address by personal name and email address.

@param personalName personal name.
@param to           email address.
@return this
@see #to(EmailAddress)

Appends TO address by personal name and email address .


public T replyTo(final EmailAddress... replyTo) {
		this.replyTo = ArraysUtil.join(this.replyTo, valueOrEmptyArray(replyTo));
		return _this();
	}

public T replyTo ( final EmailAddress ... replyTo ) { this . replyTo = ArraysUtil . join ( this . replyTo , valueOrEmptyArray ( replyTo ) ) ; return _this ( ) ; }

Appends REPLY-TO addresses.

@param replyTo vararg of {@link EmailAddress}es to set.
@return this


public T cc(final EmailAddress... ccs) {
		this.cc = ArraysUtil.join(this.cc, valueOrEmptyArray(ccs));
		return _this();
	}

public T cc ( final EmailAddress ... ccs ) { this . cc = ArraysUtil . join ( this . cc , valueOrEmptyArray ( ccs ) ) ; return _this ( ) ; }

Appends CC addresses.

@param ccs vararg of {@link EmailAddress}es to set.
@return this


public T textMessage(final String text, final String encoding) {
		return message(new EmailMessage(text, MimeTypes.MIME_TEXT_PLAIN, encoding));
	}

public T textMessage ( final String text , final String encoding ) { return message ( new EmailMessage ( text , MimeTypes . MIME_TEXT_PLAIN , encoding ) ) ; }

Adds plain message text.

@param text     The text to add as a {@link String}.
@param encoding The encoding as a {@link String}.
@return this
@see #message(EmailMessage)


public T htmlMessage(final String html, final String encoding) {
		return message(new EmailMessage(html, MimeTypes.MIME_TEXT_HTML, encoding));
	}

public T htmlMessage ( final String html , final String encoding ) { return message ( new EmailMessage ( html , MimeTypes . MIME_TEXT_HTML , encoding ) ) ; }

Adds HTML message.

@param html     The HTML to add as a {@link String}.
@param encoding The encoding as a {@link String}.
@return this
@see #message(EmailMessage)


public T header(final String name, final String value) {
		headers.put(name, value);
		return _this();
	}

public T header ( final String name , final String value ) { headers . put ( name , value ) ; return _this ( ) ; }

Sets header value.

@param name  The name of the header.
@param value The value of the header.
@return this


public static String get(final String name, final String defaultValue) {
		Objects.requireNonNull(name);

		String value = null;
		try {
			if (System.getSecurityManager() == null) {
				value = System.getProperty(name);
			} else {
				value = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty(name));
			}
		} catch (Exception ignore) {
		}

		if (value == null) {
			return defaultValue;
		}

		return value;
	}

public static String get ( final String name , final String defaultValue ) { Objects . requireNonNull ( name ) ; String value = null ; try { if ( System . getSecurityManager ( ) == null ) { value = System . getProperty ( name ) ; } else { value = AccessController . doPrivileged ( ( PrivilegedAction < String > ) ( ) -> System . getProperty ( name ) ) ; } } catch ( Exception ignore ) { } if ( value == null ) { return defaultValue ; } return value ; }

Returns system property. If key is not available, returns the default value.

Returns system property . If key is not available returns the default value .


public static boolean getBoolean(final String name, final boolean defaultValue) {
		String value = get(name);
		if (value == null) {
			return defaultValue;
		}

		value = value.trim().toLowerCase();

		switch (value) {
			case "true" :
			case "yes"  :
			case "1"    :
			case "on"   :
				return true;
			case "false":
			case "no"   :
			case "0"    :
			case "off"  :
				return false;
			default:
				return defaultValue;
		}
	}

public static boolean getBoolean ( final String name , final boolean defaultValue ) { String value = get ( name ) ; if ( value == null ) { return defaultValue ; } value = value . trim ( ) . toLowerCase ( ) ; switch ( value ) { case "true" : case "yes" : case "1" : case "on" : return true ; case "false" : case "no" : case "0" : case "off" : return false ; default : return defaultValue ; } }


public static long getInt(final String name, final int defaultValue) {
		String value = get(name);
		if (value == null) {
			return defaultValue;
		}

		value = value.trim().toLowerCase();
		try {
			return Integer.parseInt(value);
		}
		catch (NumberFormatException nfex) {
			return defaultValue;
		}
	}

public static long getInt ( final String name , final int defaultValue ) { String value = get ( name ) ; if ( value == null ) { return defaultValue ; } value = value . trim ( ) . toLowerCase ( ) ; try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException nfex ) { return defaultValue ; } }


public static long getLong(final String name, final long defaultValue) {
		String value = get(name);
		if (value == null) {
			return defaultValue;
		}

		value = value.trim().toLowerCase();
		try {
			return Long.parseLong(value);
		}
		catch (NumberFormatException nfex) {
			return defaultValue;
		}
	}

public static long getLong ( final String name , final long defaultValue ) { String value = get ( name ) ; if ( value == null ) { return defaultValue ; } value = value . trim ( ) . toLowerCase ( ) ; try { return Long . parseLong ( value ) ; } catch ( NumberFormatException nfex ) { return defaultValue ; } }


MethodParameter[] getResolvedParameters() {
		if (paramExtractor == null) {
			return MethodParameter.EMPTY_ARRAY;
		}
		if (!paramExtractor.debugInfoPresent) {
			throw new ParamoException("Parameter names not available for method: "
					+ declaringClass.getName() + '#' + methodName);
		}
		return paramExtractor.getMethodParameters();
	}

Returns method parameters once when method is parsed.
If method has no parameters, an empty array is returned.

Returns method parameters once when method is parsed . If method has no parameters an empty array is returned .


protected int serializeKeyValue(final JsonContext jsonContext, final Path currentPath, final Object key, final Object value, int count) {
		if ((value == null) && jsonContext.isExcludeNulls()) {
			return count;
		}

		if (key != null) {
			currentPath.push(key.toString());
		} else {
			currentPath.push(StringPool.NULL);
		}

		// check if we should include the field

		boolean include = true;

		if (value != null) {

			// + all collections are not serialized by default

			include = jsonContext.matchIgnoredPropertyTypes(value.getClass(), false, include);

			// + path queries: excludes/includes

			include = jsonContext.matchPathToQueries(include);
		}

		// done

		if (!include) {
			currentPath.pop();
			return count;
		}

		if (key == null) {
			jsonContext.pushName(null, count > 0);
		} else {
			jsonContext.pushName(key.toString(), count > 0);
		}

		jsonContext.serialize(value);

		if (jsonContext.isNamePopped()) {
			count++;
		}

		currentPath.pop();
		return count;
	}


protected String lookupAlias(final String alias) {
		String value = actionsManager.lookupPathAlias(alias);
		if (value == null) {
			ActionRuntime cfg = actionsManager.lookup(alias);
			if (cfg != null) {
				value = cfg.getActionPath();
			}
		}
		return value;
	}

protected String lookupAlias ( final String alias ) { String value = actionsManager . lookupPathAlias ( alias ) ; if ( value == null ) { ActionRuntime cfg = actionsManager . lookup ( alias ) ; if ( cfg != null ) { value = cfg . getActionPath ( ) ; } } return value ; }

Lookups value as an alias and, if not found, as a default alias.

Lookups value as an alias and if not found as a default alias .


protected String resolveAlias(final String value) {
		final StringBuilder result = new StringBuilder(value.length());
		int i = 0;
		int len = value.length();
		while (i < len) {
			int ndx = value.indexOf('<', i);
			if (ndx == -1) {
				// alias markers not found
				if (i == 0) {
					// try whole string as an alias
					String alias = lookupAlias(value);
					return (alias != null ? alias : value);
				} else {
					result.append(value.substring(i));
				}
				break;
			}

			// alias marked found
			result.append(value.substring(i, ndx));
			ndx++;
			int ndx2 = value.indexOf('>', ndx);
			String aliasName = (ndx2 == -1 ? value.substring(ndx) : value.substring(ndx, ndx2));

			// process alias
			String alias = lookupAlias(aliasName);
			if (alias != null) {
				result.append(alias);
			}
			else {
				// alias not found
				if (log.isWarnEnabled()) {
					log.warn("Alias not found: " + aliasName);
				}
			}
			i = ndx2 + 1;
		}

		// fix prefix '//' - may happened when aliases are used
		i = 0; len = result.length();
		while (i < len) {
			if (result.charAt(i) != '/') {
				break;
			}
			i++;
		}
		if (i > 1) {
			return result.substring(i - 1, len);
		}
		return result.toString();
	}

Returns resolved alias result value or passed on, if alias doesn't exist.

Returns resolved alias result value or passed on if alias doesn t exist .


public ResultPath resolveResultPath(String path, String value) {

		boolean absolutePath = false;

		if (value != null) {
			// [*] resolve alias in value
			value = resolveAlias(value);

			// [*] absolute paths
			if (StringUtil.startsWithChar(value, '/')) {
				absolutePath = true;
				int dotNdx = value.indexOf("..");
				if (dotNdx != -1) {
					path = value.substring(0, dotNdx);
					value = value.substring(dotNdx + 2);
				} else {
					path = value;
					value = null;
				}
			} else {
				// [*] resolve # in value and path
				int i = 0;
				while (i < value.length()) {
					if (value.charAt(i) != '#') {
						break;
					}
					int dotNdx = MadvocUtil.lastIndexOfSlashDot(path);
					if (dotNdx != -1) {
						// dot found
						path = path.substring(0, dotNdx);
					}
					i++;
				}
				if (i > 0) {
					// remove # from value
					value = value.substring(i);

					// [*] update path and value

					if (StringUtil.startsWithChar(value, '.')) {
						value = value.substring(1);
					} else {
						int dotNdx = value.indexOf("..");
						if (dotNdx != -1) {
							path += '.' + value.substring(0, dotNdx);
							value = value.substring(dotNdx + 2);
						} else {
							if (value.length() > 0) {
								if (StringUtil.endsWithChar(path, '/')) {
									path += value;
								} else {
									path += '.' + value;
								}
							}
							value = null;
						}
					}
				}
			}
		}

		if (!absolutePath) {
			if (resultPathPrefix != null) {
				path = resultPathPrefix + path;
			}
		}

		return new ResultPath(path, value);
	}

public
ResultPath
resolveResultPath
(
String
path
,
String
value
)
{
boolean
absolutePath
=
false
;
if
(
value
!=
)
{
// [*] resolve alias in value
value
=
resolveAlias
(
value
)
;
// [*] absolute paths
if
(
StringUtil
.
startsWithChar
(
value
,
'
'
)
)
{
absolutePath
=
true
;
int
dotNdx
=
value
.
indexOf
(
".."
)
;
if
(
dotNdx
!=
1
)
{
path
=
value
.
substring
(
0
,
dotNdx
)
;
value
=
value
.
substring
(
dotNdx
+
2
)
;
}
else
{
path
=
value
;
value
=
;
}
}
else
{
// [*] resolve # in value and path
int
i
=
0
;
while
(
i
<
value
.
length
(
)
)
{
if
(
value
.
charAt
(
i
)
!=
'
'
)
{
break
;
}
int
dotNdx
=
MadvocUtil
.
lastIndexOfSlashDot
(
path
)
;
if
(
dotNdx
!=
1
)
{
// dot found
path
=
path
.
substring
(
0
,
dotNdx
)
;
}
i
++
;
}
if
(
i
>
0
)
{
// remove # from value
value
=
value
.
substring
(
i
)
;
// [*] update path and value
if
(
StringUtil
.
startsWithChar
(
value
,
'
'
)
)
{
value
=
value
.
substring
(
1
)
;
}
else
{
int
dotNdx
=
value
.
indexOf
(
".."
)
;
if
(
dotNdx
!=
1
)
{
path
+=
'
'
+
value
.
substring
(
0
,
dotNdx
)
;
value
=
value
.
substring
(
dotNdx
+
2
)
;
}
else
{
if
(
value
.
length
(
)
>
0
)
{
if
(
StringUtil
.
endsWithChar
(
path
,
'
'
)
)
{
path
+=
value
;
}
else
{
path
+=
'
'
+
value
;
}
}
value
=
;
}
}
}
}
}
if
(
!
absolutePath
)
{
if
(
resultPathPrefix
!=
)
{
path
=
resultPathPrefix
+
path
;
}
}
return
new
ResultPath
(
path
,
value
)
;
}


public String resolveResultPathString(final String path, final String value) {
		final ResultPath resultPath = resolveResultPath(path, value);
		final String result = resultPath.pathValue();

		return resolveAlias(result);
	}

public String resolveResultPathString ( final String path , final String value ) { final ResultPath resultPath = resolveResultPath ( path , value ) ; final String result = resultPath . pathValue ( ) ; return resolveAlias ( result ) ; }

Resolves result path as a string, when parts are not important
and when only full string matters. Additional alias resolving
on full path is done.

Resolves result path as a string when parts are not important and when only full string matters . Additional alias resolving on full path is done .


public static int lastIndexOfSlashDot(final String str) {
		int slashNdx = str.lastIndexOf('/');
		int dotNdx = StringUtil.lastIndexOf(str, '.', str.length(), slashNdx);
		if (dotNdx == -1) {
			if (slashNdx == -1) {
				return -1;
			}
			slashNdx++;
			if (slashNdx < str.length() - 1) {
				dotNdx = slashNdx;
			} else {
				dotNdx = -1;
			}
		}
		return dotNdx;
	}

public static int lastIndexOfSlashDot ( final String str ) { int slashNdx = str . lastIndexOf ( ' ' ) ; int dotNdx = StringUtil . lastIndexOf ( str , ' ' , str . length ( ) , slashNdx ) ; if ( dotNdx == - 1 ) { if ( slashNdx == - 1 ) { return - 1 ; } slashNdx ++ ; if ( slashNdx < str . length ( ) - 1 ) { dotNdx = slashNdx ; } else { dotNdx = - 1 ; } } return dotNdx ; }

Locates last dot after the last slash or just slash.

Locates last dot after the last slash or just slash .


public static int lastIndexOfDotAfterSlash(final String str) {
		int slashNdx = str.lastIndexOf('/');
		slashNdx++;
		return StringUtil.lastIndexOf(str, '.', str.length(), slashNdx);
	}

public static int lastIndexOfDotAfterSlash ( final String str ) { int slashNdx = str . lastIndexOf ( ' ' ) ; slashNdx ++ ; return StringUtil . lastIndexOf ( str , ' ' , str . length ( ) , slashNdx ) ; }

Locates last index of dot after the optional last slash.

Locates last index of dot after the optional last slash .


public static int indexOfDotAfterSlash(final String str) {
		int slashNdx = str.lastIndexOf('/');
		if (slashNdx == -1) {
			slashNdx = 0;
		}
		return str.indexOf('.', slashNdx);
	}

public static int indexOfDotAfterSlash ( final String str ) { int slashNdx = str . lastIndexOf ( ' ' ) ; if ( slashNdx == - 1 ) { slashNdx = 0 ; } return str . indexOf ( ' ' , slashNdx ) ; }

Locates first dot after the last slash .


public static String stripLastCamelWord(String name) {

		int ndx = name.length() - 1;
		while (ndx >= 0) {
			if (CharUtil.isUppercaseAlpha(name.charAt(ndx))) {
				break;
			}
			ndx--;
		}
		if (ndx >= 0) {
			name = name.substring(0, ndx);
		}
		return name;
	}

public static String stripLastCamelWord ( String name ) { int ndx = name . length ( ) - 1 ; while ( ndx >= 0 ) { if ( CharUtil . isUppercaseAlpha ( name . charAt ( ndx ) ) ) { break ; } ndx -- ; } if ( ndx >= 0 ) { name = name . substring ( 0 , ndx ) ; } return name ; }


public static String resolveSchemaName(final Class<?> type, final String defaultSchemaName) {
		String schemaName = null;
		final DbTable dbTable = type.getAnnotation(DbTable.class);
		if (dbTable != null) {
			schemaName = dbTable.schema().trim();
		}
		if ((schemaName == null) || (schemaName.length() == 0)) {
			schemaName = defaultSchemaName;
		}
		return schemaName;
	}

public static String resolveSchemaName ( final Class < ? > type , final String defaultSchemaName ) { String schemaName = null ; final DbTable dbTable = type . getAnnotation ( DbTable . class ) ; if ( dbTable != null ) { schemaName = dbTable . schema ( ) . trim ( ) ; } if ( ( schemaName == null ) || ( schemaName . length ( ) == 0 ) ) { schemaName = defaultSchemaName ; } return schemaName ; }

Resolves schema name from a type. Uses default schema name if not specified.

Resolves schema name from a type . Uses default schema name if not specified .


public static DbEntityColumnDescriptor resolveColumnDescriptors(
		final DbEntityDescriptor dbEntityDescriptor,
		final PropertyDescriptor property,
		final boolean isAnnotated,
		final ColumnNamingStrategy columnNamingStrategy) {

		String columnName = null;
		boolean isId = false;
		Class<? extends SqlType> sqlTypeClass = null;

		// read ID annotation

		DbId dbId = null;

		if (property.getFieldDescriptor() != null) {
			dbId = property.getFieldDescriptor().getField().getAnnotation(DbId.class);
		}
		if (dbId == null && property.getReadMethodDescriptor() != null) {
			dbId = property.getReadMethodDescriptor().getMethod().getAnnotation(DbId.class);
		}
		if (dbId == null && property.getWriteMethodDescriptor() != null) {
			dbId = property.getWriteMethodDescriptor().getMethod().getAnnotation(DbId.class);
		}

		if (dbId != null) {
			columnName = dbId.value().trim();
			sqlTypeClass = dbId.sqlType();
			isId = true;
		} else {
			DbColumn dbColumn = null;

			if (property.getFieldDescriptor() != null) {
				dbColumn = property.getFieldDescriptor().getField().getAnnotation(DbColumn.class);
			}
			if (dbColumn == null && property.getReadMethodDescriptor() != null) {
				dbColumn = property.getReadMethodDescriptor().getMethod().getAnnotation(DbColumn.class);
			}
			if (dbColumn == null && property.getWriteMethodDescriptor() != null) {
				dbColumn = property.getWriteMethodDescriptor().getMethod().getAnnotation(DbColumn.class);
			}

			if (dbColumn != null) {
				columnName = dbColumn.value().trim();
				sqlTypeClass = dbColumn.sqlType();
			} else {
				if (isAnnotated) {
					return null;
				}
			}
		}

		if (StringUtil.isEmpty(columnName)) {
			// default annotation value
			columnName = columnNamingStrategy.convertPropertyNameToColumnName(property.getName());
		} else {
			if (!columnNamingStrategy.isStrictAnnotationNames()) {
				columnName = columnNamingStrategy.applyToColumnName(columnName);
			}
		}
		if (sqlTypeClass == SqlType.class) {
			sqlTypeClass = null;
		}

		return new DbEntityColumnDescriptor(
			dbEntityDescriptor,
			quoteIfRequired(columnName, columnNamingStrategy.isAlwaysQuoteNames(), columnNamingStrategy.getQuoteChar()),
			property.getName(),
			property.getType(),
			isId,
			sqlTypeClass);
	}

public
static
DbEntityColumnDescriptor
resolveColumnDescriptors
(
final
DbEntityDescriptor
dbEntityDescriptor
,
final
PropertyDescriptor
property
,
final
boolean
isAnnotated
,
final
ColumnNamingStrategy
columnNamingStrategy
)
{
String
columnName
=
;
boolean
isId
=
false
;
Class
<
extends
SqlType
>
sqlTypeClass
=
;
// read ID annotation
DbId
dbId
=
;
if
(
property
.
getFieldDescriptor
(
)
!=
)
{
dbId
=
property
.
getFieldDescriptor
(
)
.
getField
(
)
.
getAnnotation
(
DbId
.
class
)
;
}
if
(
dbId
==
&&
property
.
getReadMethodDescriptor
(
)
!=
)
{
dbId
=
property
.
getReadMethodDescriptor
(
)
.
getMethod
(
)
.
getAnnotation
(
DbId
.
class
)
;
}
if
(
dbId
==
&&
property
.
getWriteMethodDescriptor
(
)
!=
)
{
dbId
=
property
.
getWriteMethodDescriptor
(
)
.
getMethod
(
)
.
getAnnotation
(
DbId
.
class
)
;
}
if
(
dbId
!=
)
{
columnName
=
dbId
.
value
(
)
.
trim
(
)
;
sqlTypeClass
=
dbId
.
sqlType
(
)
;
isId
=
true
;
}
else
{
DbColumn
dbColumn
=
;
if
(
property
.
getFieldDescriptor
(
)
!=
)
{
dbColumn
=
property
.
getFieldDescriptor
(
)
.
getField
(
)
.
getAnnotation
(
DbColumn
.
class
)
;
}
if
(
dbColumn
==
&&
property
.
getReadMethodDescriptor
(
)
!=
)
{
dbColumn
=
property
.
getReadMethodDescriptor
(
)
.
getMethod
(
)
.
getAnnotation
(
DbColumn
.
class
)
;
}
if
(
dbColumn
==
&&
property
.
getWriteMethodDescriptor
(
)
!=
)
{
dbColumn
=
property
.
getWriteMethodDescriptor
(
)
.
getMethod
(
)
.
getAnnotation
(
DbColumn
.
class
)
;
}
if
(
dbColumn
!=
)
{
columnName
=
dbColumn
.
value
(
)
.
trim
(
)
;
sqlTypeClass
=
dbColumn
.
sqlType
(
)
;
}
else
{
if
(
isAnnotated
)
{
return
;
}
}
}
if
(
StringUtil
.
isEmpty
(
columnName
)
)
{
// default annotation value
columnName
=
columnNamingStrategy
.
convertPropertyNameToColumnName
(
property
.
getName
(
)
)
;
}
else
{
if
(
!
columnNamingStrategy
.
isStrictAnnotationNames
(
)
)
{
columnName
=
columnNamingStrategy
.
applyToColumnName
(
columnName
)
;
}
}
if
(
sqlTypeClass
==
SqlType
.
class
)
{
sqlTypeClass
=
;
}
return
new
DbEntityColumnDescriptor
(
dbEntityDescriptor
,
quoteIfRequired
(
columnName
,
columnNamingStrategy
.
isAlwaysQuoteNames
(
)
,
columnNamingStrategy
.
getQuoteChar
(
)
)
,
property
.
getName
(
)
,
property
.
getType
(
)
,
isId
,
sqlTypeClass
)
;
}

Resolves column descriptor from property. If property is annotated value will be read
from annotation. If property is not annotated, then property will be ignored
if entity is annotated. Otherwise, column name is generated from the property name.

Resolves column descriptor from property . If property is annotated value will be read from annotation . If property is not annotated then property will be ignored if entity is annotated . Otherwise column name is generated from the property name .


public void init(final long[] key, final long[] tweak) {
		final int newNw = key.length;

		// only create new arrays if the value of N{w} changes (different key size)
		if (nw != newNw) {
			nw = newNw;

			switch (nw) {
				case WORDS_4:
					pi = PI4;
					rpi = RPI4;
					r = R4;
					break;
				case WORDS_8:
					pi = PI8;
					rpi = RPI8;
					r = R8;
					break;
				case WORDS_16:
					pi = PI16;
					rpi = RPI16;
					r = R16;
					break;
				default:
					throw new RuntimeException("Invalid threefish key");
			}

			this.k = new long[nw + 1];

			// instantiation of these fields here for performance reasons
			vd = new long[nw]; // v is the intermediate value v{d} at round d
			ed = new long[nw]; // ed is the value of e{d} at round d
			fd = new long[nw]; // fd is the value of f{d} at round d
			ksd = new long[nw]; // ksd is the value of k{s} at round d
		}

		System.arraycopy(key, 0, this.k, 0, key.length);

		long knw = EXTENDED_KEY_SCHEDULE_CONST;
		for (int i = 0; i < nw; i++) {
			knw ^= this.k[i];
		}
		this.k[nw] = knw;

		// set tweak values
		t[0] = tweak[0];
		t[1] = tweak[1];
		t[2] = t[0] ^ t[1];
	}

Initialize the cipher using the key and the tweak value.

@param key the Threefish key to use
@param tweak the tweak values to use

Initialize the cipher using the key and the tweak value .


private void mix(final int j, final int d) {
		y[0] = x[0] + x[1];
		final long rotl = r[d % DEPTH_OF_D_IN_R][j];
		// java left rotation for a long
		y[1] = (x[1] << rotl) | (x[1] >>> (Long.SIZE - rotl));
		y[1] ^= y[0];
	}

private
void
mix
(
final
int
j
,
final
int
d
)
{
y
[
0
]
=
x
[
0
]
+
x
[
1
]
;
final
long
rotl
=
r
[
d
%
DEPTH_OF_D_IN_R
]
[
j
]
;
// java left rotation for a long
y
[
1
]
=
(
x
[
1
]
<<
rotl
)
|
(
x
[
1
]
>>>
(
Long
.
SIZE
rotl
)
)
;
y
[
1
]
^=
y
[
0
]
;
}

Implementation of the MIX function.

@param j the index in the rotation constants
@param d the round


private void demix(final int j, final int d) {
		y[1] ^= y[0];
		final long rotr = r[d % DEPTH_OF_D_IN_R][j]; // NOTE performance: darn, creation on stack!
		// right shift
		x[1] = (y[1] << (Long.SIZE - rotr)) | (y[1] >>> rotr);
		x[0] = y[0] - x[1];
	}

Implementation of the un - MIX function .


private void keySchedule(final int s) {
		for (int i = 0; i < nw; i++) {
			// just put in the main key first
			ksd[i] = k[(s + i) % (nw + 1)];

			// don't add anything for i = 0,...,Nw - 4
			if (i == nw - 3) { // second to last
				ksd[i] += t[s % TWEAK_VALUES];
			} else if (i == nw - 2) { // first to last
				ksd[i] += t[(s + 1) % TWEAK_VALUES];
			} else if (i == nw - 1) { // last
				ksd[i] += s;
			}
		}
	}

Creates the subkeys.

@param s the value of the round devided by 4


public void init(final String keyMessage, final long tweak1, final long tweak2) {
		long[] tweak = new long[] {tweak1, tweak2};
		byte[] key = new byte[blockSize / Byte.SIZE];
		byte[] keyData = StringUtil.getBytes(keyMessage);
		System.arraycopy(keyData, 0, key, 0, key.length < keyData.length ? key.length : keyData.length);
		init(bytesToLongs(key), tweak);
	}

public void init ( final String keyMessage , final long tweak1 , final long tweak2 ) { long [ ] tweak = new long [ ] { tweak1 , tweak2 } ; byte [ ] key = new byte [ blockSize / Byte . SIZE ] ; byte [ ] keyData = StringUtil . getBytes ( keyMessage ) ; System . arraycopy ( keyData , 0 , key , 0 , key . length < keyData . length ? key . length : keyData . length ) ; init ( bytesToLongs ( key ) , tweak ) ; }


@Override
	public byte[] encryptBlock(final byte[] content, final int offset) {

		long[] contentBlock = bytesToLongs(content, offset, blockSizeInBytes);

		long[] encryptedBlock = new long[blockSize / Long.SIZE];

		blockEncrypt(contentBlock, encryptedBlock);

		return longsToBytes(encryptedBlock);
	}

@ Override public byte [ ] encryptBlock ( final byte [ ] content , final int offset ) { long [ ] contentBlock = bytesToLongs ( content , offset , blockSizeInBytes ) ; long [ ] encryptedBlock = new long [ blockSize / Long . SIZE ] ; blockEncrypt ( contentBlock , encryptedBlock ) ; return longsToBytes ( encryptedBlock ) ; }


protected static long[] bytesToLongs(final byte[] ba, final int offset, final int size) {
		long[] result = new long[size >> 3];
		int i8 = offset;
		for (int i = 0; i < result.length; i++) {
			result[i] = Bits.getLong(ba, i8);
			i8 += 8;
		}
		return result;
	}

protected static long [ ] bytesToLongs ( final byte [ ] ba , final int offset , final int size ) { long [ ] result = new long [ size >> 3 ] ; int i8 = offset ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = Bits . getLong ( ba , i8 ) ; i8 += 8 ; } return result ; }

Converts segment of byte array into long array.

Converts segment of byte array into long array .


private static String removeAnyBounding(final char s, final char e, final String str) {
		if (str == null || str.length() < 2) {
			return str;
		}

		if (str.startsWith(String.valueOf(s)) && str.endsWith(String.valueOf(e))) {
			return str.substring(1, str.length() - 1);
		}

		return str;
	}

private static String removeAnyBounding ( final char s , final char e , final String str ) { if ( str == null || str . length ( ) < 2 ) { return str ; } if ( str . startsWith ( String . valueOf ( s ) ) && str . endsWith ( String . valueOf ( e ) ) ) { return str . substring ( 1 , str . length ( ) - 1 ) ; } return str ; }

If the string starts and ends with start and end char, remove them,
otherwise return the string as it was passed in.

If the string starts and ends with start and end char remove them otherwise return the string as it was passed in .


public String path() {
		if (methref != null) {
			final String methodName = methref.ref();
			return target.getName() + '#' + methodName;
		}
		return path;
	}

public String path ( ) { if ( methref != null ) { final String methodName = methref . ref ( ) ; return target . getName ( ) + ' ' + methodName ; } return path ; }


public static File zlib(final File file) throws IOException {
		if (file.isDirectory()) {
			throw new IOException("Can't zlib folder");
		}
		FileInputStream fis = new FileInputStream(file);
		Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION);

		String zlibFileName = file.getAbsolutePath() + ZLIB_EXT;

		DeflaterOutputStream dos = new DeflaterOutputStream(new FileOutputStream(zlibFileName), deflater);

		try {
			StreamUtil.copy(fis, dos);
		} finally {
			StreamUtil.close(dos);
			StreamUtil.close(fis);
		}

		return new File(zlibFileName);
	}

public
static
File
zlib
(
final
File
file
)
throws
IOException
{
if
(
file
.
isDirectory
(
)
)
{
throw
new
IOException
(
"Can't zlib folder"
)
;
}
FileInputStream
fis
=
new
FileInputStream
(
file
)
;
Deflater
deflater
=
new
Deflater
(
Deflater
.
BEST_COMPRESSION
)
;
String
zlibFileName
=
file
.
getAbsolutePath
(
)
+
ZLIB_EXT
;
DeflaterOutputStream
dos
=
new
DeflaterOutputStream
(
new
FileOutputStream
(
zlibFileName
)
,
deflater
)
;
try
{
StreamUtil
.
copy
(
fis
,
dos
)
;
}
finally
{
StreamUtil
.
close
(
dos
)
;
StreamUtil
.
close
(
fis
)
;
}
return
new
File
(
zlibFileName
)
;
}


public static File gzip(final File file) throws IOException {
		if (file.isDirectory()) {
			throw new IOException("Can't gzip folder");
		}
		FileInputStream fis = new FileInputStream(file);

		String gzipName = file.getAbsolutePath() + GZIP_EXT;

		GZIPOutputStream gzos = new GZIPOutputStream(new FileOutputStream(gzipName));
		try {
			StreamUtil.copy(fis, gzos);
		} finally {
			StreamUtil.close(gzos);
			StreamUtil.close(fis);
		}

		return new File(gzipName);
	}

public
static
File
gzip
(
final
File
file
)
throws
IOException
{
if
(
file
.
isDirectory
(
)
)
{
throw
new
IOException
(
"Can't gzip folder"
)
;
}
FileInputStream
fis
=
new
FileInputStream
(
file
)
;
String
gzipName
=
file
.
getAbsolutePath
(
)
+
GZIP_EXT
;
GZIPOutputStream
gzos
=
new
GZIPOutputStream
(
new
FileOutputStream
(
gzipName
)
)
;
try
{
StreamUtil
.
copy
(
fis
,
gzos
)
;
}
finally
{
StreamUtil
.
close
(
gzos
)
;
StreamUtil
.
close
(
fis
)
;
}
return
new
File
(
gzipName
)
;
}


public static File ungzip(final File file) throws IOException {
		String outFileName = FileNameUtil.removeExtension(file.getAbsolutePath());
		File out = new File(outFileName);
		out.createNewFile();

		FileOutputStream fos = new FileOutputStream(out);
		GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(file));
		try {
			StreamUtil.copy(gzis, fos);
		} finally {
			StreamUtil.close(fos);
			StreamUtil.close(gzis);
		}

		return out;
	}

public static File ungzip ( final File file ) throws IOException { String outFileName = FileNameUtil . removeExtension ( file . getAbsolutePath ( ) ) ; File out = new File ( outFileName ) ; out . createNewFile ( ) ; FileOutputStream fos = new FileOutputStream ( out ) ; GZIPInputStream gzis = new GZIPInputStream ( new FileInputStream ( file ) ) ; try { StreamUtil . copy ( gzis , fos ) ; } finally { StreamUtil . close ( fos ) ; StreamUtil . close ( gzis ) ; } return out ; }


public static List<String> listZip(final File zipFile) throws IOException {
		List<String> entries = new ArrayList<>();

		ZipFile zip = new ZipFile(zipFile);
		Enumeration zipEntries = zip.entries();

		while (zipEntries.hasMoreElements()) {
			ZipEntry entry = (ZipEntry) zipEntries.nextElement();
			String entryName = entry.getName();

			entries.add(entryName);
		}

		return Collections.unmodifiableList(entries);
	}

public static List < String > listZip ( final File zipFile ) throws IOException { List < String > entries = new ArrayList <> ( ) ; ZipFile zip = new ZipFile ( zipFile ) ; Enumeration zipEntries = zip . entries ( ) ; while ( zipEntries . hasMoreElements ( ) ) { ZipEntry entry = ( ZipEntry ) zipEntries . nextElement ( ) ; String entryName = entry . getName ( ) ; entries . add ( entryName ) ; } return Collections . unmodifiableList ( entries ) ; }


public static void unzip(final String zipFile, final String destDir, final String... patterns) throws IOException {
		unzip(new File(zipFile), new File(destDir), patterns);
	}

public static void unzip ( final String zipFile , final String destDir , final String ... patterns ) throws IOException { unzip ( new File ( zipFile ) , new File ( destDir ) , patterns ) ; }

Extracts zip file content to the target directory.
@see #unzip(java.io.File, java.io.File, String...)

Extracts zip file content to the target directory .


public static void addToZip(final ZipOutputStream zos, final File file, String path, final String comment, final boolean recursive) throws IOException {
		if (!file.exists()) {
			throw new FileNotFoundException(file.toString());
		}

		if (path == null) {
			path = file.getName();
		}

		while (path.length() != 0 && path.charAt(0) == '/') {
			path = path.substring(1);
		}

		boolean isDir = file.isDirectory();

		if (isDir) {
			// add folder record
			if (!StringUtil.endsWithChar(path, '/')) {
				path += '/';
			}
		}

		ZipEntry zipEntry = new ZipEntry(path);
		zipEntry.setTime(file.lastModified());

		if (comment != null) {
			zipEntry.setComment(comment);
		}

		if (isDir) {
			zipEntry.setSize(0);
			zipEntry.setCrc(0);
		}

		zos.putNextEntry(zipEntry);

		if (!isDir) {
			InputStream is = new FileInputStream(file);
			try {
				StreamUtil.copy(is, zos);
			} finally {
				StreamUtil.close(is);
			}
		}

		zos.closeEntry();

		// continue adding

		if (recursive && file.isDirectory()) {
			boolean noRelativePath = StringUtil.isEmpty(path);

			final File[] children = file.listFiles();

			if (children != null && children.length != 0) {
				for (File child : children) {
					String childRelativePath = (noRelativePath ? StringPool.EMPTY : path) + child.getName();
					addToZip(zos, child, childRelativePath, comment, recursive);
				}
			}
		}

	}

public
static
void
addToZip
(
final
ZipOutputStream
zos
,
final
File
file
,
String
path
,
final
String
comment
,
final
boolean
recursive
)
throws
IOException
{
if
(
!
file
.
exists
(
)
)
{
throw
new
FileNotFoundException
(
file
.
toString
(
)
)
;
}
if
(
path
==
)
{
path
=
file
.
getName
(
)
;
}
while
(
path
.
length
(
)
!=
0
&&
path
.
charAt
(
0
)
==
'
'
)
{
path
=
path
.
substring
(
1
)
;
}
boolean
isDir
=
file
.
isDirectory
(
)
;
if
(
isDir
)
{
// add folder record
if
(
!
StringUtil
.
endsWithChar
(
path
,
'
'
)
)
{
path
+=
'
'
;
}
}
ZipEntry
zipEntry
=
new
ZipEntry
(
path
)
;
zipEntry
.
setTime
(
file
.
lastModified
(
)
)
;
if
(
comment
!=
)
{
zipEntry
.
setComment
(
comment
)
;
}
if
(
isDir
)
{
zipEntry
.
setSize
(
0
)
;
zipEntry
.
setCrc
(
0
)
;
}
zos
.
putNextEntry
(
zipEntry
)
;
if
(
!
isDir
)
{
InputStream
is
=
new
FileInputStream
(
file
)
;
try
{
StreamUtil
.
copy
(
is
,
zos
)
;
}
finally
{
StreamUtil
.
close
(
is
)
;
}
}
zos
.
closeEntry
(
)
;
// continue adding
if
(
recursive
&&
file
.
isDirectory
(
)
)
{
boolean
noRelativePath
=
StringUtil
.
isEmpty
(
path
)
;
final
File
[
]
children
=
file
.
listFiles
(
)
;
if
(
children
!=
&&
children
.
length
!=
0
)
{
for
(
File
child
:
children
)
{
String
childRelativePath
=
(
noRelativePath
StringPool
.
EMPTY
:
path
)
+
child
.
getName
(
)
;
addToZip
(
zos
,
child
,
childRelativePath
,
comment
,
recursive
)
;
}
}
}
}

Adds single entry to ZIP output stream.

@param zos zip output stream
@param file file or folder to add
@param path relative path of file entry; if null files name will be used instead
@param comment optional comment
@param recursive when set to true content of added folders will be added, too

Adds single entry to ZIP output stream .


public static void addToZip(final ZipOutputStream zos, final byte[] content, String path, final String comment) throws IOException {
		while (path.length() != 0 && path.charAt(0) == '/') {
			path = path.substring(1);
		}

		if (StringUtil.endsWithChar(path, '/')) {
			path = path.substring(0, path.length() - 1);
		}

		ZipEntry zipEntry = new ZipEntry(path);
		zipEntry.setTime(System.currentTimeMillis());

		if (comment != null) {
			zipEntry.setComment(comment);
		}

		zos.putNextEntry(zipEntry);

		InputStream is = new ByteArrayInputStream(content);
		try {
			StreamUtil.copy(is, zos);
		} finally {
			StreamUtil.close(is);
		}

		zos.closeEntry();
	}

public static void addToZip ( final ZipOutputStream zos , final byte [ ] content , String path , final String comment ) throws IOException { while ( path . length ( ) != 0 && path . charAt ( 0 ) == ' ' ) { path = path . substring ( 1 ) ; } if ( StringUtil . endsWithChar ( path , ' ' ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } ZipEntry zipEntry = new ZipEntry ( path ) ; zipEntry . setTime ( System . currentTimeMillis ( ) ) ; if ( comment != null ) { zipEntry . setComment ( comment ) ; } zos . putNextEntry ( zipEntry ) ; InputStream is = new ByteArrayInputStream ( content ) ; try { StreamUtil . copy ( is , zos ) ; } finally { StreamUtil . close ( is ) ; } zos . closeEntry ( ) ; }

Adds byte content into the zip as a file.

Adds byte content into the zip as a file .


public FieldDescriptor getFieldDescriptor(final String name, final boolean declared) {
		final FieldDescriptor fieldDescriptor = getFields().getFieldDescriptor(name);

		if (fieldDescriptor != null) {
			if (!fieldDescriptor.matchDeclared(declared)) {
				return null;
			}
		}

		return fieldDescriptor;
	}

public FieldDescriptor getFieldDescriptor ( final String name , final boolean declared ) { final FieldDescriptor fieldDescriptor = getFields ( ) . getFieldDescriptor ( name ) ; if ( fieldDescriptor != null ) { if ( ! fieldDescriptor . matchDeclared ( declared ) ) { return null ; } } return fieldDescriptor ; }


public PropertyDescriptor getPropertyDescriptor(final String name, final boolean declared) {
		PropertyDescriptor propertyDescriptor = getProperties().getPropertyDescriptor(name);

		if ((propertyDescriptor != null) && propertyDescriptor.matchDeclared(declared)) {
			return propertyDescriptor;
		}

		return null;
	}

public PropertyDescriptor getPropertyDescriptor ( final String name , final boolean declared ) { PropertyDescriptor propertyDescriptor = getProperties ( ) . getPropertyDescriptor ( name ) ; if ( ( propertyDescriptor != null ) && propertyDescriptor . matchDeclared ( declared ) ) { return propertyDescriptor ; } return null ; }

Returns property descriptor. Declared flag is matched on both read and write
methods.

Returns property descriptor . Declared flag is matched on both read and write methods .


public static void setRequestBundleName(final ServletRequest request, final String bundleName) {
		if (log.isDebugEnabled()) {
			log.debug("Bundle name for this request: " + bundleName);
		}
		request.setAttribute(REQUEST_BUNDLE_NAME_ATTR, bundleName);
	}

public
static
void
setRequestBundleName
(
final
ServletRequest
request
,
final
String
bundleName
)
{
if
(
log
.
isDebugEnabled
(
)
)
{
log
.
debug
(
"Bundle name for this request: "
+
bundleName
)
;
}
request
.
setAttribute
(
REQUEST_BUNDLE_NAME_ATTR
,
bundleName
)
;
}

Sets bundle name for provided servlet request.

Sets bundle name for provided servlet request .


public static void setSessionLocale(final HttpSession session, final String localeCode) {
		if (log.isDebugEnabled()) {
			log.debug("Locale stored to session: " + localeCode);
		}
		Locale locale = Locale.forLanguageTag(localeCode);
		session.setAttribute(SESSION_LOCALE_ATTR, locale);
	}

public
static
void
setSessionLocale
(
final
HttpSession
session
,
final
String
localeCode
)
{
if
(
log
.
isDebugEnabled
(
)
)
{
log
.
debug
(
"Locale stored to session: "
+
localeCode
)
;
}
Locale
locale
=
Locale
.
forLanguageTag
(
localeCode
)
;
session
.
setAttribute
(
SESSION_LOCALE_ATTR
,
locale
)
;
}


public static Locale getSessionLocale(final HttpSession session) {
		Locale locale = (Locale) session.getAttribute(SESSION_LOCALE_ATTR);
		return locale == null ? MESSAGE_RESOLVER.getFallbackLocale() : locale;
	}

public static Locale getSessionLocale ( final HttpSession session ) { Locale locale = ( Locale ) session . getAttribute ( SESSION_LOCALE_ATTR ) ; return locale == null ? MESSAGE_RESOLVER . getFallbackLocale ( ) : locale ; }


public String[] filterParametersForBeanName(String beanName, final boolean resolveReferenceParams) {
		beanName = beanName + '.';

		List<String> list = new ArrayList<>();
		for (Map.Entry<String, Object> entry : params.entrySet()) {
			String key = entry.getKey();
			if (!key.startsWith(beanName)) {
				continue;
			}
			list.add(key);
			if (!resolveReferenceParams) {
				continue;
			}
			// resolve all references
			String value = PropertiesUtil.resolveProperty(params, key);
			entry.setValue(value);
		}
		if (list.isEmpty()) {
			return StringPool.EMPTY_ARRAY;
		} else {
			return list.toArray(new String[0]);
		}
	}

public
String
[
]
filterParametersForBeanName
(
String
beanName
,
final
boolean
resolveReferenceParams
)
{
beanName
=
beanName
+
'
'
;
List
<
String
>
list
=
new
ArrayList
<>
(
)
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
params
.
entrySet
(
)
)
{
String
key
=
entry
.
getKey
(
)
;
if
(
!
key
.
startsWith
(
beanName
)
)
{
continue
;
}
list
.
add
(
key
)
;
if
(
!
resolveReferenceParams
)
{
continue
;
}
// resolve all references
String
value
=
PropertiesUtil
.
resolveProperty
(
params
,
key
)
;
entry
.
setValue
(
value
)
;
}
if
(
list
.
isEmpty
(
)
)
{
return
StringPool
.
EMPTY_ARRAY
;
}
else
{
return
list
.
toArray
(
new
String
[
0
]
)
;
}
}

Returns an array of param keys that belongs to provided bean.
Optionally resolves the value of returned parameters.

Returns an array of param keys that belongs to provided bean . Optionally resolves the value of returned parameters .


public PropsEntries profile(final String... profiles) {
		if (profiles == null) {
			return this;
		}
		for (String profile : profiles) {
			addProfiles(profile);
		}
		return this;
	}

public PropsEntries profile ( final String ... profiles ) { if ( profiles == null ) { return this ; } for ( String profile : profiles ) { addProfiles ( profile ) ; } return this ; }


public static long getLongLittleEndian(final byte[] buf, final int offset) {
		return ((long) buf[offset + 7] << 56)   // no mask needed
			| ((buf[offset + 6] & 0xffL) << 48)
			| ((buf[offset + 5] & 0xffL) << 40)
			| ((buf[offset + 4] & 0xffL) << 32)
			| ((buf[offset + 3] & 0xffL) << 24)
			| ((buf[offset + 2] & 0xffL) << 16)
			| ((buf[offset + 1] & 0xffL) << 8)
			| ((buf[offset] & 0xffL));        // no shift needed
	}

public
static
long
getLongLittleEndian
(
final
byte
[
]
buf
,
final
int
offset
)
{
return
(
(
long
)
buf
[
offset
+
7
]
<<
56
)
// no mask needed
|
(
(
buf
[
offset
+
6
]
&
0xff
L
)
<<
48
)
|
(
(
buf
[
offset
+
5
]
&
0xff
L
)
<<
40
)
|
(
(
buf
[
offset
+
4
]
&
0xff
L
)
<<
32
)
|
(
(
buf
[
offset
+
3
]
&
0xff
L
)
<<
24
)
|
(
(
buf
[
offset
+
2
]
&
0xff
L
)
<<
16
)
|
(
(
buf
[
offset
+
1
]
&
0xff
L
)
<<
8
)
|
(
(
buf
[
offset
]
&
0xff
L
)
)
;
// no shift needed
}

Gets a long from a byte buffer in little endian byte order.

Gets a long from a byte buffer in little endian byte order .


private static byte[] readStream(final InputStream inputStream, final boolean close)
      throws IOException {
    if (inputStream == null) {
      throw new IOException("Class not found");
    }
    try {
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      byte[] data = new byte[INPUT_STREAM_DATA_CHUNK_SIZE];
      int bytesRead;
      while ((bytesRead = inputStream.read(data, 0, data.length)) != -1) {
        outputStream.write(data, 0, bytesRead);
      }
      outputStream.flush();
      return outputStream.toByteArray();
    } finally {
      if (close) {
        inputStream.close();
      }
    }
  }

private
static
byte
[
]
readStream
(
final
InputStream
inputStream
,
final
boolean
close
)
throws
IOException
{
if
(
inputStream
==
)
{
throw
new
IOException
(
"Class not found"
)
;
}
try
{
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
(
)
;
byte
[
]
data
=
new
byte
[
INPUT_STREAM_DATA_CHUNK_SIZE
]
;
int
bytesRead
;
while
(
(
bytesRead
=
inputStream
.
read
(
data
,
0
,
data
.
length
)
)
!=
1
)
{
outputStream
.
write
(
data
,
0
,
bytesRead
)
;
}
outputStream
.
flush
(
)
;
return
outputStream
.
toByteArray
(
)
;
}
finally
{
if
(
close
)
{
inputStream
.
close
(
)
;
}
}
}

Reads the given input stream and returns its content as a byte array.

@param inputStream an input stream.
@param close true to close the input stream after reading.
@return the content of the given input stream.
@throws IOException if a problem occurs during reading.

Reads the given input stream and returns its content as a byte array .


protected Label readLabel(final int bytecodeOffset, final Label[] labels) {
    if (labels[bytecodeOffset] == null) {
      labels[bytecodeOffset] = new Label();
    }
    return labels[bytecodeOffset];
  }

protected Label readLabel ( final int bytecodeOffset , final Label [ ] labels ) { if ( labels [ bytecodeOffset ] == null ) { labels [ bytecodeOffset ] = new Label ( ) ; } return labels [ bytecodeOffset ] ; }

Returns the label corresponding to the given bytecode offset. The default implementation of
this method creates a label for the given offset if it has not been already created.

@param bytecodeOffset a bytecode offset in a method.
@param labels the already created labels, indexed by their offset. If a label already exists
for bytecodeOffset this method must not create a new one. Otherwise it must store the new
label in this array.
@return a non null Label, which must be equal to labels[bytecodeOffset].

Returns the label corresponding to the given bytecode offset . The default implementation of this method creates a label for the given offset if it has not been already created .


private int getTypeAnnotationBytecodeOffset(
      final int[] typeAnnotationOffsets, final int typeAnnotationIndex) {
    if (typeAnnotationOffsets == null
        || typeAnnotationIndex >= typeAnnotationOffsets.length
        || readByte(typeAnnotationOffsets[typeAnnotationIndex]) < TypeReference.INSTANCEOF) {
      return -1;
    }
    return readUnsignedShort(typeAnnotationOffsets[typeAnnotationIndex] + 1);
  }

private int getTypeAnnotationBytecodeOffset ( final int [ ] typeAnnotationOffsets , final int typeAnnotationIndex ) { if ( typeAnnotationOffsets == null || typeAnnotationIndex >= typeAnnotationOffsets . length || readByte ( typeAnnotationOffsets [ typeAnnotationIndex ] ) < TypeReference . INSTANCEOF ) { return - 1 ; } return readUnsignedShort ( typeAnnotationOffsets [ typeAnnotationIndex ] + 1 ) ; }

Returns the bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or
-1 if there is no such type_annotation of if it does not have a bytecode offset.

@param typeAnnotationOffsets the offset of each 'type_annotation' entry in a
Runtime[In]VisibleTypeAnnotations attribute, or null.
@param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets.
@return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1
if there is no such type_annotation of if it does not have a bytecode offset.

Returns the bytecode offset corresponding to the specified JVMS type_annotation structure or - 1 if there is no such type_annotation of if it does not have a bytecode offset .


private int readElementValues(
      final AnnotationVisitor annotationVisitor,
      final int annotationOffset,
      final boolean named,
      final char[] charBuffer) {
    int currentOffset = annotationOffset;
    // Read the num_element_value_pairs field (or num_values field for an array_value).
    int numElementValuePairs = readUnsignedShort(currentOffset);
    currentOffset += 2;
    if (named) {
      // Parse the element_value_pairs array.
      while (numElementValuePairs-- > 0) {
        String elementName = readUTF8(currentOffset, charBuffer);
        currentOffset =
            readElementValue(annotationVisitor, currentOffset + 2, elementName, charBuffer);
      }
    } else {
      // Parse the array_value array.
      while (numElementValuePairs-- > 0) {
        currentOffset =
            readElementValue(annotationVisitor, currentOffset, /* named = */ null, charBuffer);
      }
    }
    if (annotationVisitor != null) {
      annotationVisitor.visitEnd();
    }
    return currentOffset;
  }

Reads the element values of a JVMS 'annotation' structure and makes the given visitor visit
them. This method can also be used to read the values of the JVMS 'array_value' field of an
annotation's 'element_value'.

@param annotationVisitor the visitor that must visit the values.
@param annotationOffset the start offset of an 'annotation' structure (excluding its type_index
field) or of an 'array_value' structure.
@param named if the annotation values are named or not. This should be true to parse the values
of a JVMS 'annotation' structure, and false to parse the JVMS 'array_value' of an
annotation's element_value.
@param charBuffer the buffer used to read strings in the constant pool.
@return the end offset of the JVMS 'annotation' or 'array_value' structure.

Reads the element values of a JVMS annotation structure and makes the given visitor visit them . This method can also be used to read the values of the JVMS array_value field of an annotation s element_value .


private int readVerificationTypeInfo(
      final int verificationTypeInfoOffset,
      final Object[] frame,
      final int index,
      final char[] charBuffer,
      final Label[] labels) {
    int currentOffset = verificationTypeInfoOffset;
    int tag = b[currentOffset++] & 0xFF;
    switch (tag) {
      case Frame.ITEM_TOP:
        frame[index] = Opcodes.TOP;
        break;
      case Frame.ITEM_INTEGER:
        frame[index] = Opcodes.INTEGER;
        break;
      case Frame.ITEM_FLOAT:
        frame[index] = Opcodes.FLOAT;
        break;
      case Frame.ITEM_DOUBLE:
        frame[index] = Opcodes.DOUBLE;
        break;
      case Frame.ITEM_LONG:
        frame[index] = Opcodes.LONG;
        break;
      case Frame.ITEM_NULL:
        frame[index] = Opcodes.NULL;
        break;
      case Frame.ITEM_UNINITIALIZED_THIS:
        frame[index] = Opcodes.UNINITIALIZED_THIS;
        break;
      case Frame.ITEM_OBJECT:
        frame[index] = readClass(currentOffset, charBuffer);
        currentOffset += 2;
        break;
      case Frame.ITEM_UNINITIALIZED:
        frame[index] = createLabel(readUnsignedShort(currentOffset), labels);
        currentOffset += 2;
        break;
      default:
        throw new IllegalArgumentException();
    }
    return currentOffset;
  }

private int readVerificationTypeInfo ( final int verificationTypeInfoOffset , final Object [ ] frame , final int index , final char [ ] charBuffer , final Label [ ] labels ) { int currentOffset = verificationTypeInfoOffset ; int tag = b [ currentOffset ++ ] & 0xFF ; switch ( tag ) { case Frame . ITEM_TOP : frame [ index ] = Opcodes . TOP ; break ; case Frame . ITEM_INTEGER : frame [ index ] = Opcodes . INTEGER ; break ; case Frame . ITEM_FLOAT : frame [ index ] = Opcodes . FLOAT ; break ; case Frame . ITEM_DOUBLE : frame [ index ] = Opcodes . DOUBLE ; break ; case Frame . ITEM_LONG : frame [ index ] = Opcodes . LONG ; break ; case Frame . ITEM_NULL : frame [ index ] = Opcodes . NULL ; break ; case Frame . ITEM_UNINITIALIZED_THIS : frame [ index ] = Opcodes . UNINITIALIZED_THIS ; break ; case Frame . ITEM_OBJECT : frame [ index ] = readClass ( currentOffset , charBuffer ) ; currentOffset += 2 ; break ; case Frame . ITEM_UNINITIALIZED : frame [ index ] = createLabel ( readUnsignedShort ( currentOffset ) , labels ) ; currentOffset += 2 ; break ; default : throw new IllegalArgumentException ( ) ; } return currentOffset ; }

Reads a JVMS 'verification_type_info' structure and stores it at the given index in the given
array.

@param verificationTypeInfoOffset the start offset of the 'verification_type_info' structure to
read.
@param frame the array where the parsed type must be stored.
@param index the index in 'frame' where the parsed type must be stored.
@param charBuffer the buffer used to read strings in the constant pool.
@param labels the labels of the method currently being parsed, indexed by their offset. If the
parsed type is an ITEM_Uninitialized, a new label for the corresponding NEW instruction is
stored in this array if it does not already exist.
@return the end offset of the JVMS 'verification_type_info' structure.

Reads a JVMS verification_type_info structure and stores it at the given index in the given array .


private int[] readBootstrapMethodsAttribute(final int maxStringLength) {
    char[] charBuffer = new char[maxStringLength];
    int currentAttributeOffset = getFirstAttributeOffset();
    int[] currentBootstrapMethodOffsets = null;
    for (int i = readUnsignedShort(currentAttributeOffset - 2); i > 0; --i) {
      // Read the attribute_info's attribute_name and attribute_length fields.
      String attributeName = readUTF8(currentAttributeOffset, charBuffer);
      int attributeLength = readInt(currentAttributeOffset + 2);
      currentAttributeOffset += 6;
      if (Constants.BOOTSTRAP_METHODS.equals(attributeName)) {
        // Read the num_bootstrap_methods field and create an array of this size.
        currentBootstrapMethodOffsets = new int[readUnsignedShort(currentAttributeOffset)];
        // Compute and store the offset of each 'bootstrap_methods' array field entry.
        int currentBootstrapMethodOffset = currentAttributeOffset + 2;
        for (int j = 0; j < currentBootstrapMethodOffsets.length; ++j) {
          currentBootstrapMethodOffsets[j] = currentBootstrapMethodOffset;
          // Skip the bootstrap_method_ref and num_bootstrap_arguments fields (2 bytes each),
          // as well as the bootstrap_arguments array field (of size num_bootstrap_arguments * 2).
          currentBootstrapMethodOffset +=
              4 + readUnsignedShort(currentBootstrapMethodOffset + 2) * 2;
        }
        return currentBootstrapMethodOffsets;
      }
      currentAttributeOffset += attributeLength;
    }
    return null;
  }

Reads the BootstrapMethods attribute to compute the offset of each bootstrap method.

@param maxStringLength a conservative estimate of the maximum length of the strings contained
in the constant pool of the class.
@return the offsets of the bootstrap methods or null.

Reads the BootstrapMethods attribute to compute the offset of each bootstrap method .


protected CtorDescriptor[] inspectConstructors() {
		Class type = classDescriptor.getType();
		Constructor[] ctors = type.getDeclaredConstructors();

		CtorDescriptor[] allCtors = new CtorDescriptor[ctors.length];

		for (int i = 0; i < ctors.length; i++) {
			Constructor ctor = ctors[i];

			CtorDescriptor ctorDescriptor = createCtorDescriptor(ctor);
			allCtors[i] = ctorDescriptor;

			if (ctorDescriptor.isDefault()) {
				defaultCtor = ctorDescriptor;
			}
		}

		return allCtors;
	}

protected CtorDescriptor [ ] inspectConstructors ( ) { Class type = classDescriptor . getType ( ) ; Constructor [ ] ctors = type . getDeclaredConstructors ( ) ; CtorDescriptor [ ] allCtors = new CtorDescriptor [ ctors . length ] ; for ( int i = 0 ; i < ctors . length ; i ++ ) { Constructor ctor = ctors [ i ] ; CtorDescriptor ctorDescriptor = createCtorDescriptor ( ctor ) ; allCtors [ i ] = ctorDescriptor ; if ( ctorDescriptor . isDefault ( ) ) { defaultCtor = ctorDescriptor ; } } return allCtors ; }

Inspects all declared constructors of a target type.

Inspects all declared constructors of a target type .


public CtorDescriptor getCtorDescriptor(final Class... args) {
		ctors:
		for (CtorDescriptor ctorDescriptor : allCtors) {
			Class[] arg = ctorDescriptor.getParameters();

			if (arg.length != args.length) {
				continue;
			}

			for (int j = 0; j < arg.length; j++) {
				if (arg[j] != args[j]) {
					continue ctors;
				}
			}

			return ctorDescriptor;
		}
		return null;
	}

public CtorDescriptor getCtorDescriptor ( final Class ... args ) { ctors : for ( CtorDescriptor ctorDescriptor : allCtors ) { Class [ ] arg = ctorDescriptor . getParameters ( ) ; if ( arg . length != args . length ) { continue ; } for ( int j = 0 ; j < arg . length ; j ++ ) { if ( arg [ j ] != args [ j ] ) { continue ctors ; } } return ctorDescriptor ; } return null ; }

Finds constructor description that matches given argument types.

Finds constructor description that matches given argument types .


@SuppressWarnings("unchecked")
	protected Map<String, TransientBeanData> getRequestMap(final HttpServletRequest servletRequest) {
		return (Map<String, TransientBeanData>) servletRequest.getAttribute(ATTR_NAME);
	}

@ SuppressWarnings ( "unchecked" ) protected Map < String , TransientBeanData > getRequestMap ( final HttpServletRequest servletRequest ) { return ( Map < String , TransientBeanData > ) servletRequest . getAttribute ( ATTR_NAME ) ; }

Returns instance map from http request .


protected Map<String, TransientBeanData> createRequestMap(final HttpServletRequest servletRequest) {
		Map<String, TransientBeanData> map = new HashMap<>();
		servletRequest.setAttribute(ATTR_NAME, map);
		return map;
	}

protected Map < String , TransientBeanData > createRequestMap ( final HttpServletRequest servletRequest ) { Map < String , TransientBeanData > map = new HashMap <> ( ) ; servletRequest . setAttribute ( ATTR_NAME , map ) ; return map ; }

Creates instance map and stores it in the request.

Creates instance map and stores it in the request .


protected long[] convertArrayToArray(final Object value) {
		final Class valueComponentType = value.getClass().getComponentType();

		final long[] result;

		if (valueComponentType.isPrimitive()) {
			result = convertPrimitiveArrayToArray(value, valueComponentType);
		} else {
			// convert object array to target array
			final Object[] array = (Object[]) value;
			result = new long[array.length];

			for (int i = 0; i < array.length; i++) {
				result[i] = convertType(array[i]);
			}
		}

		return result;
	}

protected
long
[
]
convertArrayToArray
(
final
Object
value
)
{
final
Class
valueComponentType
=
value
.
getClass
(
)
.
getComponentType
(
)
;
final
long
[
]
result
;
if
(
valueComponentType
.
isPrimitive
(
)
)
{
result
=
convertPrimitiveArrayToArray
(
value
,
valueComponentType
)
;
}
else
{
// convert object array to target array
final
Object
[
]
array
=
(
Object
[
]
)
value
;
result
=
new
long
[
array
.
length
]
;
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++
)
{
result
[
i
]
=
convertType
(
array
[
i
]
)
;
}
}
return
result
;
}


@Override
	public void init(final FilterConfig filterConfig) throws ServletException {

		//

		final String decoraManagerClass = filterConfig.getInitParameter(PARAM_DECORA_MANAGER);

		if (decoraManagerClass != null) {
			try {
				final Class decoraManagerType = ClassLoaderUtil.loadClass(decoraManagerClass);
				decoraManager = (DecoraManager) ClassUtil.newInstance(decoraManagerType);
			} catch (Exception ex) {
				log.error("Unable to load Decora manager class: " + decoraManagerClass, ex);
				throw new ServletException(ex);
			}
		} else {
			decoraManager = createDecoraManager();
		}

		//

		final String decoraParserClass = filterConfig.getInitParameter(PARAM_DECORA_PARSER);

		if (decoraParserClass != null) {
			try {
				final Class decoraParserType = ClassLoaderUtil.loadClass(decoraParserClass);
				decoraParser = (DecoraParser) ClassUtil.newInstance(decoraParserType);
			} catch (Exception ex) {
				log.error("Unable to load Decora parser class: " + decoraParserClass, ex);
				throw new ServletException(ex);
			}
		} else {
			decoraParser = createDecoraParser();
		}

		//

		final String decoraCache = filterConfig.getInitParameter(PARAM_DECORA_CACHE);

		if (decoraCache != null) {
			cached = Converter.get().toBoolean(decoraCache, false);
		}
	}

@
Override
public
void
init
(
final
FilterConfig
filterConfig
)
throws
ServletException
{
//
final
String
decoraManagerClass
=
filterConfig
.
getInitParameter
(
PARAM_DECORA_MANAGER
)
;
if
(
decoraManagerClass
!=
)
{
try
{
final
Class
decoraManagerType
=
ClassLoaderUtil
.
loadClass
(
decoraManagerClass
)
;
decoraManager
=
(
DecoraManager
)
ClassUtil
.
newInstance
(
decoraManagerType
)
;
}
catch
(
Exception
ex
)
{
log
.
error
(
"Unable to load Decora manager class: "
+
decoraManagerClass
,
ex
)
;
throw
new
ServletException
(
ex
)
;
}
}
else
{
decoraManager
=
createDecoraManager
(
)
;
}
//
final
String
decoraParserClass
=
filterConfig
.
getInitParameter
(
PARAM_DECORA_PARSER
)
;
if
(
decoraParserClass
!=
)
{
try
{
final
Class
decoraParserType
=
ClassLoaderUtil
.
loadClass
(
decoraParserClass
)
;
decoraParser
=
(
DecoraParser
)
ClassUtil
.
newInstance
(
decoraParserType
)
;
}
catch
(
Exception
ex
)
{
log
.
error
(
"Unable to load Decora parser class: "
+
decoraParserClass
,
ex
)
;
throw
new
ServletException
(
ex
)
;
}
}
else
{
decoraParser
=
createDecoraParser
(
)
;
}
//
final
String
decoraCache
=
filterConfig
.
getInitParameter
(
PARAM_DECORA_CACHE
)
;
if
(
decoraCache
!=
)
{
cached
=
Converter
.
get
(
)
.
toBoolean
(
decoraCache
,
false
)
;
}
}

Initializes Decora filter. Loads manager and parser from init parameters.

Initializes Decora filter . Loads manager and parser from init parameters .


public FindFile onFile(final Consumer<File> fileConsumer) {
		if (consumers == null) {
			consumers = Consumers.of(fileConsumer);
		}
		else {
			consumers.add(fileConsumer);
		}
		return this;
	}

public FindFile onFile ( final Consumer < File > fileConsumer ) { if ( consumers == null ) { consumers = Consumers . of ( fileConsumer ) ; } else { consumers . add ( fileConsumer ) ; } return this ; }


public FindFile searchPath(final URI searchPath) {
		File file;
		try {
			file = new File(searchPath);
		} catch (Exception ex) {
			throw new FindFileException("URI error: " + searchPath, ex);
		}

		addPath(file);

		return this;
	}

public
FindFile
searchPath
(
final
URI
searchPath
)
{
File
file
;
try
{
file
=
new
File
(
searchPath
)
;
}
catch
(
Exception
ex
)
{
throw
new
FindFileException
(
"URI error: "
+
searchPath
,
ex
)
;
}
addPath
(
file
)
;
return
this
;
}

Specifies the search path. Throws an exception if URI is invalid.

Specifies the search path . Throws an exception if URI is invalid .


public FindFile searchPath(final URL searchPath) {
		File file = FileUtil.toContainerFile(searchPath);
		if (file == null) {
			throw new FindFileException("URL error: " + searchPath);
		}
		addPath(file);
		return this;
	}

public
FindFile
searchPath
(
final
URL
searchPath
)
{
File
file
=
FileUtil
.
toContainerFile
(
searchPath
)
;
if
(
file
==
)
{
throw
new
FindFileException
(
"URL error: "
+
searchPath
)
;
}
addPath
(
file
)
;
return
this
;
}

Specifies the search path. Throws an exception if URL is invalid.

Specifies the search path . Throws an exception if URL is invalid .


public FindFile include(final String... patterns) {
		for (String pattern : patterns) {
			rules.include(pattern);
		}
		return this;
	}

public FindFile include ( final String ... patterns ) { for ( String pattern : patterns ) { rules . include ( pattern ) ; } return this ; }


public FindFile exclude(final String... patterns) {
		for (String pattern : patterns) {
			rules.exclude(pattern);
		}
		return this;
	}

public FindFile exclude ( final String ... patterns ) { for ( String pattern : patterns ) { rules . exclude ( pattern ) ; } return this ; }


protected void addPath(final File path) {
		if (!path.exists()) {
			return;
		}
		if (pathList == null) {
			pathList = new LinkedList<>();
		}

		pathList.add(path);
	}

protected void addPath ( final File path ) { if ( ! path . exists ( ) ) { return ; } if ( pathList == null ) { pathList = new LinkedList <> ( ) ; } pathList . add ( path ) ; }

Adds existing search path to the file list.
Non existing files are ignored.
If path is a folder, it will be scanned for all files.

Adds existing search path to the file list . Non existing files are ignored . If path is a folder it will be scanned for all files .


public List<File> findAll() {
		List<File> allFiles = new ArrayList<>();
		File file;
		while ((file = nextFile()) != null) {
			allFiles.add(file);
		}
		return allFiles;
	}

public List < File > findAll ( ) { List < File > allFiles = new ArrayList <> ( ) ; File file ; while ( ( file = nextFile ( ) ) != null ) { allFiles . add ( file ) ; } return allFiles ; }

Finds all files and returns list of founded files.

Finds all files and returns list of founded files .


protected void init() {
		rules.detectMode();

		todoFiles = new LinkedList<>();
		todoFolders = new LinkedList<>();

		if (pathList == null) {
			pathList = new LinkedList<>();
			return;
		}

		if (pathListOriginal == null) {
			pathListOriginal = (LinkedList<File>) pathList.clone();
		}
		String[] files = new String[pathList.size()];

		int index = 0;
		Iterator<File> iterator = pathList.iterator();
		while (iterator.hasNext()) {
			File file = iterator.next();

			if (file.isFile()) {
				files[index++] = file.getAbsolutePath();
				iterator.remove();
			}
		}

		if (index != 0) {
			FilesIterator filesIterator = new FilesIterator(files);
			todoFiles.add(filesIterator);
		}
	}

protected void init ( ) { rules . detectMode ( ) ; todoFiles = new LinkedList <> ( ) ; todoFolders = new LinkedList <> ( ) ; if ( pathList == null ) { pathList = new LinkedList <> ( ) ; return ; } if ( pathListOriginal == null ) { pathListOriginal = ( LinkedList < File > ) pathList . clone ( ) ; } String [ ] files = new String [ pathList . size ( ) ] ; int index = 0 ; Iterator < File > iterator = pathList . iterator ( ) ; while ( iterator . hasNext ( ) ) { File file = iterator . next ( ) ; if ( file . isFile ( ) ) { files [ index ++ ] = file . getAbsolutePath ( ) ; iterator . remove ( ) ; } } if ( index != 0 ) { FilesIterator filesIterator = new FilesIterator ( files ) ; todoFiles . add ( filesIterator ) ; } }

Initializes file walking.
Separates input files and folders.

Initializes file walking . Separates input files and folders .


@Override
	public Iterator<File> iterator() {

		return new Iterator<File>() {
			private File nextFile;

			@Override
			public boolean hasNext() {
				nextFile = nextFile();
				return nextFile != null;
			}

			@Override
			public File next() {
				if (nextFile == null) {
					throw new NoSuchElementException();
				}
				return nextFile;
			}

			@Override
			public void remove() {
				throw new UnsupportedOperationException();
			}
		};
	}

@ Override public Iterator < File > iterator ( ) { return new Iterator < File > ( ) { private File nextFile ; @ Override public boolean hasNext ( ) { nextFile = nextFile ( ) ; return nextFile != null ; } @ Override public File next ( ) { if ( nextFile == null ) { throw new NoSuchElementException ( ) ; } return nextFile ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; }


public WiringMode resolveBeanWiringMode(final Class type) {
		PetiteBean petiteBean = ((Class<?>) type).getAnnotation(PetiteBean.class);
		return petiteBean != null ? petiteBean.wiring() : WiringMode.DEFAULT;
	}

public WiringMode resolveBeanWiringMode ( final Class type ) { PetiteBean petiteBean = ( ( Class < ? > ) type ) . getAnnotation ( PetiteBean . class ) ; return petiteBean != null ? petiteBean . wiring ( ) : WiringMode . DEFAULT ; }

Resolves bean's auto-wire flag from the annotation. Returns default auto-wire if annotation doesn't exist.

Resolves bean s auto - wire flag from the annotation . Returns default auto - wire if annotation doesn t exist .


public String resolveBeanName(final Class type, final boolean useLongTypeName) {
		PetiteBean petiteBean = ((Class<?>)type).getAnnotation(PetiteBean.class);
		String name = null;
		if (petiteBean != null) {
			name = petiteBean.value().trim();
		}
		if ((name == null) || (name.length() == 0)) {
			if (useLongTypeName) {
				name = type.getName();
			} else {
				name = StringUtil.uncapitalize(type.getSimpleName());
			}
		}
		return name;
	}

public String resolveBeanName ( final Class type , final boolean useLongTypeName ) { PetiteBean petiteBean = ( ( Class < ? > ) type ) . getAnnotation ( PetiteBean . class ) ; String name = null ; if ( petiteBean != null ) { name = petiteBean . value ( ) . trim ( ) ; } if ( ( name == null ) || ( name . length ( ) == 0 ) ) { if ( useLongTypeName ) { name = type . getName ( ) ; } else { name = StringUtil . uncapitalize ( type . getSimpleName ( ) ) ; } } return name ; }

Resolves bean's name from bean annotation or type name. May be used for resolving bean name
of base type during registration of bean subclass.

Resolves bean s name from bean annotation or type name . May be used for resolving bean name of base type during registration of bean subclass .


public PrintWriter getWriter() {
		if (outWriter == null) {
			if (outStream != null) {
				throw new IllegalStateException("Can't call getWriter() after getOutputStream()");
			}
			bufferedWriter = new FastCharArrayWriter();
			outWriter = new PrintWriter(bufferedWriter) {
				@Override
				public void close() {
					// do not close the print writer after rendering
					// since it will remove reference to bufferedWriter
				}
			};
		}
		return outWriter;
	}


public ServletOutputStream getOutputStream() {
		if (outStream == null) {
			if (outWriter != null) {
				throw new IllegalStateException("Can't call getOutputStream() after getWriter()");
			}
			bufferOutputStream = new FastByteArrayServletOutputStream();
			outStream = bufferOutputStream;
		}
		return outStream;
	}


public String getClassName() {
    switch (sort) {
      case VOID:
        return "void";
      case BOOLEAN:
        return "boolean";
      case CHAR:
        return "char";
      case BYTE:
        return "byte";
      case SHORT:
        return "short";
      case INT:
        return "int";
      case FLOAT:
        return "float";
      case LONG:
        return "long";
      case DOUBLE:
        return "double";
      case ARRAY:
        StringBuilder stringBuilder = new StringBuilder(getElementType().getClassName());
        for (int i = getDimensions(); i > 0; --i) {
          stringBuilder.append("[]");
        }
        return stringBuilder.toString();
      case OBJECT:
      case INTERNAL:
        return valueBuffer.substring(valueBegin, valueEnd).replace('/', '.');
      default:
        throw new AssertionError();
    }
  }

public String getClassName ( ) { switch ( sort ) { case VOID : return "void" ; case BOOLEAN : return "boolean" ; case CHAR : return "char" ; case BYTE : return "byte" ; case SHORT : return "short" ; case INT : return "int" ; case FLOAT : return "float" ; case LONG : return "long" ; case DOUBLE : return "double" ; case ARRAY : StringBuilder stringBuilder = new StringBuilder ( getElementType ( ) . getClassName ( ) ) ; for ( int i = getDimensions ( ) ; i > 0 ; -- i ) { stringBuilder . append ( "[]" ) ; } return stringBuilder . toString ( ) ; case OBJECT : case INTERNAL : return valueBuffer . substring ( valueBegin , valueEnd ) . replace ( ' ' , ' ' ) ; default : throw new AssertionError ( ) ; } }

Returns the binary name of the class corresponding to this type. This method must not be used
on method types.

@return the binary name of the class corresponding to this type.

Returns the binary name of the class corresponding to this type . This method must not be used on method types .


public static String getConstructorDescriptor(final Constructor<?> constructor) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append('(');
    Class<?>[] parameters = constructor.getParameterTypes();
    for (Class<?> parameter : parameters) {
      appendDescriptor(parameter, stringBuilder);
    }
    return stringBuilder.append(")V").toString();
  }

public static String getConstructorDescriptor ( final Constructor < ? > constructor ) { StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( ' ' ) ; Class < ? > [ ] parameters = constructor . getParameterTypes ( ) ; for ( Class < ? > parameter : parameters ) { appendDescriptor ( parameter , stringBuilder ) ; } return stringBuilder . append ( ")V" ) . toString ( ) ; }

Returns the descriptor corresponding to the given constructor.

@param constructor a {@link Constructor} object.
@return the descriptor of the given constructor.

Returns the descriptor corresponding to the given constructor .


public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append('(');
    for (Type argumentType : argumentTypes) {
      argumentType.appendDescriptor(stringBuilder);
    }
    stringBuilder.append(')');
    returnType.appendDescriptor(stringBuilder);
    return stringBuilder.toString();
  }

public static String getMethodDescriptor ( final Type returnType , final Type ... argumentTypes ) { StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( ' ' ) ; for ( Type argumentType : argumentTypes ) { argumentType . appendDescriptor ( stringBuilder ) ; } stringBuilder . append ( ' ' ) ; returnType . appendDescriptor ( stringBuilder ) ; return stringBuilder . toString ( ) ; }

Returns the descriptor corresponding to the given argument and return types.

@param returnType the return type of the method.
@param argumentTypes the argument types of the method.
@return the descriptor corresponding to the given argument and return types.

Returns the descriptor corresponding to the given argument and return types .


public static String getMethodDescriptor(final Method method) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append('(');
    Class<?>[] parameters = method.getParameterTypes();
    for (Class<?> parameter : parameters) {
      appendDescriptor(parameter, stringBuilder);
    }
    stringBuilder.append(')');
    appendDescriptor(method.getReturnType(), stringBuilder);
    return stringBuilder.toString();
  }

public static String getMethodDescriptor ( final Method method ) { StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( ' ' ) ; Class < ? > [ ] parameters = method . getParameterTypes ( ) ; for ( Class < ? > parameter : parameters ) { appendDescriptor ( parameter , stringBuilder ) ; } stringBuilder . append ( ' ' ) ; appendDescriptor ( method . getReturnType ( ) , stringBuilder ) ; return stringBuilder . toString ( ) ; }

Returns the descriptor corresponding to the given method.

@param method a {@link Method} object.
@return the descriptor of the given method.

Returns the descriptor corresponding to the given method .


private void appendDescriptor(final StringBuilder stringBuilder) {
    if (sort == OBJECT) {
      stringBuilder.append(valueBuffer, valueBegin - 1, valueEnd + 1);
    } else if (sort == INTERNAL) {
      stringBuilder.append('L').append(valueBuffer, valueBegin, valueEnd).append(';');
    } else {
      stringBuilder.append(valueBuffer, valueBegin, valueEnd);
    }
  }

private void appendDescriptor ( final StringBuilder stringBuilder ) { if ( sort == OBJECT ) { stringBuilder . append ( valueBuffer , valueBegin - 1 , valueEnd + 1 ) ; } else if ( sort == INTERNAL ) { stringBuilder . append ( ' ' ) . append ( valueBuffer , valueBegin , valueEnd ) . append ( ' ' ) ; } else { stringBuilder . append ( valueBuffer , valueBegin , valueEnd ) ; } }

Appends the descriptor corresponding to this type to the given string buffer.

@param stringBuilder the string builder to which the descriptor must be appended.

Appends the descriptor corresponding to this type to the given string buffer .


public int getSize() {
    switch (sort) {
      case VOID:
        return 0;
      case BOOLEAN:
      case CHAR:
      case BYTE:
      case SHORT:
      case INT:
      case FLOAT:
      case ARRAY:
      case OBJECT:
      case INTERNAL:
        return 1;
      case LONG:
      case DOUBLE:
        return 2;
      default:
        throw new AssertionError();
    }
  }

public int getSize ( ) { switch ( sort ) { case VOID : return 0 ; case BOOLEAN : case CHAR : case BYTE : case SHORT : case INT : case FLOAT : case ARRAY : case OBJECT : case INTERNAL : return 1 ; case LONG : case DOUBLE : return 2 ; default : throw new AssertionError ( ) ; } }

Returns the size of values of this type. This method must not be used for method types.

@return the size of values of this type, i.e., 2 for {@code long} and {@code double}, 0 for
{@code void} and 1 otherwise.

Returns the size of values of this type . This method must not be used for method types .


public static int getArgumentsAndReturnSizes(final String methodDescriptor) {
    int argumentsSize = 1;
    // Skip the first character, which is always a '('.
    int currentOffset = 1;
    int currentChar = methodDescriptor.charAt(currentOffset);
    // Parse the argument types and compute their size, one at a each loop iteration.
    while (currentChar != ')') {
      if (currentChar == 'J' || currentChar == 'D') {
        currentOffset++;
        argumentsSize += 2;
      } else {
        while (methodDescriptor.charAt(currentOffset) == '[') {
          currentOffset++;
        }
        if (methodDescriptor.charAt(currentOffset++) == 'L') {
          // Skip the argument descriptor content.
          currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1;
        }
        argumentsSize += 1;
      }
      currentChar = methodDescriptor.charAt(currentOffset);
    }
    currentChar = methodDescriptor.charAt(currentOffset + 1);
    if (currentChar == 'V') {
      return argumentsSize << 2;
    } else {
      int returnSize = (currentChar == 'J' || currentChar == 'D') ? 2 : 1;
      return argumentsSize << 2 | returnSize;
    }
  }

Computes the size of the arguments and of the return value of a method.

@param methodDescriptor a method descriptor.
@return the size of the arguments of the method (plus one for the implicit this argument),
argumentsSize, and the size of its return value, returnSize, packed into a single int i =
{@code (argumentsSize << 2) | returnSize} (argumentsSize is therefore equal to {@code
i >> 2}, and returnSize to {@code i & 0x03}).

Computes the size of the arguments and of the return value of a method .


public void setRollbackOnly(final Throwable th) {
		if (!isNoTransaction()) {
			if ((status != STATUS_MARKED_ROLLBACK) && (status != STATUS_ACTIVE)) {
				throw new JtxException("TNo active TX that can be marked as rollback only");
			}
		}
		rollbackCause = th;
		status = STATUS_MARKED_ROLLBACK;
	}

Modify the transaction associated with the target object such that the only possible outcome
of the transaction is to roll back the transaction.

Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction .


protected void commitOrRollback(boolean doCommit) {
		if (log.isDebugEnabled()) {
			if (doCommit) {
				log.debug("Commit JTX");
			} else {
				log.debug("Rollback JTX");
			}
		}
		boolean forcedRollback = false;
		if (!isNoTransaction()) {
			if (isRollbackOnly()) {
				if (doCommit) {
					doCommit = false;
					forcedRollback = true;
				}
			} else if (!isActive()) {
				if (isCompleted()) {
					throw new JtxException("TX is already completed, commit or rollback should be called once per TX");
				}
				throw new JtxException("No active TX to " + (doCommit ? "commit" : "rollback"));
			}
		}
		if (doCommit) {
			commitAllResources();
		} else {
			rollbackAllResources(forcedRollback);
		}
	}

Performs either commit or rollback on all transaction resources.

Performs either commit or rollback on all transaction resources .


protected void rollbackAllResources(final boolean wasForced) {
		status = STATUS_ROLLING_BACK;
		Exception lastException = null;
		Iterator<JtxResource> it = resources.iterator();
		while (it.hasNext()) {
			JtxResource resource = it.next();
			try {
				resource.rollbackTransaction();
			} catch (Exception ex) {
				lastException = ex;
			} finally {
				it.remove();
			}
		}
		txManager.removeTransaction(this);
		status = STATUS_ROLLEDBACK;
		if (lastException != null) {
			status = STATUS_UNKNOWN;
			throw new JtxException("Rollback failed: one or more TX resources couldn't rollback a TX", lastException);
		}
		if (wasForced) {
			throw new JtxException("TX rolled back because it has been marked as rollback-only", rollbackCause);
		}
	}

Rollbacks all attached resources. Resource will be closed. and detached from this transaction.
If exception occurs, it will be rethrown at the end.

Rollbacks all attached resources . Resource will be closed . and detached from this transaction . If exception occurs it will be rethrown at the end .


public <E> E requestResource(final Class<E> resourceType) {
		if (isCompleted()) {
			throw new JtxException("TX is already completed, resource are not available after commit or rollback");
		}
		if (isRollbackOnly()) {
			throw new JtxException("TX is marked as rollback only, resource are not available", rollbackCause);
		}
		if (!isNoTransaction() && !isActive()) {
			throw new JtxException("Resources are not available since TX is not active");
		}
		checkTimeout();
		E resource = lookupResource(resourceType);
		if (resource == null) {
			int maxResources = txManager.getMaxResourcesPerTransaction();
			if ((maxResources != -1) && (resources.size() >= maxResources)) {
				throw new JtxException("TX already has attached max. number of resources");
			}
			JtxResourceManager<E> resourceManager = txManager.lookupResourceManager(resourceType);
			resource = resourceManager.beginTransaction(mode, isActive());
			resources.add(new JtxResource<>(this, resourceManager, resource));
		}
		return resource;
	}

Requests a resource. If resource is not found, it will be created and new transaction will be started on it.

Requests a resource . If resource is not found it will be created and new transaction will be started on it .


protected void popName() {
		if (isPushed) {
			if (pushedComma) {
				writeComma();
			}
			String name = pushedName;
			pushedName = null;
			isPushed = false;
			writeName(name);
		}
	}

protected void popName ( ) { if ( isPushed ) { if ( pushedComma ) { writeComma ( ) ; } String name = pushedName ; pushedName = null ; isPushed = false ; writeName ( name ) ; } }

Writes stored name to JSON string. Cleans storage.

Writes stored name to JSON string . Cleans storage .


public void writeString(final String value) {
		popName();

		write(StringPool.QUOTE);

		int len = value.length();

		for (int i = 0; i < len; i++) {
			char c = value.charAt(i);

			switch (c) {
				case '"':
					write("\\\"");
					break;
				case '\\':
					write("\\\\");
					break;
				case '/':
					if (strictStringEncoding) {
						write("\\/");
					}
					else {
						write(c);
					}
					break;
				case '\b':
					write("\\b");
					break;
				case '\f':
					write("\\f");
					break;
				case '\n':
					write("\\n");
					break;
				case '\r':
					write("\\r");
					break;
				case '\t':
					write("\\t");
					break;
				default:
					if (Character.isISOControl(c)) {
						unicode(c);
					}
					else {
						write(c);
					}
			}
		}

		write(StringPool.QUOTE);
	}

public void writeString ( final String value ) { popName ( ) ; write ( StringPool . QUOTE ) ; int len = value . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = value . charAt ( i ) ; switch ( c ) { case ' ' : write ( "\\\"" ) ; break ; case ' ' : write ( "\\\\" ) ; break ; case ' ' : if ( strictStringEncoding ) { write ( "\\/" ) ; } else { write ( c ) ; } break ; case ' ' : write ( "\\b" ) ; break ; case ' ' : write ( "\\f" ) ; break ; case ' ' : write ( "\\n" ) ; break ; case ' ' : write ( "\\r" ) ; break ; case ' ' : write ( "\\t" ) ; break ; default : if ( Character . isISOControl ( c ) ) { unicode ( c ) ; } else { write ( c ) ; } } } write ( StringPool . QUOTE ) ; }

Write a quoted and escaped value to the output.

Write a quoted and escaped value to the output .


protected void unicode(final char c) {
		write("\\u");
		int n = c;
		for (int i = 0; i < 4; ++i) {
			int digit = (n & 0xf000) >> 12;
			char hex = CharUtil.int2hex(digit);

			write(hex);

			n <<= 4;
		}
	}

protected void unicode ( final char c ) { write ( "\\u" ) ; int n = c ; for ( int i = 0 ; i < 4 ; ++ i ) { int digit = ( n & 0xf000 ) >> 12 ; char hex = CharUtil . int2hex ( digit ) ; write ( hex ) ; n <<= 4 ; } }

Writes unicode representation of a character.

Writes unicode representation of a character .


public void write(final CharSequence charSequence) {
		popName();
		try {
			out.append(charSequence);
		} catch (IOException ioex) {
			throw new JsonException(ioex);
		}
	}

public void write ( final CharSequence charSequence ) { popName ( ) ; try { out . append ( charSequence ) ; } catch ( IOException ioex ) { throw new JsonException ( ioex ) ; } }

Appends char sequence to the buffer. Used for numbers, nulls, booleans, etc.

Appends char sequence to the buffer . Used for numbers nulls booleans etc .


public LagartoDomBuilderConfig setParsingErrorLogLevelName(String logLevel) {
		logLevel = logLevel.trim().toUpperCase();

		parsingErrorLogLevel = Logger.Level.valueOf(logLevel);

		return this;
	}

public LagartoDomBuilderConfig setParsingErrorLogLevelName ( String logLevel ) { logLevel = logLevel . trim ( ) . toUpperCase ( ) ; parsingErrorLogLevel = Logger . Level . valueOf ( logLevel ) ; return this ; }

Sets parsing error log level as a name .


public void startRegion(final int start, final int tagLen, final int deepLevel) {
		this.regionStart = start + tagLen;
		this.regionLength = 0;
		this.regionTagStart = start;
		this.deepLevel = deepLevel;
	}

public void startRegion ( final int start , final int tagLen , final int deepLevel ) { this . regionStart = start + tagLen ; this . regionLength = 0 ; this . regionTagStart = start ; this . deepLevel = deepLevel ; }

Starts defining region by setting the start index and reset region length to zero.

Starts defining region by setting the start index and reset region length to zero .


public boolean isContaining(final String include) {
		if (value == null) {
			return false;
		}
		if (splits == null) {
			splits = StringUtil.splitc(value, ' ');
		}

		for (String s: splits) {
			if (s.equals(include)) {
				return true;
			}
		}
		return false;
	}

public boolean isContaining ( final String include ) { if ( value == null ) { return false ; } if ( splits == null ) { splits = StringUtil . splitc ( value , ' ' ) ; } for ( String s : splits ) { if ( s . equals ( include ) ) { return true ; } } return false ; }

Returns true if attribute is containing some value.

Returns true if attribute is containing some value .


public static void registerPseudoFunction(final Class<? extends PseudoFunction> pseudoFunctionType) {
		PseudoFunction pseudoFunction;
		try {
			pseudoFunction = ClassUtil.newInstance(pseudoFunctionType);
		} catch (Exception ex) {
			throw new CSSellyException(ex);
		}
		PSEUDO_FUNCTION_MAP.put(pseudoFunction.getPseudoFunctionName(), pseudoFunction);
	}

public static void registerPseudoFunction ( final Class < ? extends PseudoFunction > pseudoFunctionType ) { PseudoFunction pseudoFunction ; try { pseudoFunction = ClassUtil . newInstance ( pseudoFunctionType ) ; } catch ( Exception ex ) { throw new CSSellyException ( ex ) ; } PSEUDO_FUNCTION_MAP . put ( pseudoFunction . getPseudoFunctionName ( ) , pseudoFunction ) ; }


public static PseudoFunction<?> lookupPseudoFunction(final String pseudoFunctionName) {
		PseudoFunction pseudoFunction = PSEUDO_FUNCTION_MAP.get(pseudoFunctionName);
		if (pseudoFunction == null) {
			throw new CSSellyException("Unsupported pseudo function: " + pseudoFunctionName);
		}
		return pseudoFunction;
	}

public
static
PseudoFunction
<
>
lookupPseudoFunction
(
final
String
pseudoFunctionName
)
{
PseudoFunction
pseudoFunction
=
PSEUDO_FUNCTION_MAP
.
get
(
pseudoFunctionName
)
;
if
(
pseudoFunction
==
)
{
throw
new
CSSellyException
(
"Unsupported pseudo function: "
+
pseudoFunctionName
)
;
}
return
pseudoFunction
;
}

Lookups pseudo function for given pseudo function name.

Lookups pseudo function for given pseudo function name .


@Override
	public void visit(final int version, int access, final String name, final String signature, final String superName, final String[] interfaces) {
		wd.init(name, superName, this.suffix, this.reqProxyClassName);

		// change access of destination
		access &= ~AsmUtil.ACC_ABSTRACT;

		// write destination class
		final int v = ProxettaAsmUtil.resolveJavaVersion(version);
		wd.dest.visit(v, access, wd.thisReference, signature, wd.superName, null);

		wd.proxyAspects = new ProxyAspectData[aspects.length];
		for (int i = 0; i < aspects.length; i++) {
			wd.proxyAspects[i] = new ProxyAspectData(wd, aspects[i], i);
		}
	}

@
Override
public
void
visit
(
final
int
version
,
int
access
,
final
String
name
,
final
String
signature
,
final
String
superName
,
final
String
[
]
interfaces
)
{
wd
.
init
(
name
,
superName
,
this
.
suffix
,
this
.
reqProxyClassName
)
;
// change access of destination
access
&=
~
AsmUtil
.
ACC_ABSTRACT
;
// write destination class
final
int
v
=
ProxettaAsmUtil
.
resolveJavaVersion
(
version
)
;
wd
.
dest
.
visit
(
v
,
access
,
wd
.
thisReference
,
signature
,
wd
.
superName
,
)
;
wd
.
proxyAspects
=
new
ProxyAspectData
[
aspects
.
length
]
;
for
(
int
i
=
0
;
i
<
aspects
.
length
;
i
++
)
{
wd
.
proxyAspects
[
i
]
=
new
ProxyAspectData
(
wd
,
aspects
[
i
]
,
i
)
;
}
}

Creates destination subclass header from current target class. Destination name is created from targets by
adding a suffix and, optionally, a number. Destination extends the target.

Creates destination subclass header from current target class . Destination name is created from targets by adding a suffix and optionally a number . Destination extends the target .


@Override
	public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
		AnnotationVisitor destAnn = wd.dest.visitAnnotation(desc, visible); // [A3]
		return new AnnotationVisitorAdapter(destAnn);
	}

@
Override
public
AnnotationVisitor
visitAnnotation
(
final
String
desc
,
final
boolean
visible
)
{
AnnotationVisitor
destAnn
=
wd
.
dest
.
visitAnnotation
(
desc
,
visible
)
;
// [A3]
return
new
AnnotationVisitorAdapter
(
destAnn
)
;
}

Copies all destination type annotations to the target.

Copies all destination type annotations to the target .


protected void makeStaticInitBlock() {
		if (wd.adviceClinits != null) {
			MethodVisitor mv = wd.dest.visitMethod(AsmUtil.ACC_STATIC, CLINIT, DESC_VOID, null, null);
			mv.visitCode();
			for (String name : wd.adviceClinits) {
				mv.visitMethodInsn(
					INVOKESTATIC,
					wd.thisReference,
					name, DESC_VOID,
					false);
			}
			mv.visitInsn(RETURN);
			mv.visitMaxs(0, 0);
			mv.visitEnd();
		}
	}

protected void makeStaticInitBlock ( ) { if ( wd . adviceClinits != null ) { MethodVisitor mv = wd . dest . visitMethod ( AsmUtil . ACC_STATIC , CLINIT , DESC_VOID , null , null ) ; mv . visitCode ( ) ; for ( String name : wd . adviceClinits ) { mv . visitMethodInsn ( INVOKESTATIC , wd . thisReference , name , DESC_VOID , false ) ; } mv . visitInsn ( RETURN ) ; mv . visitMaxs ( 0 , 0 ) ; mv . visitEnd ( ) ; } }

Creates static initialization block that simply calls all
advice static init methods in correct order.

Creates static initialization block that simply calls all advice static init methods in correct order .


protected void makeProxyConstructor() {
		MethodVisitor mv = wd.dest.visitMethod(AsmUtil.ACC_PRIVATE | AsmUtil.ACC_FINAL, ProxettaNames.initMethodName, DESC_VOID, null, null);
		mv.visitCode();
		if (wd.adviceInits != null) {
			for (String name : wd.adviceInits) {
				mv.visitVarInsn(ALOAD, 0);
				mv.visitMethodInsn
					(INVOKESPECIAL,
						wd.thisReference,
						name, DESC_VOID,
						false);
			}
		}
		mv.visitInsn(RETURN);
		mv.visitMaxs(0, 0);
		mv.visitEnd();
	}

protected void makeProxyConstructor ( ) { MethodVisitor mv = wd . dest . visitMethod ( AsmUtil . ACC_PRIVATE | AsmUtil . ACC_FINAL , ProxettaNames . initMethodName , DESC_VOID , null , null ) ; mv . visitCode ( ) ; if ( wd . adviceInits != null ) { for ( String name : wd . adviceInits ) { mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitMethodInsn ( INVOKESPECIAL , wd . thisReference , name , DESC_VOID , false ) ; } } mv . visitInsn ( RETURN ) ; mv . visitMaxs ( 0 , 0 ) ; mv . visitEnd ( ) ; }

Creates init method that simply calls all advice constructor methods in correct order.
This created init method is called from each destination's constructor.

Creates init method that simply calls all advice constructor methods in correct order . This created init method is called from each destination s constructor .


protected void processSuperMethods() {

		for (ClassReader cr : targetClassInfo.superClassReaders) {
			cr.accept(new EmptyClassVisitor() {

				String declaredClassName;

				@Override
				public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
					declaredClassName = name;
				}

				@Override
				public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
					if (name.equals(INIT) || name.equals(CLINIT)) {
						return null;
					}
					MethodSignatureVisitor msign = targetClassInfo.lookupMethodSignatureVisitor(access, name, desc, declaredClassName);
					if (msign == null) {
						return null;
					}
					return applyProxy(msign);
				}
			}, 0);
		}
	}

protected void processSuperMethods ( ) { for ( ClassReader cr : targetClassInfo . superClassReaders ) { cr . accept ( new EmptyClassVisitor ( ) { String declaredClassName ; @ Override public void visit ( final int version , final int access , final String name , final String signature , final String superName , final String [ ] interfaces ) { declaredClassName = name ; } @ Override public MethodVisitor visitMethod ( final int access , final String name , final String desc , final String signature , final String [ ] exceptions ) { if ( name . equals ( INIT ) || name . equals ( CLINIT ) ) { return null ; } MethodSignatureVisitor msign = targetClassInfo . lookupMethodSignatureVisitor ( access , name , desc , declaredClassName ) ; if ( msign == null ) { return null ; } return applyProxy ( msign ) ; } } , 0 ) ; } }

Checks for all public super methods that are not overridden.

Checks for all public super methods that are not overridden .


public int findLast(int low, int high) {
		int ndx = -1;
		while (low <= high) {
			int mid = (low + high) >>> 1;
			int delta = compare(mid);

			if (delta > 0) {
				high = mid - 1;
			} else {
				if (delta == 0) {
					ndx = mid;
				}
				low = mid + 1;
			}
		}

		if (ndx == -1) {
			return -(low + 1);
		}

		return ndx;
	}

public int findLast ( int low , int high ) { int ndx = - 1 ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; int delta = compare ( mid ) ; if ( delta > 0 ) { high = mid - 1 ; } else { if ( delta == 0 ) { ndx = mid ; } low = mid + 1 ; } } if ( ndx == - 1 ) { return - ( low + 1 ) ; } return ndx ; }

Finds very last index of given element in inclusive index range. Returns negative
value if element is not found.

Finds very last index of given element in inclusive index range . Returns negative value if element is not found .