private int getInitializedType(final SymbolTable symbolTable, final int abstractType) {
    if (abstractType == UNINITIALIZED_THIS
        || (abstractType & (DIM_MASK | KIND_MASK)) == UNINITIALIZED_KIND) {
      for (int i = 0; i < initializationCount; ++i) {
        int initializedType = initializations[i];
        int dim = initializedType & DIM_MASK;
        int kind = initializedType & KIND_MASK;
        int value = initializedType & VALUE_MASK;
        if (kind == LOCAL_KIND) {
          initializedType = dim + inputLocals[value];
        } else if (kind == STACK_KIND) {
          initializedType = dim + inputStack[inputStack.length - value];
        }
        if (abstractType == initializedType) {
          if (abstractType == UNINITIALIZED_THIS) {
            return REFERENCE_KIND | symbolTable.addType(symbolTable.getClassName());
          } else {
            return REFERENCE_KIND
                | symbolTable.addType(symbolTable.getType(abstractType & VALUE_MASK).value);
          }
        }
      }
    }
    return abstractType;
  }

private int getInitializedType ( final SymbolTable symbolTable , final int abstractType ) { if ( abstractType == UNINITIALIZED_THIS || ( abstractType & ( DIM_MASK | KIND_MASK ) ) == UNINITIALIZED_KIND ) { for ( int i = 0 ; i < initializationCount ; ++ i ) { int initializedType = initializations [ i ] ; int dim = initializedType & DIM_MASK ; int kind = initializedType & KIND_MASK ; int value = initializedType & VALUE_MASK ; if ( kind == LOCAL_KIND ) { initializedType = dim + inputLocals [ value ] ; } else if ( kind == STACK_KIND ) { initializedType = dim + inputStack [ inputStack . length - value ] ; } if ( abstractType == initializedType ) { if ( abstractType == UNINITIALIZED_THIS ) { return REFERENCE_KIND | symbolTable . addType ( symbolTable . getClassName ( ) ) ; } else { return REFERENCE_KIND | symbolTable . addType ( symbolTable . getType ( abstractType & VALUE_MASK ) . value ) ; } } } } return abstractType ; }

Returns the "initialized" abstract type corresponding to the given abstract type.

@param symbolTable the type table to use to lookup and store type {@link Symbol}.
@param abstractType an abstract type.
@return the REFERENCE_KIND abstract type corresponding to abstractType if it is
UNINITIALIZED_THIS or an UNINITIALIZED_KIND abstract type for one of the types on which a
constructor is invoked in the basic block. Otherwise returns abstractType.

Returns the initialized abstract type corresponding to the given abstract type .


static void putAbstractType(
      final SymbolTable symbolTable, final int abstractType, final ByteVector output) {
    int arrayDimensions = (abstractType & Frame.DIM_MASK) >> DIM_SHIFT;
    if (arrayDimensions == 0) {
      int typeValue = abstractType & VALUE_MASK;
      switch (abstractType & KIND_MASK) {
        case CONSTANT_KIND:
          output.putByte(typeValue);
          break;
        case REFERENCE_KIND:
          output
              .putByte(ITEM_OBJECT)
              .putShort(symbolTable.addConstantClass(symbolTable.getType(typeValue).value).index);
          break;
        case UNINITIALIZED_KIND:
          output.putByte(ITEM_UNINITIALIZED).putShort((int) symbolTable.getType(typeValue).data);
          break;
        default:
          throw new AssertionError();
      }
    } else {
      // Case of an array type, we need to build its descriptor first.
      StringBuilder typeDescriptor = new StringBuilder();
      while (arrayDimensions-- > 0) {
        typeDescriptor.append('[');
      }
      if ((abstractType & KIND_MASK) == REFERENCE_KIND) {
        typeDescriptor
            .append('L')
            .append(symbolTable.getType(abstractType & VALUE_MASK).value)
            .append(';');
      } else {
        switch (abstractType & VALUE_MASK) {
          case Frame.ITEM_ASM_BOOLEAN:
            typeDescriptor.append('Z');
            break;
          case Frame.ITEM_ASM_BYTE:
            typeDescriptor.append('B');
            break;
          case Frame.ITEM_ASM_CHAR:
            typeDescriptor.append('C');
            break;
          case Frame.ITEM_ASM_SHORT:
            typeDescriptor.append('S');
            break;
          case Frame.ITEM_INTEGER:
            typeDescriptor.append('I');
            break;
          case Frame.ITEM_FLOAT:
            typeDescriptor.append('F');
            break;
          case Frame.ITEM_LONG:
            typeDescriptor.append('J');
            break;
          case Frame.ITEM_DOUBLE:
            typeDescriptor.append('D');
            break;
          default:
            throw new AssertionError();
        }
      }
      output
          .putByte(ITEM_OBJECT)
          .putShort(symbolTable.addConstantClass(typeDescriptor.toString()).index);
    }
  }

Put the given abstract type in the given ByteVector, using the JVMS verification_type_info
format used in StackMapTable attributes.

@param symbolTable the type table to use to lookup and store type {@link Symbol}.
@param abstractType an abstract type, restricted to {@link Frame#CONSTANT_KIND}, {@link
Frame#REFERENCE_KIND} or {@link Frame#UNINITIALIZED_KIND} types.
@param output where the abstract type must be put.
@see JVMS
4.7.4

Put the given abstract type in the given ByteVector using the JVMS verification_type_info format used in StackMapTable attributes .


@Override
	protected int pruneCache() {
        int count = 0;
		Iterator<CacheObject<K,V>> values = cacheMap.values().iterator();
		while (values.hasNext()) {
			CacheObject co = values.next();
			if (co.isExpired()) {
				values.remove();
				count++;
			}
		}
		return count;
	}

@ Override protected int pruneCache ( ) { int count = 0 ; Iterator < CacheObject < K , V > > values = cacheMap . values ( ) . iterator ( ) ; while ( values . hasNext ( ) ) { CacheObject co = values . next ( ) ; if ( co . isExpired ( ) ) { values . remove ( ) ; count ++ ; } } return count ; }

Prunes expired elements from the cache. Returns the number of removed objects.

Prunes expired elements from the cache . Returns the number of removed objects .


public void schedulePrune(final long delay) {
		if (pruneTimer != null) {
			pruneTimer.cancel();
		}
		pruneTimer = new Timer();
		pruneTimer.schedule(
				new TimerTask() {
					@Override
					public void run() {
						prune();
					}
				}, delay, delay
		);
	}

public void schedulePrune ( final long delay ) { if ( pruneTimer != null ) { pruneTimer . cancel ( ) ; } pruneTimer = new Timer ( ) ; pruneTimer . schedule ( new TimerTask ( ) { @ Override public void run ( ) { prune ( ) ; } } , delay , delay ) ; }


public ModuleVisitor visitModule(final String name, final int access, final String version) {
    if (api < Opcodes.ASM6) {
      throw new UnsupportedOperationException("This feature requires ASM6");
    }
    if (cv != null) {
      return cv.visitModule(name, access, version);
    }
    return null;
  }

public
ModuleVisitor
visitModule
(
final
String
name
,
final
int
access
,
final
String
version
)
{
if
(
api
<
Opcodes
.
ASM6
)
{
throw
new
UnsupportedOperationException
(
"This feature requires ASM6"
)
;
}
if
(
cv
!=
)
{
return
cv
.
visitModule
(
name
,
access
,
version
)
;
}
return
;
}

Visit the module corresponding to the class.

@param name the fully qualified name (using dots) of the module.
@param access the module access flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC} and {@code
ACC_MANDATED}.
@param version the module version, or {@literal null}.
@return a visitor to visit the module values, or {@literal null} if this visitor is not
interested in visiting this module.

Visit the module corresponding to the class .


public void visitNestHost(final String nestHost) {
    if (api < Opcodes.ASM7) {
      throw new UnsupportedOperationException("This feature requires ASM7");
    }
    if (cv != null) {
      cv.visitNestHost(nestHost);
    }
  }

public
void
visitNestHost
(
final
String
nestHost
)
{
if
(
api
<
Opcodes
.
ASM7
)
{
throw
new
UnsupportedOperationException
(
"This feature requires ASM7"
)
;
}
if
(
cv
!=
)
{
cv
.
visitNestHost
(
nestHost
)
;
}
}

Visits the nest host class of the class. A nest is a set of classes of the same package that
share access to their private members. One of these classes, called the host, lists the other
members of the nest, which in turn should link to the host of their nest. This method must be
called only once and only if the visited class is a non-host member of a nest. A class is
implicitly its own nest, so it's invalid to call this method with the visited class name as
argument.

@param nestHost the internal name of the host class of the nest.

Visits the nest host class of the class . A nest is a set of classes of the same package that share access to their private members . One of these classes called the host lists the other members of the nest which in turn should link to the host of their nest . This method must be called only once and only if the visited class is a non - host member of a nest . A class is implicitly its own nest so it s invalid to call this method with the visited class name as argument .


public void visitOuterClass(final String owner, final String name, final String descriptor) {
    if (cv != null) {
      cv.visitOuterClass(owner, name, descriptor);
    }
  }

public void visitOuterClass ( final String owner , final String name , final String descriptor ) { if ( cv != null ) { cv . visitOuterClass ( owner , name , descriptor ) ; } }

Visits the enclosing class of the class. This method must be called only if the class has an
enclosing class.

@param owner internal name of the enclosing class of the class.
@param name the name of the method that contains the class, or {@literal null} if the class is
not enclosed in a method of its enclosing class.
@param descriptor the descriptor of the method that contains the class, or {@literal null} if
the class is not enclosed in a method of its enclosing class.

Visits the enclosing class of the class . This method must be called only if the class has an enclosing class .


public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
    if (cv != null) {
      return cv.visitAnnotation(descriptor, visible);
    }
    return null;
  }

public AnnotationVisitor visitAnnotation ( final String descriptor , final boolean visible ) { if ( cv != null ) { return cv . visitAnnotation ( descriptor , visible ) ; } return null ; }

Visits an annotation of the class.

@param descriptor the class descriptor of the annotation class.
@param visible {@literal true} if the annotation is visible at runtime.
@return a visitor to visit the annotation values, or {@literal null} if this visitor is not
interested in visiting this annotation.


public void visitNestMember(final String nestMember) {
    if (api < Opcodes.ASM7) {
      throw new UnsupportedOperationException("This feature requires ASM7");
    }
    if (cv != null) {
      cv.visitNestMember(nestMember);
    }
  }

public
void
visitNestMember
(
final
String
nestMember
)
{
if
(
api
<
Opcodes
.
ASM7
)
{
throw
new
UnsupportedOperationException
(
"This feature requires ASM7"
)
;
}
if
(
cv
!=
)
{
cv
.
visitNestMember
(
nestMember
)
;
}
}

Visits a member of the nest. A nest is a set of classes of the same package that share access
to their private members. One of these classes, called the host, lists the other members of the
nest, which in turn should link to the host of their nest. This method must be called only if
the visited class is the host of a nest. A nest host is implicitly a member of its own nest, so
it's invalid to call this method with the visited class name as argument.

@param nestMember the internal name of a nest member.

Visits a member of the nest . A nest is a set of classes of the same package that share access to their private members . One of these classes called the host lists the other members of the nest which in turn should link to the host of their nest . This method must be called only if the visited class is the host of a nest . A nest host is implicitly a member of its own nest so it s invalid to call this method with the visited class name as argument .


public void visitInnerClass(
      final String name, final String outerName, final String innerName, final int access) {
    if (cv != null) {
      cv.visitInnerClass(name, outerName, innerName, access);
    }
  }

public void visitInnerClass ( final String name , final String outerName , final String innerName , final int access ) { if ( cv != null ) { cv . visitInnerClass ( name , outerName , innerName , access ) ; } }

Visits information about an inner class. This inner class is not necessarily a member of the
class being visited.

@param name the internal name of an inner class (see {@link Type#getInternalName()}).
@param outerName the internal name of the class to which the inner class belongs (see {@link
Type#getInternalName()}). May be {@literal null} for not member classes.
@param innerName the (simple) name of the inner class inside its enclosing class. May be
{@literal null} for anonymous inner classes.
@param access the access flags of the inner class as originally declared in the enclosing
class.

Visits information about an inner class . This inner class is not necessarily a member of the class being visited .


public FieldVisitor visitField(
      final int access,
      final String name,
      final String descriptor,
      final String signature,
      final Object value) {
    if (cv != null) {
      return cv.visitField(access, name, descriptor, signature, value);
    }
    return null;
  }

public FieldVisitor visitField ( final int access , final String name , final String descriptor , final String signature , final Object value ) { if ( cv != null ) { return cv . visitField ( access , name , descriptor , signature , value ) ; } return null ; }

Visits a field of the class.

@param access the field's access flags (see {@link Opcodes}). This parameter also indicates if
the field is synthetic and/or deprecated.
@param name the field's name.
@param descriptor the field's descriptor (see {@link Type}).
@param signature the field's signature. May be {@literal null} if the field's type does not use
generic types.
@param value the field's initial value. This parameter, which may be {@literal null} if the
field does not have an initial value, must be an {@link Integer}, a {@link Float}, a {@link
Long}, a {@link Double} or a {@link String} (for {@code int}, {@code float}, {@code long}
or {@code String} fields respectively). <i>This parameter is only used for static
fields</i>. Its value is ignored for non static fields, which must be initialized through
bytecode instructions in constructors or methods.
@return a visitor to visit field annotations and attributes, or {@literal null} if this class
visitor is not interested in visiting these annotations and attributes.


public static DbThreadSession getThreadSession() {
		DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get();
		if (session == null) {
			session = new DbThreadSession();
		}
		return session;
	}

public static DbThreadSession getThreadSession ( ) { DbThreadSession session = ( DbThreadSession ) ThreadDbSessionHolder . get ( ) ; if ( session == null ) { session = new DbThreadSession ( ) ; } return session ; }

Returns existing thread session, or new one if already not exist. If session doesn't exist, it will be created
using default connection provider.

Returns existing thread session or new one if already not exist . If session doesn t exist it will be created using default connection provider .


public static void closeThreadSession() {
		DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get();
		if (session != null) {
			session.closeSession();
		}
	}

public static void closeThreadSession ( ) { DbThreadSession session = ( DbThreadSession ) ThreadDbSessionHolder . get ( ) ; if ( session != null ) { session . closeSession ( ) ; } }


protected ActionWrapper[] createExecutionArray() {
		int totalInterceptors = (this.actionRuntime.getInterceptors() != null ? this.actionRuntime.getInterceptors().length : 0);
		int totalFilters = (this.actionRuntime.getFilters() != null ? this.actionRuntime.getFilters().length : 0);

		ActionWrapper[] executionArray = new ActionWrapper[totalFilters + 1 + totalInterceptors + 1];

		// filters

		int index = 0;

		if (totalFilters > 0) {
			System.arraycopy(actionRuntime.getFilters(), 0, executionArray, index, totalFilters);
			index += totalFilters;
		}

		// result is executed AFTER the action AND interceptors

		executionArray[index++] = actionRequest -> {
			Object actionResult = actionRequest.invoke();

			ActionRequest.this.madvocController.render(ActionRequest.this, actionResult);

			return actionResult;
		};

		// interceptors

		if (totalInterceptors > 0) {
			System.arraycopy(actionRuntime.getInterceptors(), 0, executionArray, index, totalInterceptors);
			index += totalInterceptors;
		}

		// action

		executionArray[index] = actionRequest -> {
			actionResult = invokeActionMethod();
			return actionResult;
		};

		return executionArray;
	}

Creates execution array that will invoke all filters, actions and results
in correct order.

Creates execution array that will invoke all filters actions and results in correct order .


protected Object invokeActionMethod() throws Exception {
		if (actionRuntime.isActionHandlerDefined()) {
			actionRuntime.getActionHandler().handle(this);
			return null;
		}

		final Object[] params = targets.extractParametersValues();

		try {
			return actionRuntime.getActionClassMethod().invoke(action, params);
		} catch(InvocationTargetException itex) {
			throw wrapToException(unwrapThrowable(itex));
		}
	}

protected Object invokeActionMethod ( ) throws Exception { if ( actionRuntime . isActionHandlerDefined ( ) ) { actionRuntime . getActionHandler ( ) . handle ( this ) ; return null ; } final Object [ ] params = targets . extractParametersValues ( ) ; try { return actionRuntime . getActionClassMethod ( ) . invoke ( action , params ) ; } catch ( InvocationTargetException itex ) { throw wrapToException ( unwrapThrowable ( itex ) ) ; } }

Invokes action method after starting all interceptors.
After method invocation, all interceptors will finish, in opposite order.

Invokes action method after starting all interceptors . After method invocation all interceptors will finish in opposite order .


public String readRequestBody() {
		if (requestBody == null) {
			try {
				requestBody = ServletUtil.readRequestBodyFromStream(getHttpServletRequest());
			} catch (IOException ioex) {
				requestBody = StringPool.EMPTY;
			}
		}
		return requestBody;
	}

public String readRequestBody ( ) { if ( requestBody == null ) { try { requestBody = ServletUtil . readRequestBodyFromStream ( getHttpServletRequest ( ) ) ; } catch ( IOException ioex ) { requestBody = StringPool . EMPTY ; } } return requestBody ; }

Reads request body only once and returns it to user.

Reads request body only once and returns it to user .


public static int calcFirstItemIndexOfPage(int page, final int pageSize, final int total) {
		if (total == 0) {
			return 0;
		}
		if (page < 1) {
			page = 1;
		}
		int first = (page - 1) * pageSize;
		if (first >= total) {
			first = ((total - 1) / pageSize) * pageSize;	// first item on the last page
		}
		return first;
	}

public
static
int
calcFirstItemIndexOfPage
(
int
page
,
final
int
pageSize
,
final
int
total
)
{
if
(
total
==
0
)
{
return
0
;
}
if
(
page
<
1
)
{
page
=
1
;
}
int
first
=
(
page
1
)
*
pageSize
;
if
(
first
>=
total
)
{
first
=
(
(
total
1
)
/
pageSize
)
*
pageSize
;
// first item on the last page
}
return
first
;
}

Calculates the first item index of requested page.

Calculates the first item index of requested page .


public static int calcFirstItemIndexOfPage(final PageRequest pageRequest, final int total) {
		return calcFirstItemIndexOfPage(pageRequest.getPage(), pageRequest.getSize(), total);
	}

public static int calcFirstItemIndexOfPage ( final PageRequest pageRequest , final int total ) { return calcFirstItemIndexOfPage ( pageRequest . getPage ( ) , pageRequest . getSize ( ) , total ) ; }

Calculates first item index of the page.

Calculates first item index of the page .


public boolean match(final int value) {
		if (a == 0) {
			return value == b;
		}

		if (a > 0) {
			if (value < b) {
				return false;
			}
			return (value - b) % a == 0;
		}

		if (value > b) {
			return false;
		}
		return (b - value) % (-a) == 0;
	}

public boolean match ( final int value ) { if ( a == 0 ) { return value == b ; } if ( a > 0 ) { if ( value < b ) { return false ; } return ( value - b ) % a == 0 ; } if ( value > b ) { return false ; } return ( b - value ) % ( - a ) == 0 ; }


public static byte[] toRawByteArray(final char[] carr) {
		byte[] barr = new byte[carr.length << 1];
		for (int i = 0, bpos = 0; i < carr.length; i++) {
			char c = carr[i];
			barr[bpos++] = (byte) ((c & 0xFF00) >> 8);
			barr[bpos++] = (byte) (c & 0x00FF);
		}
		return barr;
	}

public static byte [ ] toRawByteArray ( final char [ ] carr ) { byte [ ] barr = new byte [ carr . length << 1 ] ; for ( int i = 0 , bpos = 0 ; i < carr . length ; i ++ ) { char c = carr [ i ] ; barr [ bpos ++ ] = ( byte ) ( ( c & 0xFF00 ) >> 8 ) ; barr [ bpos ++ ] = ( byte ) ( c & 0x00FF ) ; } return barr ; }

Converts char array into byte array by replacing each character with two bytes.

Converts char array into byte array by replacing each character with two bytes .


public static int findFirstDiff(final char[] source, final int index, final char[] match) {
		for (int i = index; i < source.length; i++) {
			if (!equalsOne(source[i], match)) {
				return i;
			}
		}
		return -1;
	}

public static int findFirstDiff ( final char [ ] source , final int index , final char [ ] match ) { for ( int i = index ; i < source . length ; i ++ ) { if ( ! equalsOne ( source [ i ] , match ) ) { return i ; } } return - 1 ; }

Finds index of the first character in given array the differs from the
given set of characters.

@return index of matched character or -1

Finds index of the first character in given array the differs from the given set of characters .


protected String resolveNodeName(final Node node) {
		switch (tagCase) {
			case DEFAULT: return node.getNodeName();
			case RAW: return node.getNodeRawName();
			case LOWERCASE: return node.getNodeRawName().toLowerCase();
			case UPPERCASE: return node.getNodeRawName().toUpperCase();
		}
		return null;
	}

protected String resolveNodeName ( final Node node ) { switch ( tagCase ) { case DEFAULT : return node . getNodeName ( ) ; case RAW : return node . getNodeRawName ( ) ; case LOWERCASE : return node . getNodeRawName ( ) . toLowerCase ( ) ; case UPPERCASE : return node . getNodeRawName ( ) . toUpperCase ( ) ; } return null ; }


protected String resolveAttributeName(final Node node, final Attribute attribute) {
		switch (attributeCase) {
			case DEFAULT: return attribute.getName();
			case RAW: return attribute.getRawName();
			case LOWERCASE: return attribute.getRawName().toLowerCase();
			case UPPERCASE: return attribute.getRawName().toUpperCase();
		}
		return null;
	}

protected String resolveAttributeName ( final Node node , final Attribute attribute ) { switch ( attributeCase ) { case DEFAULT : return attribute . getName ( ) ; case RAW : return attribute . getRawName ( ) ; case LOWERCASE : return attribute . getRawName ( ) . toLowerCase ( ) ; case UPPERCASE : return attribute . getRawName ( ) . toUpperCase ( ) ; } return null ; }


protected void renderAttribute(final Node node, final Attribute attribute, final Appendable appendable) throws IOException {
		String name = resolveAttributeName(node, attribute);
		String value = attribute.getValue();

		appendable.append(name);
		if (value != null) {
			appendable.append('=');
			appendable.append('\"');
			appendable.append(HtmlEncoder.attributeDoubleQuoted(value));
			appendable.append('\"');
		}
	}

protected void renderAttribute ( final Node node , final Attribute attribute , final Appendable appendable ) throws IOException { String name = resolveAttributeName ( node , attribute ) ; String value = attribute . getValue ( ) ; appendable . append ( name ) ; if ( value != null ) { appendable . append ( ' ' ) ; appendable . append ( ' ' ) ; appendable . append ( HtmlEncoder . attributeDoubleQuoted ( value ) ) ; appendable . append ( ' ' ) ; } }


public Props load(final File file) throws IOException {
		final String extension = FileNameUtil.getExtension(file.getAbsolutePath());
		final String data;
		if (extension.equalsIgnoreCase("properties")) {
			data = FileUtil.readString(file, StringPool.ISO_8859_1);
		} else {
			data = FileUtil.readString(file);
		}
		parse(data);
		return this;
	}

public Props load ( final File file ) throws IOException { final String extension = FileNameUtil . getExtension ( file . getAbsolutePath ( ) ) ; final String data ; if ( extension . equalsIgnoreCase ( "properties" ) ) { data = FileUtil . readString ( file , StringPool . ISO_8859_1 ) ; } else { data = FileUtil . readString ( file ) ; } parse ( data ) ; return this ; }

Loads props from the file. Assumes UTF8 encoding unless
the file ends with '.properties', than it uses ISO 8859-1.

Loads props from the file . Assumes UTF8 encoding unless the file ends with . properties than it uses ISO 8859 - 1 .


public Props load(final File file, final String encoding) throws IOException {
		parse(FileUtil.readString(file, encoding));
		return this;
	}

public Props load ( final File file , final String encoding ) throws IOException { parse ( FileUtil . readString ( file , encoding ) ) ; return this ; }

Loads properties from the file in provided encoding.

Loads properties from the file in provided encoding .


public Props load(final InputStream in) throws IOException {
		final Writer out = new FastCharArrayWriter();
		StreamUtil.copy(in, out);
		parse(out.toString());
		return this;
	}

public Props load ( final InputStream in ) throws IOException { final Writer out = new FastCharArrayWriter ( ) ; StreamUtil . copy ( in , out ) ; parse ( out . toString ( ) ) ; return this ; }

Loads properties from input stream. Stream is not closed at the end.

Loads properties from input stream . Stream is not closed at the end .


public Props load(final Map<?, ?> p) {
		for (final Map.Entry<?, ?> entry : p.entrySet()) {
			final String name = entry.getKey().toString();
			final Object value = entry.getValue();
			if (value == null) {
				continue;
			}
			data.putBaseProperty(name, value.toString(), false);
		}
		return this;
	}

public Props load ( final Map < ? , ? > p ) { for ( final Map . Entry < ? , ? > entry : p . entrySet ( ) ) { final String name = entry . getKey ( ) . toString ( ) ; final Object value = entry . getValue ( ) ; if ( value == null ) { continue ; } data . putBaseProperty ( name , value . toString ( ) , false ) ; } return this ; }

Loads base properties from the provided java properties.
Null values are ignored.

Loads base properties from the provided java properties . Null values are ignored .


@SuppressWarnings("unchecked")
	public Props load(final Map<?, ?> map, final String prefix) {
		String realPrefix = prefix;
		realPrefix += '.';
		for (final Map.Entry entry : map.entrySet()) {
			final String name = entry.getKey().toString();
			final Object value = entry.getValue();
			if (value == null) {
				continue;
			}
			data.putBaseProperty(realPrefix + name, value.toString(), false);
		}
		return this;
	}

@ SuppressWarnings ( "unchecked" ) public Props load ( final Map < ? , ? > map , final String prefix ) { String realPrefix = prefix ; realPrefix += ' ' ; for ( final Map . Entry entry : map . entrySet ( ) ) { final String name = entry . getKey ( ) . toString ( ) ; final Object value = entry . getValue ( ) ; if ( value == null ) { continue ; } data . putBaseProperty ( realPrefix + name , value . toString ( ) , false ) ; } return this ; }

Loads base properties from java Map using provided prefix.
Null values are ignored.

Loads base properties from java Map using provided prefix . Null values are ignored .


public Props loadFromClasspath(final String... patterns) {
		ClassScanner.create()
			.registerEntryConsumer(entryData -> {
				String usedEncoding = JoddCore.encoding;
				if (StringUtil.endsWithIgnoreCase(entryData.name(), ".properties")) {
					usedEncoding = StringPool.ISO_8859_1;
				}

				final String encoding = usedEncoding;
				UncheckedException.runAndWrapException(() -> load(entryData.openInputStream(), encoding));
			})
			.includeResources(true)
			.ignoreException(true)
			.excludeCommonJars()
			.excludeAllEntries(true)
			.includeEntries(patterns)
			.scanDefaultClasspath()
			.start();
		return this;
	}

public Props loadFromClasspath ( final String ... patterns ) { ClassScanner . create ( ) . registerEntryConsumer ( entryData -> { String usedEncoding = JoddCore . encoding ; if ( StringUtil . endsWithIgnoreCase ( entryData . name ( ) , ".properties" ) ) { usedEncoding = StringPool . ISO_8859_1 ; } final String encoding = usedEncoding ; UncheckedException . runAndWrapException ( ( ) -> load ( entryData . openInputStream ( ) , encoding ) ) ; } ) . includeResources ( true ) . ignoreException ( true ) . excludeCommonJars ( ) . excludeAllEntries ( true ) . includeEntries ( patterns ) . scanDefaultClasspath ( ) . start ( ) ; return this ; }

Loads props and properties from the classpath.

Loads props and properties from the classpath .


public String getValueOrDefault(final String key, final String defaultValue) {
		initialize();
		final String value = data.lookupValue(key, activeProfiles);
		if (value == null) {
			return defaultValue;
		}
		return value;
	}

public String getValueOrDefault ( final String key , final String defaultValue ) { initialize ( ) ; final String value = data . lookupValue ( key , activeProfiles ) ; if ( value == null ) { return defaultValue ; } return value ; }

Returns value of property, using active profiles or default value if not found.

Returns value of property using active profiles or default value if not found .


public void setValue(final String key, final String value, final String profile) {
		if (profile == null) {
			data.putBaseProperty(key, value, false);
		} else {
			data.putProfileProperty(key, value, profile, false);
		}
		initialized = false;
	}

public void setValue ( final String key , final String value , final String profile ) { if ( profile == null ) { data . putBaseProperty ( key , value , false ) ; } else { data . putProfileProperty ( key , value , profile , false ) ; } initialized = false ; }


public void extractProps(final Map target) {
		initialize();
		data.extract(target, activeProfiles, null, null);
	}

public void extractProps ( final Map target ) { initialize ( ) ; data . extract ( target , activeProfiles , null , null ) ; }

Extracts props belonging to active profiles.

Extracts props belonging to active profiles .


public void extractProps(final Map target, final String... profiles) {
		initialize();
		data.extract(target, profiles, null, null);
	}

public void extractProps ( final Map target , final String ... profiles ) { initialize ( ) ; data . extract ( target , profiles , null , null ) ; }


public void extractSubProps(final Map target, final String... wildcardPatterns) {
		initialize();
		data.extract(target, activeProfiles, wildcardPatterns, null);
	}

public void extractSubProps ( final Map target , final String ... wildcardPatterns ) { initialize ( ) ; data . extract ( target , activeProfiles , wildcardPatterns , null ) ; }

Extracts subset of properties that matches given wildcards.

Extracts subset of properties that matches given wildcards .


@SuppressWarnings("unchecked")
	public Map<String, Object> innerMap(final String prefix) {
		initialize();
		return data.extract(null, activeProfiles, null, prefix);
	}

@ SuppressWarnings ( "unchecked" ) public Map < String , Object > innerMap ( final String prefix ) { initialize ( ) ; return data . extract ( null , activeProfiles , null , prefix ) ; }

Returns inner map from the props with given prefix. Keys in returned map
will not have the prefix.

Returns inner map from the props with given prefix . Keys in returned map will not have the prefix .


public void addInnerMap(String prefix, final Map<?, ?> map, final String profile) {
		if (!StringUtil.endsWithChar(prefix, '.')) {
			prefix += StringPool.DOT;
		}

		for (Map.Entry<?, ?> entry : map.entrySet()) {
			String key = entry.getKey().toString();

			key = prefix + key;

			setValue(key, entry.getValue().toString(), profile);
		}
	}

public void addInnerMap ( String prefix , final Map < ? , ? > map , final String profile ) { if ( ! StringUtil . endsWithChar ( prefix , ' ' ) ) { prefix += StringPool . DOT ; } for ( Map . Entry < ? , ? > entry : map . entrySet ( ) ) { String key = entry . getKey ( ) . toString ( ) ; key = prefix + key ; setValue ( key , entry . getValue ( ) . toString ( ) , profile ) ; } }

Adds child map to the props on given prefix.

Adds child map to the props on given prefix .


protected void resolveActiveProfiles() {
		if (activeProfilesProp == null) {
			activeProfiles = null;
			return;
		}

		final PropsEntry pv = data.getBaseProperty(activeProfilesProp);
		if (pv == null) {
			// no active profile set as the property, exit
			return;
		}

		final String value = pv.getValue();
		if (StringUtil.isBlank(value)) {
			activeProfiles = null;
			return;
		}

		activeProfiles = StringUtil.splitc(value, ',');
		StringUtil.trimAll(activeProfiles);
	}

Resolves active profiles from special property.
This property can be only a base property!
If default active property is not defined, nothing happens.
Otherwise, it will replace currently active profiles.

Resolves active profiles from special property . This property can be only a base property! If default active property is not defined nothing happens . Otherwise it will replace currently active profiles .


public String[] getAllProfiles() {
		String[] profiles = new String[data.profileProperties.size()];

		int index = 0;
		for (String profileName : data.profileProperties.keySet()) {
			profiles[index] = profileName;
			index++;
		}
		return profiles;
	}

public String [ ] getAllProfiles ( ) { String [ ] profiles = new String [ data . profileProperties . size ( ) ] ; int index = 0 ; for ( String profileName : data . profileProperties . keySet ( ) ) { profiles [ index ] = profileName ; index ++ ; } return profiles ; }


public String[] getProfilesFor(final String propKeyNameWildcard) {
		HashSet<String> profiles = new HashSet<>();

		profile:
		for (Map.Entry<String, Map<String, PropsEntry>> entries : data.profileProperties.entrySet()) {
			String profileName = entries.getKey();

			Map<String, PropsEntry> value = entries.getValue();

			for (String propKeyName : value.keySet()) {
				if (Wildcard.equalsOrMatch(propKeyName, propKeyNameWildcard)) {
					profiles.add(profileName);
					continue profile;
				}
			}
		}

		return profiles.toArray(new String[0]);
	}

public String [ ] getProfilesFor ( final String propKeyNameWildcard ) { HashSet < String > profiles = new HashSet <> ( ) ; profile : for ( Map . Entry < String , Map < String , PropsEntry > > entries : data . profileProperties . entrySet ( ) ) { String profileName = entries . getKey ( ) ; Map < String , PropsEntry > value = entries . getValue ( ) ; for ( String propKeyName : value . keySet ( ) ) { if ( Wildcard . equalsOrMatch ( propKeyName , propKeyNameWildcard ) ) { profiles . add ( profileName ) ; continue profile ; } } } return profiles . toArray ( new String [ 0 ] ) ; }

Returns all the profiles that define certain prop's key name.
Key name is given as a wildcard, or it can be matched fully.

Returns all the profiles that define certain prop s key name . Key name is given as a wildcard or it can be matched fully .


protected void addPropertyInjectionPoint(final PropertyInjectionPoint pip) {
		if (properties == null) {
			properties = new PropertyInjectionPoint[1];
			properties[0] = pip;
		} else {
			properties = ArraysUtil.append(properties, pip);
		}
	}

protected void addPropertyInjectionPoint ( final PropertyInjectionPoint pip ) { if ( properties == null ) { properties = new PropertyInjectionPoint [ 1 ] ; properties [ 0 ] = pip ; } else { properties = ArraysUtil . append ( properties , pip ) ; } }


protected void addSetInjectionPoint(final SetInjectionPoint sip) {
		if (sets == null) {
			sets = new SetInjectionPoint[1];
			sets[0] = sip;
		} else {
			sets = ArraysUtil.append(sets, sip);
		}
	}

protected void addSetInjectionPoint ( final SetInjectionPoint sip ) { if ( sets == null ) { sets = new SetInjectionPoint [ 1 ] ; sets [ 0 ] = sip ; } else { sets = ArraysUtil . append ( sets , sip ) ; } }


protected void addMethodInjectionPoint(final MethodInjectionPoint mip) {
		if (methods == null) {
			methods = new MethodInjectionPoint[1];
			methods[0] = mip;
		} else {
			methods = ArraysUtil.append(methods, mip);
		}
	}

protected void addMethodInjectionPoint ( final MethodInjectionPoint mip ) { if ( methods == null ) { methods = new MethodInjectionPoint [ 1 ] ; methods [ 0 ] = mip ; } else { methods = ArraysUtil . append ( methods , mip ) ; } }


protected void addInitMethodPoints(final InitMethodPoint[] methods) {
		if (initMethods == null) {
			initMethods = methods;
		} else {
			initMethods = ArraysUtil.join(initMethods, methods);
		}
	}

protected void addInitMethodPoints ( final InitMethodPoint [ ] methods ) { if ( initMethods == null ) { initMethods = methods ; } else { initMethods = ArraysUtil . join ( initMethods , methods ) ; } }


protected void addDestroyMethodPoints(final DestroyMethodPoint[] methods) {
		if (destroyMethods == null) {
			destroyMethods = methods;
		} else {
			destroyMethods = ArraysUtil.join(destroyMethods, methods);
		}
	}

protected void addDestroyMethodPoints ( final DestroyMethodPoint [ ] methods ) { if ( destroyMethods == null ) { destroyMethods = methods ; } else { destroyMethods = ArraysUtil . join ( destroyMethods , methods ) ; } }


public static Class resolveTargetClass(final Class proxy) {
		final String name = proxy.getName();

		if (name.endsWith(ProxettaNames.proxyClassNameSuffix)) {
			return proxy.getSuperclass();
		}

		if (name.endsWith(ProxettaNames.wrapperClassNameSuffix)) {
			return getTargetWrapperType(proxy);
		}

		return proxy;
	}

public static Class resolveTargetClass ( final Class proxy ) { final String name = proxy . getName ( ) ; if ( name . endsWith ( ProxettaNames . proxyClassNameSuffix ) ) { return proxy . getSuperclass ( ) ; } if ( name . endsWith ( ProxettaNames . wrapperClassNameSuffix ) ) { return getTargetWrapperType ( proxy ) ; } return proxy ; }

Returns target class if proxetta applied on given class.
If not, returns given class as result.

Returns target class if proxetta applied on given class . If not returns given class as result .


public static void injectTargetIntoWrapper(final Object target, final Object wrapper) {
		injectTargetIntoWrapper(target, wrapper, ProxettaNames.wrapperTargetFieldName);
	}

public static void injectTargetIntoWrapper ( final Object target , final Object wrapper ) { injectTargetIntoWrapper ( target , wrapper , ProxettaNames . wrapperTargetFieldName ) ; }

Injects target instance into proxy using default target field name.
@see #injectTargetIntoWrapper(Object, Object, String)

Injects target instance into proxy using default target field name .


public static Class getTargetWrapperType(final Class wrapperClass) {
		try {
			final Field field = wrapperClass.getDeclaredField(ProxettaNames.wrapperTargetFieldName);
			return field.getType();
		} catch (NoSuchFieldException nsfex) {
			throw new ProxettaException(nsfex);
		}
	}

public static Class getTargetWrapperType ( final Class wrapperClass ) { try { final Field field = wrapperClass . getDeclaredField ( ProxettaNames . wrapperTargetFieldName ) ; return field . getType ( ) ; } catch ( NoSuchFieldException nsfex ) { throw new ProxettaException ( nsfex ) ; } }


protected FieldDescriptor findField(final String fieldName) {
		FieldDescriptor fieldDescriptor = classDescriptor.getFieldDescriptor(fieldName, true);

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

		// field descriptor not found in this class
		// try to locate it in the superclasses

		Class[] superclasses = classDescriptor.getAllSuperclasses();

		for (Class superclass : superclasses) {

			ClassDescriptor classDescriptor = ClassIntrospector.get().lookup(superclass);

			fieldDescriptor = classDescriptor.getFieldDescriptor(fieldName, true);

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

		// nothing found
		return null;
	}

Locates property field. Field is being searched also in all
superclasses of current class.

Locates property field . Field is being searched also in all superclasses of current class .


public Class getType() {
		if (type == null) {
			if (fieldDescriptor != null) {
				type = fieldDescriptor.getRawType();
			}
			else if (readMethodDescriptor != null) {
				type = getGetter(true).getGetterRawType();
				//type = readMethodDescriptor.getGetterRawType();
			}
			else if (writeMethodDescriptor != null) {
				type = getSetter(true).getSetterRawType();
				//type = writeMethodDescriptor.getSetterRawType();
			}
		}

		return type;
	}

Returns property type. Raw types are detected.

Returns property type . Raw types are detected .


public Class resolveKeyType(final boolean declared) {
		Class keyType = null;

		Getter getter = getGetter(declared);

		if (getter != null) {
			keyType = getter.getGetterRawKeyComponentType();
		}

		if (keyType == null) {
			FieldDescriptor fieldDescriptor = getFieldDescriptor();

			if (fieldDescriptor != null) {
				keyType = fieldDescriptor.getRawKeyComponentType();
			}
		}

		return keyType;
	}

public Class resolveKeyType ( final boolean declared ) { Class keyType = null ; Getter getter = getGetter ( declared ) ; if ( getter != null ) { keyType = getter . getGetterRawKeyComponentType ( ) ; } if ( keyType == null ) { FieldDescriptor fieldDescriptor = getFieldDescriptor ( ) ; if ( fieldDescriptor != null ) { keyType = fieldDescriptor . getRawKeyComponentType ( ) ; } } return keyType ; }

Resolves key type for given property descriptor.

Resolves key type for given property descriptor .


public Class resolveComponentType(final boolean declared) {
		Class componentType = null;

		Getter getter = getGetter(declared);

		if (getter != null) {
			componentType = getter.getGetterRawComponentType();
		}

		if (componentType == null) {
			FieldDescriptor fieldDescriptor = getFieldDescriptor();

			if (fieldDescriptor != null) {
				componentType = fieldDescriptor.getRawComponentType();
			}
		}

		return componentType;
	}

public Class resolveComponentType ( final boolean declared ) { Class componentType = null ; Getter getter = getGetter ( declared ) ; if ( getter != null ) { componentType = getter . getGetterRawComponentType ( ) ; } if ( componentType == null ) { FieldDescriptor fieldDescriptor = getFieldDescriptor ( ) ; if ( fieldDescriptor != null ) { componentType = fieldDescriptor . getRawComponentType ( ) ; } } return componentType ; }

Resolves component type for given property descriptor.

Resolves component type for given property descriptor .


public static JsonResult of(final Object object) {
		final String json = JsonSerializer.create().deep(true).serialize(object);
		return new JsonResult(json);
	}

public static JsonResult of ( final Object object ) { final String json = JsonSerializer . create ( ) . deep ( true ) . serialize ( object ) ; return new JsonResult ( json ) ; }

Creates JSON result from given object. The object will be serialized to JSON.

Creates JSON result from given object . The object will be serialized to JSON .


public static JsonResult of(final Exception exception) {
		final HashMap<String, Object> errorMap = new HashMap<>();

		errorMap.put("message", ExceptionUtil.message(exception));
		errorMap.put("error", exception.getClass().getName());
		errorMap.put("cause", exception.getCause() != null ? exception.getCause().getClass().getName() : null);

		final ArrayList<String> details = new ArrayList<>();

		final StackTraceElement[] ste = ExceptionUtil.getStackTrace(exception, null, null);
		for (StackTraceElement stackTraceElement : ste) {
			details.add(stackTraceElement.toString());
		}

		errorMap.put("details", details);

		final String json = JsonSerializer.create().deep(true).serialize(errorMap);
		return new JsonResult(json).status(HttpStatus.error500().internalError());
	}

public static JsonResult of ( final Exception exception ) { final HashMap < String , Object > errorMap = new HashMap <> ( ) ; errorMap . put ( "message" , ExceptionUtil . message ( exception ) ) ; errorMap . put ( "error" , exception . getClass ( ) . getName ( ) ) ; errorMap . put ( "cause" , exception . getCause ( ) != null ? exception . getCause ( ) . getClass ( ) . getName ( ) : null ) ; final ArrayList < String > details = new ArrayList <> ( ) ; final StackTraceElement [ ] ste = ExceptionUtil . getStackTrace ( exception , null , null ) ; for ( StackTraceElement stackTraceElement : ste ) { details . add ( stackTraceElement . toString ( ) ) ; } errorMap . put ( "details" , details ) ; final String json = JsonSerializer . create ( ) . deep ( true ) . serialize ( errorMap ) ; return new JsonResult ( json ) . status ( HttpStatus . error500 ( ) . internalError ( ) ) ; }

Creates a JSON response from an exception. Response body will have information about the
exception and response status will be set to 500.

Creates a JSON response from an exception . Response body will have information about the exception and response status will be set to 500 .


protected String resolveHttpMethodFromMethodName(final String methodName) {
		int i = 0;

		while (i < methodName.length()) {
			if (CharUtil.isUppercaseAlpha(methodName.charAt(i))) {
				break;
			}
			i++;
		}

		final String name = methodName.substring(0, i).toUpperCase();

		for (final HttpMethod httpMethod : HttpMethod.values()) {
			if (httpMethod.equalsName(name)) {
				return httpMethod.name();
			}
		}

		return null;
	}

protected String resolveHttpMethodFromMethodName ( final String methodName ) { int i = 0 ; while ( i < methodName . length ( ) ) { if ( CharUtil . isUppercaseAlpha ( methodName . charAt ( i ) ) ) { break ; } i ++ ; } final String name = methodName . substring ( 0 , i ) . toUpperCase ( ) ; for ( final HttpMethod httpMethod : HttpMethod . values ( ) ) { if ( httpMethod . equalsName ( name ) ) { return httpMethod . name ( ) ; } } return null ; }

Resolves HTTP method name from method name.
If method name or first camel-case word of a method equals to
a HTTP method, it will be used as that HTTP methods.

Resolves HTTP method name from method name . If method name or first camel - case word of a method equals to a HTTP method it will be used as that HTTP methods .


private static boolean match(final CharSequence string, final CharSequence pattern, int sNdx, int pNdx) {
		int pLen = pattern.length();
		if (pLen == 1) {
			if (pattern.charAt(0) == '*') {     // speed-up
				return true;
			}
		}
		int sLen = string.length();
		boolean nextIsNotWildcard = false;

		while (true) {

			// check if end of string and/or pattern occurred
			if ((sNdx >= sLen)) {		// end of string still may have pending '*' in pattern
				while ((pNdx < pLen) && (pattern.charAt(pNdx) == '*')) {
					pNdx++;
				}
				return pNdx >= pLen;
			}
			if (pNdx >= pLen) {					// end of pattern, but not end of the string
				return false;
			}
			char p = pattern.charAt(pNdx);		// pattern char

			// perform logic
			if (!nextIsNotWildcard) {

				if (p == '\\') {
					pNdx++;
					nextIsNotWildcard =  true;
					continue;
				}
				if (p == '?') {
					sNdx++; pNdx++;
					continue;
				}
				if (p == '*') {
					char pNext = 0;						// next pattern char
					if (pNdx + 1 < pLen) {
						pNext = pattern.charAt(pNdx + 1);
					}
					if (pNext == '*') {					// double '*' have the same effect as one '*'
						pNdx++;
						continue;
					}
					int i;
					pNdx++;

					// find recursively if there is any substring from the end of the
					// line that matches the rest of the pattern !!!
					for (i = string.length(); i >= sNdx; i--) {
						if (match(string, pattern, i, pNdx)) {
							return true;
						}
					}
					return false;
				}
			} else {
				nextIsNotWildcard = false;
			}

			// check if pattern char and string char are equals
			if (p != string.charAt(sNdx)) {
				return false;
			}

			// everything matches for now, continue
			sNdx++; pNdx++;
		}
	}


protected Loading resolveLoading(final boolean parentFirstStrategy, final String className) {
		boolean withParent = true;
		boolean withLoader = true;

		if (parentFirstStrategy) {
			if (isMatchingRules(className, loaderOnlyRules)) {
				withParent = false;
			}
			else if (isMatchingRules(className, parentOnlyRules)) {
				withLoader = false;
			}
		}
		else {
			if (isMatchingRules(className, parentOnlyRules)) {
				withLoader = false;
			}
			else if (isMatchingRules(className, loaderOnlyRules)) {
				withParent = false;
			}
		}

		return new Loading(withParent, withLoader);
	}

protected Loading resolveLoading ( final boolean parentFirstStrategy , final String className ) { boolean withParent = true ; boolean withLoader = true ; if ( parentFirstStrategy ) { if ( isMatchingRules ( className , loaderOnlyRules ) ) { withParent = false ; } else if ( isMatchingRules ( className , parentOnlyRules ) ) { withLoader = false ; } } else { if ( isMatchingRules ( className , parentOnlyRules ) ) { withLoader = false ; } else if ( isMatchingRules ( className , loaderOnlyRules ) ) { withParent = false ; } } return new Loading ( withParent , withLoader ) ; }


protected Loading resolveResourceLoading(final boolean parentFirstStrategy, String resourceName) {
		if (matchResourcesAsPackages) {
			resourceName = StringUtil.replaceChar(resourceName, '/', '.');
		}

		return resolveLoading(parentFirstStrategy, resourceName);
	}

protected Loading resolveResourceLoading ( final boolean parentFirstStrategy , String resourceName ) { if ( matchResourcesAsPackages ) { resourceName = StringUtil . replaceChar ( resourceName , ' ' , ' ' ) ; } return resolveLoading ( parentFirstStrategy , resourceName ) ; }


@Override
	protected synchronized Class<?> loadClass(final String className, final boolean resolve) throws ClassNotFoundException {

		// check first if the class has already been loaded

		Class<?> c = findLoadedClass(className);

		if (c != null) {
			if (resolve) {
				resolveClass(c);
			}

			return c;
		}

		// class not loaded yet

		Loading loading = resolveLoading(parentFirst, className);

		if (parentFirst) {
			// PARENT FIRST
			if (loading.withParent) {
				try {
					c = parentClassLoader.loadClass(className);
				}
				catch (ClassNotFoundException ignore) {
				}
			}

			if (c == null) {
				if (loading.withLoader) {
					c = this.findClass(className);
				}
				else {
					throw new ClassNotFoundException("Class not found: " + className);
				}
			}
		} else {
			// THIS FIRST
			if (loading.withLoader) {
				try {
					c = this.findClass(className);
				}
				catch (ClassNotFoundException ignore) {
				}
			}

			if (c == null) {
				if (loading.withParent) {
					c = parentClassLoader.loadClass(className);
				}
				else {
					throw new ClassNotFoundException("Class not found: " + className);
				}
			}
		}

		if (resolve) {
			resolveClass(c);
		}
		return c;
	}

Loads class using parent-first or parent-last strategy.

Loads class using parent - first or parent - last strategy .


@Override
	public URL getResource(final String resourceName) {

		URL url = null;

		Loading loading = resolveResourceLoading(parentFirst, resourceName);

		if (parentFirst) {
			// PARENT FIRST
			if (loading.withParent) {
				url = parentClassLoader.getResource(resourceName);
			}

			if (url == null) {
				if (loading.withLoader) {
					url = this.findResource(resourceName);
				}
			}
		} else {
			// THIS FIRST
			if (loading.withLoader) {
				url = this.findResource(resourceName);
			}

			if (url == null) {
				if (loading.withParent) {
					url = parentClassLoader.getResource(resourceName);
				}
			}
		}

		return url;
	}

@
Override
public
URL
getResource
(
final
String
resourceName
)
{
URL
url
=
;
Loading
loading
=
resolveResourceLoading
(
parentFirst
,
resourceName
)
;
if
(
parentFirst
)
{
// PARENT FIRST
if
(
loading
.
withParent
)
{
url
=
parentClassLoader
.
getResource
(
resourceName
)
;
}
if
(
url
==
)
{
if
(
loading
.
withLoader
)
{
url
=
this
.
findResource
(
resourceName
)
;
}
}
}
else
{
// THIS FIRST
if
(
loading
.
withLoader
)
{
url
=
this
.
findResource
(
resourceName
)
;
}
if
(
url
==
)
{
if
(
loading
.
withParent
)
{
url
=
parentClassLoader
.
getResource
(
resourceName
)
;
}
}
}
return
url
;
}

Returns a resource using parent-first or parent-last strategy.

Returns a resource using parent - first or parent - last strategy .


public void waitFor() {
		try {
			synchronized (lock) {
				if (!end) {
					lock.wait();
				}
			}
		}
		catch (InterruptedException ignore) {
			Thread.currentThread().interrupt();
		}
	}

public void waitFor ( ) { try { synchronized ( lock ) { if ( ! end ) { lock . wait ( ) ; } } } catch ( InterruptedException ignore ) { Thread . currentThread ( ) . interrupt ( ) ; } }


public Class<? extends Annotation> detectAnnotationType(final Annotation[] annotations) {
		for (final Annotation annotation : annotations) {
			if (annotation instanceof In) {
				return annotation.annotationType();
			}
			else if (annotation instanceof Out) {
				return annotation.annotationType();
			}
		}
		return null;
	}

public Class < ? extends Annotation > detectAnnotationType ( final Annotation [ ] annotations ) { for ( final Annotation annotation : annotations ) { if ( annotation instanceof In ) { return annotation . annotationType ( ) ; } else if ( annotation instanceof Out ) { return annotation . annotationType ( ) ; } } return null ; }

Scans annotation and returns type of Madvoc annotations.

Scans annotation and returns type of Madvoc annotations .


protected InjectionPoint buildInjectionPoint(
			final String annotationValue,
			final String propertyName,
			final Class propertyType,
			final Class<? extends MadvocScope> scope) {

		final String value = annotationValue.trim();
		final String name, targetName;

		if (StringUtil.isNotBlank(value)) {
			name = value;
			targetName = propertyName;
		}
		else {
			name = propertyName;
			targetName = null;
		}
		return new InjectionPoint(propertyType, name, targetName, scopeResolver.defaultOrScopeType(scope));
	}

protected InjectionPoint buildInjectionPoint ( final String annotationValue , final String propertyName , final Class propertyType , final Class < ? extends MadvocScope > scope ) { final String value = annotationValue . trim ( ) ; final String name , targetName ; if ( StringUtil . isNotBlank ( value ) ) { name = value ; targetName = propertyName ; } else { name = propertyName ; targetName = null ; } return new InjectionPoint ( propertyType , name , targetName , scopeResolver . defaultOrScopeType ( scope ) ) ; }


public void visit() {
		ClassDescriptor classDescriptor = ClassIntrospector.get().lookup(type);

		if (classMetadataName != null) {
			// process first 'meta' fields 'class'
			onProperty(classMetadataName, null, false);
		}

		PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();

		for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {

			Getter getter = propertyDescriptor.getGetter(declared);
			if (getter != null) {
				String propertyName = propertyDescriptor.getName();

				boolean isTransient = false;
				// check for transient flag
				FieldDescriptor fieldDescriptor = propertyDescriptor.getFieldDescriptor();

				if (fieldDescriptor != null) {
					isTransient = Modifier.isTransient(fieldDescriptor.getField().getModifiers());
				}

				onProperty(propertyName, propertyDescriptor, isTransient);
			}
		}
	}

public
void
visit
(
)
{
ClassDescriptor
classDescriptor
=
ClassIntrospector
.
get
(
)
.
lookup
(
type
)
;
if
(
classMetadataName
!=
)
{
// process first 'meta' fields 'class'
onProperty
(
classMetadataName
,
,
false
)
;
}
PropertyDescriptor
[
]
propertyDescriptors
=
classDescriptor
.
getAllPropertyDescriptors
(
)
;
for
(
PropertyDescriptor
propertyDescriptor
:
propertyDescriptors
)
{
Getter
getter
=
propertyDescriptor
.
getGetter
(
declared
)
;
if
(
getter
!=
)
{
String
propertyName
=
propertyDescriptor
.
getName
(
)
;
boolean
isTransient
=
false
;
// check for transient flag
FieldDescriptor
fieldDescriptor
=
propertyDescriptor
.
getFieldDescriptor
(
)
;
if
(
fieldDescriptor
!=
)
{
isTransient
=
Modifier
.
isTransient
(
fieldDescriptor
.
getField
(
)
.
getModifiers
(
)
)
;
}
onProperty
(
propertyName
,
propertyDescriptor
,
isTransient
)
;
}
}
}


public static URL[] of(ClassLoader classLoader, Class clazz) {
		if (clazz == null) {
			clazz = ClassPathURLs.class;
		}
		if (classLoader == null) {
			classLoader = clazz.getClassLoader();
		}
		final Set<URL> urls = new LinkedHashSet<>();

		while (classLoader != null) {
			if (classLoader instanceof URLClassLoader) {
				final URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
				return urlClassLoader.getURLs();
			}

			final URL url = classModuleUrl(classLoader, clazz);

			if (url != null) {
				urls.add(url);
			}

			classLoader = classLoader.getParent();
		}

		return urls.toArray(new URL[0]);
	}

public static URL [ ] of ( ClassLoader classLoader , Class clazz ) { if ( clazz == null ) { clazz = ClassPathURLs . class ; } if ( classLoader == null ) { classLoader = clazz . getClassLoader ( ) ; } final Set < URL > urls = new LinkedHashSet <> ( ) ; while ( classLoader != null ) { if ( classLoader instanceof URLClassLoader ) { final URLClassLoader urlClassLoader = ( URLClassLoader ) classLoader ; return urlClassLoader . getURLs ( ) ; } final URL url = classModuleUrl ( classLoader , clazz ) ; if ( url != null ) { urls . add ( url ) ; } classLoader = classLoader . getParent ( ) ; } return urls . toArray ( new URL [ 0 ] ) ; }

Returns urls for the classloader

@param classLoader classloader in which to find urls
@return list of urls or {@code null} if not found


private void setBean(final Object bean) {
		this.bean = bean;
		this.cd = (bean == null ? null : introspector.lookup(bean.getClass()));
		this.first = false;
		this.updateProperty = true;
	}

private void setBean ( final Object bean ) { this . bean = bean ; this . cd = ( bean == null ? null : introspector . lookup ( bean . getClass ( ) ) ) ; this . first = false ; this . updateProperty = true ; }


public void updateBean(final Object bean) {
		this.setBean(bean);

		if (this.cd != null && this.cd.isSupplier()) {
			final Object newBean = ((Supplier)this.bean).get();
			setBean(newBean);
		}
	}

public void updateBean ( final Object bean ) { this . setBean ( bean ) ; if ( this . cd != null && this . cd . isSupplier ( ) ) { final Object newBean = ( ( Supplier ) this . bean ) . get ( ) ; setBean ( newBean ) ; } }

Updates the bean. Detects special case of suppliers.

Updates the bean . Detects special case of suppliers .


private void loadPropertyDescriptor() {
		if (updateProperty) {
			if (cd == null) {
				propertyDescriptor = null;
			} else {
				propertyDescriptor = cd.getPropertyDescriptor(name, true);
			}
			updateProperty = false;
		}
	}

private void loadPropertyDescriptor ( ) { if ( updateProperty ) { if ( cd == null ) { propertyDescriptor = null ; } else { propertyDescriptor = cd . getPropertyDescriptor ( name , true ) ; } updateProperty = false ; } }

Loads property descriptor, if property was updated.

Loads property descriptor if property was updated .


public Getter getGetter(final boolean declared) {
		loadPropertyDescriptor();
		return propertyDescriptor != null ? propertyDescriptor.getGetter(declared) : null;
	}

public Getter getGetter ( final boolean declared ) { loadPropertyDescriptor ( ) ; return propertyDescriptor != null ? propertyDescriptor . getGetter ( declared ) : null ; }


public Setter getSetter(final boolean declared) {
		loadPropertyDescriptor();
		return propertyDescriptor != null ? propertyDescriptor.getSetter(declared) : null;
	}

public Setter getSetter ( final boolean declared ) { loadPropertyDescriptor ( ) ; return propertyDescriptor != null ? propertyDescriptor . getSetter ( declared ) : null ; }


public DbOom connect() {
		connectionProvider.init();

		final DbDetector dbDetector = new DbDetector();

		dbDetector.detectDatabaseAndConfigureDbOom(connectionProvider, dbOomConfig);

		return this;
	}

public DbOom connect ( ) { connectionProvider . init ( ) ; final DbDetector dbDetector = new DbDetector ( ) ; dbDetector . detectDatabaseAndConfigureDbOom ( connectionProvider , dbOomConfig ) ; return this ; }

Initializes the DbOom by connecting to the database. Database will be detected
and DbOom will be configured to match it.

Initializes the DbOom by connecting to the database . Database will be detected and DbOom will be configured to match it .


public void add(final Iterator<T> iterator) {
		if (allIterators.contains(iterator)) {
			throw new IllegalArgumentException("Duplicate iterator");
		}
		allIterators.add(iterator);
	}

public
void
add
(
final
Iterator
<
T
>
iterator
)
{
if
(
allIterators
.
contains
(
iterator
)
)
{
throw
new
IllegalArgumentException
(
"Duplicate iterator"
)
;
}
allIterators
.
add
(
iterator
)
;
}


private void printLogo() {
		System.out.println(Chalk256.chalk().yellow().on(Jodd.JODD));
	}

private void printLogo ( ) { System . out . println ( Chalk256 . chalk ( ) . yellow ( ) . on ( Jodd . JODD ) ) ; }


public void stop() {
		joyProps.stop();
		try {
			joyDb.stop();
			joyPetite.stop();
		}
		catch (Exception ignore) {
		}

		if (log != null) {
			log.info("Joy is down. Bye, bye!");
		}
	}

public
void
stop
(
)
{
joyProps
.
stop
(
)
;
try
{
joyDb
.
stop
(
)
;
joyPetite
.
stop
(
)
;
}
catch
(
Exception
ignore
)
{
}
if
(
log
!=
)
{
log
.
info
(
"Joy is down. Bye, bye!"
)
;
}
}


protected Socket createSocket(final String host, final int port, final int connectionTimeout) throws IOException {
		final SocketFactory socketFactory = getSocketFactory(proxy, false, false, connectionTimeout);

		if (connectionTimeout < 0) {
			return socketFactory.createSocket(host, port);
		}
		else {
			// creates unconnected socket
			Socket socket = socketFactory.createSocket();

			socket.connect(new InetSocketAddress(host, port), connectionTimeout);

			return socket;
		}
	}

protected
Socket
createSocket
(
final
String
host
,
final
int
port
,
final
int
connectionTimeout
)
throws
IOException
{
final
SocketFactory
socketFactory
=
getSocketFactory
(
proxy
,
false
,
false
,
connectionTimeout
)
;
if
(
connectionTimeout
<
0
)
{
return
socketFactory
.
createSocket
(
host
,
port
)
;
}
else
{
// creates unconnected socket
Socket
socket
=
socketFactory
.
createSocket
(
)
;
socket
.
connect
(
new
InetSocketAddress
(
host
,
port
)
,
connectionTimeout
)
;
return
socket
;
}
}


protected SSLSocket createSSLSocket(
		final String host, final int port, final int connectionTimeout,
		final boolean trustAll, final boolean verifyHttpsHost) throws IOException {

		final SocketFactory socketFactory = getSocketFactory(proxy, true, trustAll, connectionTimeout);

		final Socket socket;

		if (connectionTimeout < 0) {
			socket = socketFactory.createSocket(host, port);
		}
		else {
			// creates unconnected socket
			// unfortunately, this does not work always

//			sslSocket = (SSLSocket) socketFactory.createSocket();
//			sslSocket.connect(new InetSocketAddress(host, port), connectionTimeout);

			//
			// Note: SSLSocketFactory has several create() methods.
			// Those that take arguments all connect immediately
			// and have no options for specifying a connection timeout.
			//
			// So, we have to create a socket and connect it (with a
			// connection timeout), then have the SSLSocketFactory wrap
			// the already-connected socket.
			//
			socket = Sockets.connect(host, port, connectionTimeout);
			//sock.setSoTimeout(readTimeout);
			//socket.connect(new InetSocketAddress(host, port), connectionTimeout);

			// continue to wrap this plain socket with ssl socket...
		}

		// wrap plain socket in an SSL socket

		SSLSocket sslSocket;

		if (socket instanceof SSLSocket) {
			sslSocket = (SSLSocket) socket;
		}
		else {
			if (socketFactory instanceof SSLSocketFactory) {
				sslSocket = (SSLSocket) ((SSLSocketFactory)socketFactory).createSocket(socket, host, port, true);
			}
			else {
				sslSocket = (SSLSocket) (getDefaultSSLSocketFactory(trustAll)).createSocket(socket, host, port, true);
			}
		}

		// sslSocket is now ready

		if (secureEnabledProtocols != null) {
			final String[] values = StringUtil.splitc(secureEnabledProtocols, ',');

			StringUtil.trimAll(values);

			sslSocket.setEnabledProtocols(values);
		}

		// set SSL parameters to allow host name verifier

		if (verifyHttpsHost) {
			final SSLParameters sslParams = new SSLParameters();

			sslParams.setEndpointIdentificationAlgorithm("HTTPS");

			sslSocket.setSSLParameters(sslParams);
		}

		return sslSocket;
	}

Creates a SSL socket. Enables default secure enabled protocols if specified.

Creates a SSL socket . Enables default secure enabled protocols if specified .


protected SSLSocketFactory getDefaultSSLSocketFactory(final boolean trustAllCertificates) throws IOException {
		if (trustAllCertificates) {
			try {
				SSLContext sc = SSLContext.getInstance(sslProtocol);
				sc.init(null, TrustManagers.TRUST_ALL_CERTS, new java.security.SecureRandom());
				return sc.getSocketFactory();
			}
			catch (NoSuchAlgorithmException | KeyManagementException e) {
				throw new IOException(e);
			}
		} else {
			return (SSLSocketFactory) SSLSocketFactory.getDefault();
		}
	}

protected SSLSocketFactory getDefaultSSLSocketFactory ( final boolean trustAllCertificates ) throws IOException { if ( trustAllCertificates ) { try { SSLContext sc = SSLContext . getInstance ( sslProtocol ) ; sc . init ( null , TrustManagers . TRUST_ALL_CERTS , new java . security . SecureRandom ( ) ) ; return sc . getSocketFactory ( ) ; } catch ( NoSuchAlgorithmException | KeyManagementException e ) { throw new IOException ( e ) ; } } else { return ( SSLSocketFactory ) SSLSocketFactory . getDefault ( ) ; } }

Returns default SSL socket factory allowing setting trust managers.

Returns default SSL socket factory allowing setting trust managers .


protected SocketFactory getSocketFactory(
			final ProxyInfo proxy,
			final boolean ssl,
			final boolean trustAllCertificates,
			final int connectionTimeout) throws IOException {

		switch (proxy.getProxyType()) {
			case NONE:
				if (ssl) {
					return getDefaultSSLSocketFactory(trustAllCertificates);
				}
				else {
					return SocketFactory.getDefault();
				}
			case HTTP:
				return new HTTPProxySocketFactory(proxy, connectionTimeout);
			case SOCKS4:
				return new Socks4ProxySocketFactory(proxy, connectionTimeout);
			case SOCKS5:
				return new Socks5ProxySocketFactory(proxy, connectionTimeout);
			default:
				return null;
		}
	}

protected SocketFactory getSocketFactory ( final ProxyInfo proxy , final boolean ssl , final boolean trustAllCertificates , final int connectionTimeout ) throws IOException { switch ( proxy . getProxyType ( ) ) { case NONE : if ( ssl ) { return getDefaultSSLSocketFactory ( trustAllCertificates ) ; } else { return SocketFactory . getDefault ( ) ; } case HTTP : return new HTTPProxySocketFactory ( proxy , connectionTimeout ) ; case SOCKS4 : return new Socks4ProxySocketFactory ( proxy , connectionTimeout ) ; case SOCKS5 : return new Socks5ProxySocketFactory ( proxy , connectionTimeout ) ; default : return null ; } }

Returns socket factory based on proxy type and SSL requirements.

Returns socket factory based on proxy type and SSL requirements .


public String random(int count, final char[] chars) {
		if (count == 0) {
			return StringPool.EMPTY;
		}
		final char[] result = new char[count];
		while (count-- > 0) {
			result[count] = chars[rnd.nextInt(chars.length)];
		}
		return new String(result);
	}

public String random ( int count , final char [ ] chars ) { if ( count == 0 ) { return StringPool . EMPTY ; } final char [ ] result = new char [ count ] ; while ( count -- > 0 ) { result [ count ] = chars [ rnd . nextInt ( chars . length ) ] ; } return new String ( result ) ; }

Creates random string whose length is the number of characters specified.
Characters are chosen from the set of characters specified.

Creates random string whose length is the number of characters specified . Characters are chosen from the set of characters specified .


public String random(int count, final char start, final char end) {
		if (count == 0) {
			return StringPool.EMPTY;
		}
		final char[] result = new char[count];
		final int len = end - start + 1;
		while (count-- > 0) {
			result[count] = (char) (rnd.nextInt(len) + start);
		}
		return new String(result);
	}

public String random ( int count , final char start , final char end ) { if ( count == 0 ) { return StringPool . EMPTY ; } final char [ ] result = new char [ count ] ; final int len = end - start + 1 ; while ( count -- > 0 ) { result [ count ] = ( char ) ( rnd . nextInt ( len ) + start ) ; } return new String ( result ) ; }

Creates random string whose length is the number of characters specified.
Characters are chosen from the provided range.

Creates random string whose length is the number of characters specified . Characters are chosen from the provided range .


public String randomRanges(int count, final char... ranges) {
		if (count == 0) {
			return StringPool.EMPTY;
		}
		int i = 0;
		int len = 0;
		final int[] lens = new int[ranges.length];
		while (i < ranges.length) {
			int gap = ranges[i + 1] - ranges[i] + 1;
			len += gap;
			lens[i] = len;
			i += 2;
		}

		final char[] result = new char[count];
		while (count-- > 0) {
			char c = 0;
			int r = rnd.nextInt(len);
			for (i = 0; i < ranges.length; i += 2) {
				if (r < lens[i]) {
					r += ranges[i];
					if (i != 0) {
						r -= lens[i - 2];
					}
					c = (char) r;
					break;
				}
			}
			result[count] = c;
		}
		return new String(result);
	}

public String randomRanges ( int count , final char ... ranges ) { if ( count == 0 ) { return StringPool . EMPTY ; } int i = 0 ; int len = 0 ; final int [ ] lens = new int [ ranges . length ] ; while ( i < ranges . length ) { int gap = ranges [ i + 1 ] - ranges [ i ] + 1 ; len += gap ; lens [ i ] = len ; i += 2 ; } final char [ ] result = new char [ count ] ; while ( count -- > 0 ) { char c = 0 ; int r = rnd . nextInt ( len ) ; for ( i = 0 ; i < ranges . length ; i += 2 ) { if ( r < lens [ i ] ) { r += ranges [ i ] ; if ( i != 0 ) { r -= lens [ i - 2 ] ; } c = ( char ) r ; break ; } } result [ count ] = c ; } return new String ( result ) ; }

Creates random string whose length is the number of characters specified.
Characters are chosen from the multiple sets defined by range pairs.
All ranges must be in acceding order.

Creates random string whose length is the number of characters specified . Characters are chosen from the multiple sets defined by range pairs . All ranges must be in acceding order .


@SuppressWarnings("unchecked")
	protected Collection<Object> newArrayInstance(final Class targetType) {
		if (targetType == null ||
			targetType == List.class ||
			targetType == Collection.class ||
			targetType.isArray()) {

			return listSupplier.get();
		}

		if (targetType == Set.class) {
			return new HashSet<>();
		}

		try {
			return (Collection<Object>) targetType.getDeclaredConstructor().newInstance();
		} catch (Exception e) {
			throw new JsonException(e);
		}
	}

@ SuppressWarnings ( "unchecked" ) protected Collection < Object > newArrayInstance ( final Class targetType ) { if ( targetType == null || targetType == List . class || targetType == Collection . class || targetType . isArray ( ) ) { return listSupplier . get ( ) ; } if ( targetType == Set . class ) { return new HashSet <> ( ) ; } try { return ( Collection < Object > ) targetType . getDeclaredConstructor ( ) . newInstance ( ) ; } catch ( Exception e ) { throw new JsonException ( e ) ; } }

Creates new type for JSON array objects.
It returns a collection.
Later, the collection will be converted into the target type.

Creates new type for JSON array objects . It returns a collection . Later the collection will be converted into the target type .


protected void injectValueIntoObject(final Object target, final PropertyDescriptor pd, final Object value) {
		Object convertedValue = value;

		if (value != null) {
			Class targetClass = pd.getType();

			convertedValue = convertType(value, targetClass);
		}

		try {
			Setter setter = pd.getSetter(true);
			if (setter != null) {
				setter.invokeSetter(target, convertedValue);
			}
		} catch (Exception ex) {
			throw new JsonException(ex);
		}
	}

protected void injectValueIntoObject ( final Object target , final PropertyDescriptor pd , final Object value ) { Object convertedValue = value ; if ( value != null ) { Class targetClass = pd . getType ( ) ; convertedValue = convertType ( value , targetClass ) ; } try { Setter setter = pd . getSetter ( true ) ; if ( setter != null ) { setter . invokeSetter ( target , convertedValue ) ; } } catch ( Exception ex ) { throw new JsonException ( ex ) ; } }

Injects value into the targets property.

Injects value into the targets property .


protected Object convertType(final Object value, final Class targetType) {
		final Class valueClass = value.getClass();

		if (valueClass == targetType) {
			return value;
		}

		try {
			return TypeConverterManager.get().convertType(value, targetType);
		}
		catch (Exception ex) {
			if (!strictTypes) {
				return null;
			}
			throw new JsonException("Type conversion failed", ex);
		}
	}

protected
Object
convertType
(
final
Object
value
,
final
Class
targetType
)
{
final
Class
valueClass
=
value
.
getClass
(
)
;
if
(
valueClass
==
targetType
)
{
return
value
;
}
try
{
return
TypeConverterManager
.
get
(
)
.
convertType
(
value
,
targetType
)
;
}
catch
(
Exception
ex
)
{
if
(
!
strictTypes
)
{
return
;
}
throw
new
JsonException
(
"Type conversion failed"
,
ex
)
;
}
}


public void visitProvide(final String service, final String... providers) {
    if (mv != null) {
      mv.visitProvide(service, providers);
    }
  }

public void visitProvide ( final String service , final String ... providers ) { if ( mv != null ) { mv . visitProvide ( service , providers ) ; } }

Visit an implementation of a service.

@param service the internal name of the service.
@param providers the internal names of the implementations of the service (there is at least
one provider).


@SuppressWarnings("unchecked")
	public static <A> TypeCache<A> createDefault() {
		return (TypeCache<A>)Defaults.implementation.get();
	}

@ SuppressWarnings ( "unchecked" ) public static < A > TypeCache < A > createDefault ( ) { return ( TypeCache < A > ) Defaults . implementation . get ( ) ; }

Creates default implementation of the type cache.

Creates default implementation of the type cache .


public T put(final Class<?> type, final T value) {
		return map.put(type, value);
	}

public T put ( final Class < ? > type , final T value ) { return map . put ( type , value ) ; }


public MethodDescriptor[] getAllMethodDescriptors() {
		if (allMethods == null) {
			final List<MethodDescriptor> allMethodsList = new ArrayList<>();

			for (MethodDescriptor[] methodDescriptors : methodsMap.values()) {
				Collections.addAll(allMethodsList, methodDescriptors);
			}

			final MethodDescriptor[] allMethods = allMethodsList.toArray(new MethodDescriptor[0]);

			Arrays.sort(allMethods, Comparator.comparing(md -> md.getMethod().getName()));

			this.allMethods = allMethods;
		}
		return allMethods;
	}

public MethodDescriptor [ ] getAllMethodDescriptors ( ) { if ( allMethods == null ) { final List < MethodDescriptor > allMethodsList = new ArrayList <> ( ) ; for ( MethodDescriptor [ ] methodDescriptors : methodsMap . values ( ) ) { Collections . addAll ( allMethodsList , methodDescriptors ) ; } final MethodDescriptor [ ] allMethods = allMethodsList . toArray ( new MethodDescriptor [ 0 ] ) ; Arrays . sort ( allMethods , Comparator . comparing ( md -> md . getMethod ( ) . getName ( ) ) ) ; this . allMethods = allMethods ; } return allMethods ; }


public static String resolveIpAddress(final String hostname) {
		try {
			InetAddress netAddress;

			if (hostname == null || hostname.equalsIgnoreCase(LOCAL_HOST)) {
				netAddress = InetAddress.getLocalHost();
			} else {
				netAddress = Inet4Address.getByName(hostname);
			}
			return netAddress.getHostAddress();
		} catch (UnknownHostException ignore) {
			return null;
		}
	}

public static String resolveIpAddress ( final String hostname ) { try { InetAddress netAddress ; if ( hostname == null || hostname . equalsIgnoreCase ( LOCAL_HOST ) ) { netAddress = InetAddress . getLocalHost ( ) ; } else { netAddress = Inet4Address . getByName ( hostname ) ; } return netAddress . getHostAddress ( ) ; } catch ( UnknownHostException ignore ) { return null ; } }


public static int getIpAsInt(final String ipAddress) {
		int ipIntValue = 0;
		String[] tokens = StringUtil.splitc(ipAddress, '.');
		for (String token : tokens) {
			if (ipIntValue > 0) {
				ipIntValue <<= 8;
			}
			ipIntValue += Integer.parseInt(token);
		}
		return ipIntValue;
	}

public static int getIpAsInt ( final String ipAddress ) { int ipIntValue = 0 ; String [ ] tokens = StringUtil . splitc ( ipAddress , ' ' ) ; for ( String token : tokens ) { if ( ipIntValue > 0 ) { ipIntValue <<= 8 ; } ipIntValue += Integer . parseInt ( token ) ; } return ipIntValue ; }


public static boolean validateAgaintIPAdressV4Format(final String input) {
		if (input == null) {
			return false;
		}

		int hitDots = 0;
		char[] data = input.toCharArray();
		for (int i = 0; i < data.length; i++) {
			char c = data[i];
			int b = 0;
			do {
				if (c < '0' || c > '9') {
					return false;
				}
				b = (b * 10 + c) - 48;
				if (++i >= data.length) {
					break;
				}
				c = data[i];
			} while (c != '.');

			if (b > 255) {
				return false;
			}
			hitDots++;
		}

		return hitDots == 4;
	}

public static boolean validateAgaintIPAdressV4Format ( final String input ) { if ( input == null ) { return false ; } int hitDots = 0 ; char [ ] data = input . toCharArray ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { char c = data [ i ] ; int b = 0 ; do { if ( c < ' ' || c > ' ' ) { return false ; } b = ( b * 10 + c ) - 48 ; if ( ++ i >= data . length ) { break ; } c = data [ i ] ; } while ( c != ' ' ) ; if ( b > 255 ) { return false ; } hitDots ++ ; } return hitDots == 4 ; }

Checks given string against IP address v4 format.

@param input an ip address - may be null
@return <tt>true</tt> if param has a valid ip v4 format <tt>false</tt> otherwise
@see ip address v4

Checks given string against IP address v4 format .


public static String resolveHostName(final byte[] ip) {
		try {
			InetAddress address = InetAddress.getByAddress(ip);
			return address.getHostName();
		} catch (UnknownHostException ignore) {
			return null;
		}
	}

public static String resolveHostName ( final byte [ ] ip ) { try { InetAddress address = InetAddress . getByAddress ( ip ) ; return address . getHostName ( ) ; } catch ( UnknownHostException ignore ) { return null ; } }

Resolves host name from IP address bytes.

Resolves host name from IP address bytes .


public static byte[] downloadBytes(final String url) throws IOException {
		try (InputStream inputStream = new URL(url).openStream()) {
			return StreamUtil.readBytes(inputStream);
		}
	}

public static byte [ ] downloadBytes ( final String url ) throws IOException { try ( InputStream inputStream = new URL ( url ) . openStream ( ) ) { return StreamUtil . readBytes ( inputStream ) ; } }


public static String downloadString(final String url, final String encoding) throws IOException {
		try (InputStream inputStream = new URL(url).openStream()) {
			return new String(StreamUtil.readChars(inputStream, encoding));
		}
	}

public static String downloadString ( final String url , final String encoding ) throws IOException { try ( InputStream inputStream = new URL ( url ) . openStream ( ) ) { return new String ( StreamUtil . readChars ( inputStream , encoding ) ) ; } }


public static void downloadFile(final String url, final File file) throws IOException {
		try (
			InputStream inputStream = new URL(url).openStream();
			ReadableByteChannel rbc = Channels.newChannel(inputStream);
			FileChannel fileChannel = FileChannel.open(
				file.toPath(),
				StandardOpenOption.CREATE,
				StandardOpenOption.TRUNCATE_EXISTING,
				StandardOpenOption.WRITE)
		) {
			fileChannel.transferFrom(rbc, 0, Long.MAX_VALUE);
		}
	}

public static void downloadFile ( final String url , final File file ) throws IOException { try ( InputStream inputStream = new URL ( url ) . openStream ( ) ; ReadableByteChannel rbc = Channels . newChannel ( inputStream ) ; FileChannel fileChannel = FileChannel . open ( file . toPath ( ) , StandardOpenOption . CREATE , StandardOpenOption . TRUNCATE_EXISTING , StandardOpenOption . WRITE ) ) { fileChannel . transferFrom ( rbc , 0 , Long . MAX_VALUE ) ; } }

Downloads resource to a file, potentially very efficiently.

Downloads resource to a file potentially very efficiently .


protected void inject(final ActionRequest actionRequest) {
		final Targets targets = actionRequest.getTargets();
		final ServletContext servletContext = actionRequest.getHttpServletRequest().getServletContext();

		scopeResolver.forEachScope(madvocScope -> madvocScope.inject(servletContext, targets));
		scopeResolver.forEachScope(madvocScope -> madvocScope.inject(actionRequest, targets));

	}

protected void inject ( final ActionRequest actionRequest ) { final Targets targets = actionRequest . getTargets ( ) ; final ServletContext servletContext = actionRequest . getHttpServletRequest ( ) . getServletContext ( ) ; scopeResolver . forEachScope ( madvocScope -> madvocScope . inject ( servletContext , targets ) ) ; scopeResolver . forEachScope ( madvocScope -> madvocScope . inject ( actionRequest , targets ) ) ; }


protected void outject(final ActionRequest actionRequest) {
		final Targets targets = actionRequest.getTargets();

		scopeResolver.forEachScope(madvocScope -> madvocScope.outject(actionRequest, targets));
	}

protected void outject ( final ActionRequest actionRequest ) { final Targets targets = actionRequest . getTargets ( ) ; scopeResolver . forEachScope ( madvocScope -> madvocScope . outject ( actionRequest , targets ) ) ; }


public static Socket connect(final String hostname, final int port) throws IOException {
		final Socket socket = new Socket();
		socket.connect(new InetSocketAddress(hostname, port));
		return socket;
	}

public static Socket connect ( final String hostname , final int port ) throws IOException { final Socket socket = new Socket ( ) ; socket . connect ( new InetSocketAddress ( hostname , port ) ) ; return socket ; }


public static Socket connect(final String hostname, final int port, final int connectionTimeout) throws IOException {
		final Socket socket = new Socket();
		if (connectionTimeout <= 0) {
			socket.connect(new InetSocketAddress(hostname, port));
		}
		else {
			socket.connect(new InetSocketAddress(hostname, port), connectionTimeout);
		}
		return socket;
	}

public static Socket connect ( final String hostname , final int port , final int connectionTimeout ) throws IOException { final Socket socket = new Socket ( ) ; if ( connectionTimeout <= 0 ) { socket . connect ( new InetSocketAddress ( hostname , port ) ) ; } else { socket . connect ( new InetSocketAddress ( hostname , port ) , connectionTimeout ) ; } return socket ; }


private static int getPrimitiveClassNameIndex(final String className) {
		int dotIndex = className.indexOf('.');
		if (dotIndex != -1) {
			return -1;
		}
		return Arrays.binarySearch(PRIMITIVE_TYPE_NAMES, className);
	}

private static int getPrimitiveClassNameIndex ( final String className ) { int dotIndex = className . indexOf ( ' ' ) ; if ( dotIndex != - 1 ) { return - 1 ; } return Arrays . binarySearch ( PRIMITIVE_TYPE_NAMES , className ) ; }

Detects if provided class name is a primitive type.
Returns >= 0 number if so.

Detects if provided class name is a primitive type . Returns > = 0 number if so .


@Override
	public Class loadClass(final String className, final ClassLoader classLoader) throws ClassNotFoundException {
		String arrayClassName = prepareArrayClassnameForLoading(className);

		if ((className.indexOf('.') == -1) && (arrayClassName == null)) {
			// maybe a primitive
			int primitiveNdx = getPrimitiveClassNameIndex(className);
			if (primitiveNdx >= 0) {
				return PRIMITIVE_TYPES[primitiveNdx];
			}
		}

		// try #1 - using provided class loader
		if (classLoader != null) {
			Class klass = loadClass(className, arrayClassName, classLoader);

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

		// try #2 - using thread class loader
		ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader();

		if ((currentThreadClassLoader != null) && (currentThreadClassLoader != classLoader)) {
			Class klass = loadClass(className, arrayClassName, currentThreadClassLoader);

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

		// try #3 - using caller classloader, similar as Class.forName()
		//Class callerClass = ReflectUtil.getCallerClass(2);
		Class callerClass = ClassUtil.getCallerClass();
		ClassLoader callerClassLoader = callerClass.getClassLoader();

		if ((callerClassLoader != classLoader) && (callerClassLoader != currentThreadClassLoader)) {
			Class klass = loadClass(className, arrayClassName, callerClassLoader);

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

		// try #4 - everything failed, try alternative array loader
		if (arrayClassName != null) {
			try {
				return loadArrayClassByComponentType(className, classLoader);
			} catch (ClassNotFoundException ignore) {
			}
		}

		throw new ClassNotFoundException("Class not found: " + className);
	}


protected Class loadArrayClassByComponentType(final String className, final ClassLoader classLoader) throws ClassNotFoundException {
		int ndx = className.indexOf('[');
		int multi = StringUtil.count(className, '[');

		String componentTypeName = className.substring(0, ndx);

		Class componentType = loadClass(componentTypeName, classLoader);

		if (multi == 1) {
			return Array.newInstance(componentType, 0).getClass();
		}

		int[] multiSizes;

		if (multi == 2) {
			multiSizes = new int[] {0, 0};
		} else if (multi == 3) {
			multiSizes = new int[] {0, 0, 0};
		} else {
			multiSizes = (int[]) Array.newInstance(int.class, multi);
		}

		return Array.newInstance(componentType, multiSizes).getClass();
	}

protected Class loadArrayClassByComponentType ( final String className , final ClassLoader classLoader ) throws ClassNotFoundException { int ndx = className . indexOf ( ' ' ) ; int multi = StringUtil . count ( className , ' ' ) ; String componentTypeName = className . substring ( 0 , ndx ) ; Class componentType = loadClass ( componentTypeName , classLoader ) ; if ( multi == 1 ) { return Array . newInstance ( componentType , 0 ) . getClass ( ) ; } int [ ] multiSizes ; if ( multi == 2 ) { multiSizes = new int [ ] { 0 , 0 } ; } else if ( multi == 3 ) { multiSizes = new int [ ] { 0 , 0 , 0 } ; } else { multiSizes = ( int [ ] ) Array . newInstance ( int . class , multi ) ; } return Array . newInstance ( componentType , multiSizes ) . getClass ( ) ; }

Loads array class using component type .


@Override
	public void shutdown() {
		for (final BeanData beanData : instances.values()) {
			beanData.callDestroyMethods();
		}
		instances.clear();
	}

@ Override public void shutdown ( ) { for ( final BeanData beanData : instances . values ( ) ) { beanData . callDestroyMethods ( ) ; } instances . clear ( ) ; }

Iterate all beans and invokes registered destroy methods.

Iterate all beans and invokes registered destroy methods .


public static <T extends Comparable> BinarySearch<T> forArray(final T[] array) {
		return new BinarySearch<T>() {
			@Override
			@SuppressWarnings( {"unchecked"})
			protected int compare(final int index, final T element) {
				return array[index].compareTo(element);
			}

			@Override
			protected int getLastIndex() {
				return array.length - 1;
			}
		};
	}

public static < T extends Comparable > BinarySearch < T > forArray ( final T [ ] array ) { return new BinarySearch < T > ( ) { @ Override @ SuppressWarnings ( { "unchecked" } ) protected int compare ( final int index , final T element ) { return array [ index ] . compareTo ( element ) ; } @ Override protected int getLastIndex ( ) { return array . length - 1 ; } } ; }

Creates binary search wrapper over an array.

Creates binary search wrapper over an array .


public static <T> BinarySearch<T> forArray(final T[] array, final Comparator<T> comparator) {
		return new BinarySearch<T>() {
			@Override
			@SuppressWarnings( {"unchecked"})
			protected int compare(final int index, final T element) {
				return comparator.compare(array[index], element);
			}

			@Override
			protected int getLastIndex() {
				return array.length - 1;
			}
		};
	}

public static < T > BinarySearch < T > forArray ( final T [ ] array , final Comparator < T > comparator ) { return new BinarySearch < T > ( ) { @ Override @ SuppressWarnings ( { "unchecked" } ) protected int compare ( final int index , final T element ) { return comparator . compare ( array [ index ] , element ) ; } @ Override protected int getLastIndex ( ) { return array . length - 1 ; } } ; }

Creates binary search wrapper over an array with given comparator.

Creates binary search wrapper over an array with given comparator .


public T exclude(final String... excludes) {
		for (String ex : excludes) {
			rules.exclude(ex);
		}
		return _this();
	}

public T exclude ( final String ... excludes ) { for ( String ex : excludes ) { rules . exclude ( ex ) ; } return _this ( ) ; }


public T include(final String... includes) {
		for (String in : includes) {
			rules.include(in);
		}
		return _this();
	}

public T include ( final String ... includes ) { for ( String in : includes ) { rules . include ( in ) ; } return _this ( ) ; }


public T includeAs(final Class template) {
		blacklist = false;

		String[] properties = getAllBeanPropertyNames(template, false);

		include(properties);

		return _this();
	}

public T includeAs ( final Class template ) { blacklist = false ; String [ ] properties = getAllBeanPropertyNames ( template , false ) ; include ( properties ) ; return _this ( ) ; }

Defines included property names as public properties
of given template class. Sets to black list mode.

Defines included property names as public properties of given template class . Sets to black list mode .


public void start(final int startIndex) {
		this.tagStartIndex = startIndex;
		this.name = null;
		this.idNdx = -1;
		this.attributesCount = 0;
		this.tagLength = 0;
		this.modified = false;
		this.type = TagType.START;
		this.rawTag = false;
	}

public void start ( final int startIndex ) { this . tagStartIndex = startIndex ; this . name = null ; this . idNdx = - 1 ; this . attributesCount = 0 ; this . tagLength = 0 ; this . modified = false ; this . type = TagType . START ; this . rawTag = false ; }

Starts the tag with the index of first '<'.
Resets all tag data.

Starts the tag with the index of first < . Resets all tag data .


public <T> void registerComponent(final String name, final Class<T> component, final Consumer<T> consumer) {
		log.debug(() -> "Madvoc WebApp component: [" + name + "] --> " + component.getName());

		madpc.removeBean(name);
		madpc.registerPetiteBean(component, name, null, null, false, consumer);
	}

public
<
T
>
void
registerComponent
(
final
String
name
,
final
Class
<
T
>
component
,
final
Consumer
<
T
>
consumer
)
{
log
.
debug
(
(
)
->
"Madvoc WebApp component: ["
+
name
+
"] --> "
+
component
.
getName
(
)
)
;
madpc
.
removeBean
(
name
)
;
madpc
.
registerPetiteBean
(
component
,
name
,
,
,
false
,
consumer
)
;
}

Registers Madvoc component with given name.

Registers Madvoc component with given name .


protected void resolveColumnDbSqlType(final Connection connection, final DbEntityColumnDescriptor dec) {
		if (dec.dbSqlType != SqlType.DB_SQLTYPE_UNKNOWN) {
			return;
		}
		ResultSet rs = null;
		DbEntityDescriptor ded = dec.getDbEntityDescriptor();
		try {
			DatabaseMetaData dmd = connection.getMetaData();
			rs = dmd.getColumns(null, ded.getSchemaName(), ded.getTableName(), dec.getColumnName());
			if (rs.next()) {
				dec.dbSqlType = rs.getInt("DATA_TYPE");
			} else {
				dec.dbSqlType = SqlType.DB_SQLTYPE_NOT_AVAILABLE;
				if (log.isWarnEnabled()) {
					log.warn("Column SQL type not available: " + ded.toString() + '.' + dec.getColumnName());
				}
			}
		} catch (SQLException sex) {
			dec.dbSqlType = SqlType.DB_SQLTYPE_NOT_AVAILABLE;
			if (log.isWarnEnabled()) {
				log.warn("Column SQL type not resolved: " + ded.toString() + '.' + dec.getColumnName(), sex);
			}
		} finally {
			DbUtil.close(rs);
		}
	}

protected
void
resolveColumnDbSqlType
(
final
Connection
connection
,
final
DbEntityColumnDescriptor
dec
)
{
if
(
dec
.
dbSqlType
!=
SqlType
.
DB_SQLTYPE_UNKNOWN
)
{
return
;
}
ResultSet
rs
=
;
DbEntityDescriptor
ded
=
dec
.
getDbEntityDescriptor
(
)
;
try
{
DatabaseMetaData
dmd
=
connection
.
getMetaData
(
)
;
rs
=
dmd
.
getColumns
(
,
ded
.
getSchemaName
(
)
,
ded
.
getTableName
(
)
,
dec
.
getColumnName
(
)
)
;
if
(
rs
.
next
(
)
)
{
dec
.
dbSqlType
=
rs
.
getInt
(
"DATA_TYPE"
)
;
}
else
{
dec
.
dbSqlType
=
SqlType
.
DB_SQLTYPE_NOT_AVAILABLE
;
if
(
log
.
isWarnEnabled
(
)
)
{
log
.
warn
(
"Column SQL type not available: "
+
ded
.
toString
(
)
+
'
'
+
dec
.
getColumnName
(
)
)
;
}
}
}
catch
(
SQLException
sex
)
{
dec
.
dbSqlType
=
SqlType
.
DB_SQLTYPE_NOT_AVAILABLE
;
if
(
log
.
isWarnEnabled
(
)
)
{
log
.
warn
(
"Column SQL type not resolved: "
+
ded
.
toString
(
)
+
'
'
+
dec
.
getColumnName
(
)
,
sex
)
;
}
}
finally
{
DbUtil
.
close
(
rs
)
;
}
}

Resolves column db sql type and populates it in column descriptor if missing.

Resolves column db sql type and populates it in column descriptor if missing .


protected String preprocessSql(String sqlString) {
		// detects callable statement
		if (sqlString.charAt(0) == '{') {
			return sqlString;
		}

		// quickly detect if SQL string is a key
		if (!CharUtil.isAlpha(sqlString.charAt(0))) {
			sqlString = sqlString.substring(1);
		}
		else if (sqlString.indexOf(' ') != -1) {
			return sqlString;
		}

		final String sqlFromMap = dbOom.queryMap().getQuery(sqlString);

		if (sqlFromMap != null) {
			sqlString = sqlFromMap.trim();
		}

		return sqlString;
	}

Pre-process SQL before using it. If string starts with a non-ascii char
or it has no spaces, it will be loaded from the query map.

Pre - process SQL before using it . If string starts with a non - ascii char or it has no spaces it will be loaded from the query map .


protected ResultSetMapper createResultSetMapper(final ResultSet resultSet) {
		final Map<String, ColumnData> columnAliases = sqlgen != null ? sqlgen.getColumnData() : null;

		return new DefaultResultSetMapper(dbOom, resultSet, columnAliases, cacheEntities, this);
	}

protected ResultSetMapper createResultSetMapper ( final ResultSet resultSet ) { final Map < String , ColumnData > columnAliases = sqlgen != null ? sqlgen . getColumnData ( ) : null ; return new DefaultResultSetMapper ( dbOom , resultSet , columnAliases , cacheEntities , this ) ; }


public <T> T findGeneratedKey(final Class<T> type) {
		return find(new Class[] {type}, false, getGeneratedColumns());
	}

public < T > T findGeneratedKey ( final Class < T > type ) { return find ( new Class [ ] { type } , false , getGeneratedColumns ( ) ) ; }

Finds generated key column of given type.

Finds generated key column of given type .


public void populateGeneratedKeys(final Object entity) {

		final String[] generatedColumns = getGeneratedColumnNames();
		if (generatedColumns == null) {
			return;
		}
		DbEntityDescriptor ded = dbOom.entityManager().lookupType(entity.getClass());

		// prepare key types
		Class[] keyTypes = new Class[generatedColumns.length];
		String[] properties = new String[generatedColumns.length];
		for (int i = 0; i < generatedColumns.length; i++) {
			String column = generatedColumns[i];
			DbEntityColumnDescriptor decd = ded.findByColumnName(column);
			if (decd != null) {
				keyTypes[i] = decd.getPropertyType();
				properties[i] = decd.getPropertyName();
			}
		}

		final Object keyValues = findGeneratedColumns(keyTypes);
		if (!keyValues.getClass().isArray()) {
			BeanUtil.declared.setProperty(entity, properties[0], keyValues);
		} else {
			for (int i = 0; i < properties.length; i++) {
				BeanUtil.declared.setProperty(entity, properties[i], ((Object[]) keyValues)[i]);
			}
		}
	}

public
void
populateGeneratedKeys
(
final
Object
entity
)
{
final
String
[
]
generatedColumns
=
getGeneratedColumnNames
(
)
;
if
(
generatedColumns
==
)
{
return
;
}
DbEntityDescriptor
ded
=
dbOom
.
entityManager
(
)
.
lookupType
(
entity
.
getClass
(
)
)
;
// prepare key types
Class
[
]
keyTypes
=
new
Class
[
generatedColumns
.
length
]
;
String
[
]
properties
=
new
String
[
generatedColumns
.
length
]
;
for
(
int
i
=
0
;
i
<
generatedColumns
.
length
;
i
++
)
{
String
column
=
generatedColumns
[
i
]
;
DbEntityColumnDescriptor
decd
=
ded
.
findByColumnName
(
column
)
;
if
(
decd
!=
)
{
keyTypes
[
i
]
=
decd
.
getPropertyType
(
)
;
properties
[
i
]
=
decd
.
getPropertyName
(
)
;
}
}
final
Object
keyValues
=
findGeneratedColumns
(
keyTypes
)
;
if
(
!
keyValues
.
getClass
(
)
.
isArray
(
)
)
{
BeanUtil
.
declared
.
setProperty
(
entity
,
properties
[
0
]
,
keyValues
)
;
}
else
{
for
(
int
i
=
0
;
i
<
properties
.
length
;
i
++
)
{
BeanUtil
.
declared
.
setProperty
(
entity
,
properties
[
i
]
,
(
(
Object
[
]
)
keyValues
)
[
i
]
)
;
}
}
}

Populates entity with generated column values from executed query.

Populates entity with generated column values from executed query .


@Override
	protected <R extends ActionInterceptor> R createWrapper(final Class<R> wrapperClass) {
		return petiteContainer.createBean(wrapperClass);
	}

@ Override protected < R extends ActionInterceptor > R createWrapper ( final Class < R > wrapperClass ) { return petiteContainer . createBean ( wrapperClass ) ; }

Acquires interceptor from Petite container.

Acquires interceptor from Petite container .