/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.objectmodel.Entity
 *  com.l7tech.objectmodel.ExternalEntityHeader
 *  com.l7tech.objectmodel.migration.MigrationUtils
 *  com.l7tech.objectmodel.migration.PropertyResolver
 *  com.l7tech.objectmodel.migration.PropertyResolver$Type
 *  com.l7tech.objectmodel.migration.PropertyResolverException
 *  com.l7tech.policy.assertion.Assertion
 */
package com.l7tech.server.migration;

import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.ExternalEntityHeader;
import com.l7tech.objectmodel.migration.MigrationUtils;
import com.l7tech.objectmodel.migration.PropertyResolver;
import com.l7tech.objectmodel.migration.PropertyResolverException;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.server.migration.PropertyResolverFactory;
import java.lang.reflect.Method;

public abstract class AbstractPropertyResolver
implements PropertyResolver {
    private PropertyResolverFactory a;
    private PropertyResolver.Type b;
    private static final String[] f;

    public AbstractPropertyResolver(PropertyResolverFactory propertyResolverFactory, PropertyResolver.Type type) {
        this.a = propertyResolverFactory;
        this.b = type;
    }

    public PropertyResolver.Type getType() {
        return this.b;
    }

    public PropertyResolver getResolver(Method method) throws PropertyResolverException {
        PropertyResolver propertyResolver;
        block4: {
            propertyResolver = this.a.getPropertyResolver(MigrationUtils.getTargetType((Method)method));
            try {
                try {
                    if (!propertyResolver.getClass().equals(this.a.getPropertyResolver(PropertyResolver.Type.DEFAULT).getClass()) || !Assertion.class.isAssignableFrom(method.getDeclaringClass())) break block4;
                }
                catch (PropertyResolverException propertyResolverException) {
                    throw AbstractPropertyResolver.a(propertyResolverException);
                }
                return this.a.getPropertyResolver(PropertyResolver.Type.ASSERTION);
            }
            catch (PropertyResolverException propertyResolverException) {
                throw AbstractPropertyResolver.a(propertyResolverException);
            }
        }
        return propertyResolver;
    }

    public Entity valueMapping(ExternalEntityHeader externalEntityHeader) throws PropertyResolverException {
        throw new PropertyResolverException(f[1] + String.valueOf(externalEntityHeader));
    }

    protected static Object getPropertyValue(Object object, Method method) throws PropertyResolverException {
        Object object2;
        try {
            object2 = method.invoke(object, new Object[0]);
        }
        catch (Exception exception) {
            throw new PropertyResolverException(f[0] + String.valueOf(object), (Throwable)exception);
        }
        return object2;
    }

    private static PropertyResolverException a(PropertyResolverException propertyResolverException) {
        return propertyResolverException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "SRS\u000e\u00051#sTU\b\u0019vdfRN\u0011\u0012c0o\u0000W\u0000\u001bd!6FN\u0013Wt*bIU\u0018M1(@AM\u0014\u00121)wPQ\b\u0019vdxOUA\u0004d4fOS\u0015\u0012udpOSA\u001ft%rES[W";
        int n3 = "SRS\u000e\u00051#sTU\b\u0019vdfRN\u0011\u0012c0o\u0000W\u0000\u001bd!6FN\u0013Wt*bIU\u0018M1(@AM\u0014\u00121)wPQ\b\u0019vdxOUA\u0004d4fOS\u0015\u0012udpOSA\u001ft%rES[W".length();
        int n4 = 41;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = AbstractPropertyResolver.a(89, AbstractPropertyResolver.b(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                f = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x1D);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 79;
                    case 1 -> 121;
                    case 2 -> 120;
                    case 3 -> 56;
                    case 4 -> 46;
                    case 5 -> 72;
                    default -> 29;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

