public final class Reflect extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Reflect.MetricFactory
Name of metric factory method to use.
|
static interface |
Reflect.Proxied
Can provide proxied implementation.
|
| Modifier and Type | Method and Description |
|---|---|
static <MI extends IF,AI extends IF,IF> |
asInstanceOf(Class<MI> markerInterface,
AI implementation)
Hide actual implementation and type parameters by proxying to a marker interface.
|
static <R extends B,B extends Descriptor,T extends Serializable,G extends DescriptorGenerator<B>,C extends DescriptorComparator<B>> |
createSweetenedGenerator(Object guardObject,
Class<G> generatorClass,
Class<C> comparatorClass,
Function<Molecule,R> generateFunction,
String generatorToString,
Function bareRetrieverFunction,
DescriptorSerializer<B> descriptorSerializer,
ComparisonContextFactory<DescriptorComparator<B>,B,T> comparisonContextFactory,
DescriptorParameters descriptorParameters)
Put together a type system sweetened
DescriptorGenerator proxy from its components. |
static <DC extends DescriptorComparator<D>,D extends Descriptor> |
descriptorComparatorWithOtherContext(DC base,
UnguardedContext<D,?> context)
Delegate a
DescriptorComparator with a new UnguardedContext. |
static void |
ensureSerializable(Object o)
Ensure that serializable.
|
static void |
ensureSerializable(String name,
Object o)
Ensure that serializable.
|
static Function<Object,Object> |
getBaseWhenProxied()
Get base object for a proxied.
|
static <T> T |
throwingUnsupportedOperationException(Class<T> type,
String message)
Proxy throwing
UnsupportedOperationException for all invocations. |
static <T extends Guarded> |
throwingUnsupportedOperationExceptionGuarded(Class<T> type,
Object guardObject,
String message)
Proxy throwing
UnsupportedOperationException for all invocations except guard object check. |
public static <DC extends DescriptorComparator<D>,D extends Descriptor> DC descriptorComparatorWithOtherContext(DC base, UnguardedContext<D,?> context)
DescriptorComparator with a new UnguardedContext.DC - Exposed DescriptorComparatorD - Descriptor bare typebase - Comparator to delegatecontext - Replacement contextpublic static <T> T throwingUnsupportedOperationException(Class<T> type, String message)
UnsupportedOperationException for all invocations.T - Type to implementtype - Type to implementmessage - Message for the exceptionpublic static <T extends Guarded> T throwingUnsupportedOperationExceptionGuarded(Class<T> type, Object guardObject, String message)
UnsupportedOperationException for all invocations except guard object check.T - Type to implementtype - Type to implementguardObject - Guard object to returnmessage - Message for the exceptionpublic static <MI extends IF,AI extends IF,IF> MI asInstanceOf(Class<MI> markerInterface, AI implementation)
IF - A common base interfaceAI - An actual implementation of the base interfaceMI - A marker interface hiding the common interfacemarkerInterface - marker interface typeimplementation - Actual implementation to proxyReflect.Proxied is also implemented and its
Reflect.Proxied.getProxiedImplementation() returns the implementation objectpublic static Function<Object,Object> getBaseWhenProxied()
public static <R extends B,B extends Descriptor,T extends Serializable,G extends DescriptorGenerator<B>,C extends DescriptorComparator<B>> G createSweetenedGenerator(Object guardObject, Class<G> generatorClass, Class<C> comparatorClass, Function<Molecule,R> generateFunction, String generatorToString, Function bareRetrieverFunction, DescriptorSerializer<B> descriptorSerializer, ComparisonContextFactory<DescriptorComparator<B>,B,T> comparisonContextFactory, DescriptorParameters descriptorParameters)
DescriptorGenerator proxy from its components.R - Rich form of generated descriptorsB - Bare form of generated descriptorsT - Unguarded form exposed by the comparison context factoryG - Type system sweetened DescriptorGeneratorC - Type system sweetened DescriptorComparatorguardObject - Associated guard objectgeneratorClass - Type system sweetened generator type to return.comparatorClass - Type system sweetened comparator type to return. Comparator factory methods of the
generator will return proxies of the comparator classgenerateFunction - Generator for the rich form, method
DescriptorGenerator.generateDescriptor(chemaxon.struc.Molecule) will delegate to this functiongeneratorToString - String representation of the generator, method toString()
will return the given StringbareRetrieverFunction - Function to retrieve bare form. Note that guard object check is ensured by the
proxy. Method DescriptorGenerator.getBareDescriptor(com.chemaxon.descriptors.common.Descriptor) will
delegatedescriptorSerializer - Serializer to expose.comparisonContextFactory - Comparison context to expose by
DescriptorGenerator.comparisonContextFactory(). Will also be used for comparator factory methods.descriptorParameters - Parameters object to return by DescriptorGenerator.getParameters()Descriptorpublic static void ensureSerializable(Object o)
o - Object to checkIllegalArgumentException - when not serializablepublic static void ensureSerializable(String name, Object o)
name - Name to display in exception messageo - Object to checkIllegalArgumentException - when not serializable