text:
package net.bytebuddy.description.method;

import net.bytebuddy.description.ByteCodeElement;
import net.bytebuddy.description.ModifierReviewable;
import net.bytebuddy.description.NamedElement;
import net.bytebuddy.description.annotation.AnnotationDescription;
import net.bytebuddy.description.annotation.AnnotationList;
import net.bytebuddy.description.enumeration.EnumerationDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.description.type.TypeList;
import net.bytebuddy.description.type.generic.GenericTypeDescription;
import net.bytebuddy.description.type.generic.GenericTypeList;
import net.bytebuddy.description.type.generic.TypeVariableSource;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.utility.JavaInstance;
import net.bytebuddy.utility.JavaType;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureWriter;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.GenericSignatureFormatError;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.none;

/**
 * Implementations of this interface describe a Java method, i.e. a method or a constructor. Implementations of this
 * interface must provide meaningful {@code equal(Object)} and {@code hashCode()} implementations.
 */
public interface MethodDescription extends TypeVariableSource,
        NamedElement.WithGenericName,
        ByteCodeElement.TypeDependant<MethodDescription.InDefinedShape, MethodDescription.Token> {

    /**
     * The internal name of a Java constructor.
     */
    String CONSTRUCTOR_INTERNAL_NAME = "<init>";

    /**
     * The internal name of a Java static initializer.
     */
    String TYPE_INITIALIZER_INTERNAL_NAME = "<clinit>";

    /**
     * The type initializer of any representation of a type initializer.
     */
    int TYPE_INITIALIZER_MODIFIER = Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC;

    /**
     * Represents a non-defined default value of an annotation property.
     */
    Object NO_DEFAULT_VALUE = null;

    /**
     * Represents any undefined property of a type description that is instead represented as {@code null} in order
     * to resemble the Java reflection API which returns {@code null} and is intuitive to many Java developers.
     */
    MethodDescription UNDEFINED = null;

    /**
     * Returns the return type of the described method.
     *
     * @return The return type of the described method.
     */
    GenericTypeDescription getReturnType();

    /**
     * Returns a list of this method's parameters.
     *
     * @return A list of this method's parameters.
     */
    ParameterList<?> getParameters();

    /**
     * Returns the exception types of the described method.
     *
     * @return The exception types of the described method.
     */
    GenericTypeList getExceptionTypes();

    /**
     * Returns this method modifier but adjusts its state of being abstract.
     *
     * @param nonAbstract {@code true} if the method should be treated as non-abstract.
     * @return The adjusted modifiers.
     */
    int getAdjustedModifiers(boolean nonAbstract);

    /**
     * Checks if this method description represents a constructor.
     *
     * @return {@code true} if this method description represents a constructor.
     */
    boolean isConstructor();

    /**
     * Checks if this method description represents a method, i.e. not a constructor or a type initializer.
     *
     * @return {@code true} if this method description represents a method.
     */
    boolean isMethod();

    /**
     * Checks if this method is a type initializer.
     *
     * @return {@code true} if this method description represents a type initializer.
     */
    boolean isTypeInitializer();

    /**
     * Verifies if a method description represents a given loaded method.
     *
     * @param method The method to be checked.
     * @return {@code true} if this method description represents the given loaded method.
     */
    boolean represents(Method method);

    /**
     * Verifies if a method description represents a given loaded constructor.
     *
     * @param constructor The constructor to be checked.
     * @return {@code true} if this method description represents the given loaded constructor.
     */
    boolean represents(Constructor<?> constructor);

    /**
     * Verifies if this method describes a virtual method, i.e. a method that is inherited by a sub type of this type.
     *
     * @return {@code true} if this method is virtual.
     */
    boolean isVirtual();

    /**
     * Returns the size of the local variable array that is required for this method, i.e. the size of all parameters
     * if they were loaded on the stack including a reference to {@code this} if this method represented a non-static
     * method.
     *
     * @return The size of this method on the operand stack.
     */
    int getStackSize();

    /**
     * Checks if this method represents a Java 8+ default method.
     *
     * @return {@code true} if this method is a default method.
     */
    boolean isDefaultMethod();

    /**
     * Checks if this method can be called using the {@code INVOKESPECIAL} for a given type.
     *
     * @param typeDescription The type o
     * @return {@code true} if this method can be called using the {@code INVOKESPECIAL} instruction
     * using the given type.
     */
    boolean isSpecializableFor(TypeDescription typeDescription);

    /**
     * Returns the default value of this method or {@code null} if no such value exists. The returned values might be
     * of a different type than usual:
     *

     *
{@link java.lang.Class} values are represented as
     * {@link TypeDescription}s.

     *
{@link java.lang.annotation.Annotation} values are represented as
     * {@link AnnotationDescription}s

     *
{@link java.lang.Enum} values are represented as
     * {@link net.bytebuddy.description.enumeration.EnumerationDescription}s.

     *
Arrays of the latter types are represented as arrays of the named wrapper types.

     *

     *
     * @return The default value of this method or {@code null}.
     */
    Object getDefaultValue();

    /**
     * Returns the default value but casts it to the given type. If the type differs from the value, a
     * {@link java.lang.ClassCastException} is thrown.
     *
     * @param type The type to cast the default value to.
     * @param <T>  The type to cast the default value to.
     * @return The casted default value.
     */
    <T> T getDefaultValue(Class<T> type);

    /**
     * Asserts if this method is invokable on an instance of the given type, i.e. the method is an instance method or
     * a constructor and the method is visible to the type and can be invoked on the given instance.
     *
     * @param typeDescription The type to check.
     * @return {@code true} if this method is invokable on an instance of the given type.
     */
    boolean isInvokableOn(TypeDescription typeDescription);

    /**
     * Checks if the method is a bootstrap method.
     *
     * @return {@code true} if the method is a bootstrap method.
     */
    boolean isBootstrap();

    /**
     * Checks if the method is a bootstrap method that accepts the given arguments.
     *
     * @param arguments The arguments that the bootstrap method is expected to accept where primitive values
     *                  are to be represented as their wrapper types, loaded types by {@link TypeDescription},
     *                  method handles by {@link net.bytebuddy.utility.JavaInstance.MethodHandle} instances and
     *                  method types by {@link net.bytebuddy.utility.JavaInstance.MethodType} instances.
     * @return {@code true} if the method is a bootstrap method that accepts the given arguments.
     */
    boolean isBootstrap(List<?> arguments);

    /**
     * Checks if this method is capable of defining a default annotation value.
     *
     * @return {@code true} if it is possible to define a default annotation value for this method.
     */
    boolean isDefaultValue();

    /**
     * Checks if the given value can describe a default annotation value for this method.
     *
     * @param value The value that describes the default annotation value for this method.
     * @return {@code true} if the given value can describe a default annotation value for this method.
     */
    boolean isDefaultValue(Object value);

    /**
     * Returns a type token that represents this method's raw return and parameter types.
     *
     * @return A type token that represents this method's raw return and parameter types.
     */
    TypeToken asTypeToken();

    /**
     * Represents a method in its defined shape, i.e. in the form it is defined by a class without its type variables being resolved.
     */
    interface InDefinedShape extends MethodDescription, ByteCodeElement.Accessible {

        @Override
        TypeDescription getDeclaringType();

        @Override
        ParameterList<ParameterDescription.InDefinedShape> getParameters();

        /**
         * An abstract base implementation of a method description in its defined shape.
         */
        abstract class AbstractBase extends MethodDescription.AbstractBase implements InDefinedShape {

            @Override
            public InDefinedShape asDefined() {
                return this;
            }

            @Override
            public boolean isAccessibleTo(TypeDescription typeDescription) {
                return isVisibleTo(typeDescription) && getDeclaringType().isVisibleTo(typeDescription);
            }
        }
    }

    /**
     * An abstract base implementation of a method description.
     */
    abstract class AbstractBase extends ModifierReviewable.AbstractBase implements MethodDescription {

        /**
         * A merger of all method modifiers that are visible in the Java source code.
         */
        private static final int SOURCE_MODIFIERS = Modifier.PUBLIC
                | Modifier.PROTECTED
                | Modifier.PRIVATE
                | Modifier.ABSTRACT
                | Modifier.STATIC
                | Modifier.FINAL
                | Modifier.SYNCHRONIZED
                | Modifier.NATIVE;

        @Override
        public int getStackSize() {
            return getParameters().asTypeList().getStackSize() + (isStatic() ? 0 : 1);
        }

        @Override
        public boolean isMethod() {
            return !isConstructor() && !isTypeInitializer();
        }

        @Override
        public boolean isConstructor() {
            return CONSTRUCTOR_INTERNAL_NAME.equals(getInternalName());
        }

        @Override
        public boolean isTypeInitializer() {
            return TYPE_INITIALIZER_INTERNAL_NAME.equals(getInternalName());
        }

        @Override
        public boolean represents(Method method) {
            return equals(new ForLoadedMethod(method));
        }

        @Override
        public boolean represents(Constructor<?> constructor) {
            return equals(new ForLoadedConstructor(constructor));
        }

        @Override
        public String getName() {
            return isMethod()
                    ? getInternalName()
                    : getDeclaringType().asErasure().getName();
        }

        @Override
        public String getSourceCodeName() {
            return isMethod()
                    ? getName()
                    : EMPTY_NAME;
        }

        @Override
        public String getDescriptor() {
            StringBuilder descriptor = new StringBuilder("(");
            for (TypeDescription parameterType : getParameters().asTypeList().asErasures()) {
                descriptor.append(parameterType.getDescriptor());
            }
            return descriptor.append(")").append(getReturnType().asErasure().getDescriptor()).toString();
        }

        @Override
        public String getGenericSignature() {
            try {
                SignatureWriter signatureWriter = new SignatureWriter();
                boolean generic = false;
                for (GenericTypeDescription typeVariable : getTypeVariables()) {
                    signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
                    boolean classBound = true;
                    for (GenericTypeDescription upperBound : typeVariable.getUpperBounds()) {
                        upperBound.accept(new GenericTypeDescription.Visitor.ForSignatureVisitor(classBound
                                ? signatureWriter.visitClassBound()
                                : signatureWriter.visitInterfaceBound()));
                        classBound = false;
                    }
                    generic = true;
                }
                for (GenericTypeDescription parameterType : getParameters().asTypeList()) {
                    parameterType.accept(new GenericTypeDescription.Visitor.ForSignatureVisitor(signatureWriter.visitParameterType()));
                    generic = generic || !parameterType.getSort().isNonGeneric();
                }
                GenericTypeDescription returnType = getReturnType();
                returnType.accept(new GenericTypeDescription.Visitor.ForSignatureVisitor(signatureWriter.visitReturnType()));
                generic = generic || !returnType.getSort().isNonGeneric();
                for (GenericTypeDescription exceptionType : getExceptionTypes()) {
                    exceptionType.accept(new GenericTypeDescription.Visitor.ForSignatureVisitor(signatureWriter.visitExceptionType()));
                    generic = generic || !exceptionType.getSort().isNonGeneric();
                }
                return generic
                        ? signatureWriter.toString()
                        : NON_GENERIC_SIGNATURE;
            } catch (GenericSignatureFormatError ignored) {
                return NON_GENERIC_SIGNATURE;
            }
        }

        @Override
        public int getAdjustedModifiers(boolean nonAbstract) {
            return nonAbstract
                    ? getModifiers() & ~(Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE)
                    : getModifiers() & ~Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT;
        }

        @Override
        public boolean isVisibleTo(TypeDescription typeDescription) {
            return (isVirtual() || getDeclaringType().asErasure().isVisibleTo(typeDescription))
                    && (isPublic()
                    || typeDescription.equals(getDeclaringType())
                    || (isProtected() && getDeclaringType().asErasure().isAssignableFrom(typeDescription))
                    || (!isPrivate() && typeDescription.isSamePackage(getDeclaringType().asErasure())));
        }

        @Override
        public boolean isVirtual() {
            return !(isConstructor() || isPrivate() || isStatic() || isTypeInitializer());
        }

        @Override
        public boolean isDefaultMethod() {
            return !isAbstract() && !isBridge() && getDeclaringType().asErasure().isInterface();
        }

        @Override
        public boolean isSpecializableFor(TypeDescription targetType) {
            if (isStatic()) { // Static private methods are never specializable, check static property first
                return false;
            } else if (isPrivate() || isConstructor() || isDefaultMethod()) {
                return getDeclaringType().equals(targetType);
            } else {
                return !isAbstract() && getDeclaringType().asErasure().isAssignableFrom(targetType);
            }
        }

        @Override
        public <T> T getDefaultValue(Class<T> type) {
            return type.cast(getDefaultValue());
        }

        @Override
        public boolean isInvokableOn(TypeDescription typeDescription) {
            return !isStatic()
                    && !isTypeInitializer()
                    && isVisibleTo(typeDescription)
                    && (isVirtual()
                    ? getDeclaringType().asErasure().isAssignableFrom(typeDescription)
                    : getDeclaringType().asErasure().equals(typeDescription));
        }

        @Override
        public boolean isBootstrap() {
            TypeDescription returnType = getReturnType().asErasure();
            if ((isMethod() && (!isStatic()
                    || !(JavaType.CALL_SITE.getTypeStub().isAssignableFrom(returnType) || JavaType.CALL_SITE.getTypeStub().isAssignableTo(returnType))))
                    || (isConstructor() && !JavaType.CALL_SITE.getTypeStub().isAssignableFrom(getDeclaringType().asErasure()))) {
                return false;
            }
            TypeList parameterTypes = getParameters().asTypeList().asErasures();
            switch (parameterTypes.size()) {
                case 0:
                    return false;
                case 1:
                    return parameterTypes.getOnly().represents(Object[].class);
                case 2:
                    return JavaType.METHOD_HANDLES_LOOKUP.getTypeStub().isAssignableTo(parameterTypes.get(0))
                            && parameterTypes.get(1).represents(Object[].class);
                case 3:
                    return JavaType.METHOD_HANDLES_LOOKUP.getTypeStub().isAssignableTo(parameterTypes.get(0))
                            && (parameterTypes.get(1).represents(Object.class) || parameterTypes.get(1).represents(String.class))
                            && (parameterTypes.get(2).represents(Object[].class) || JavaType.METHOD_TYPE.getTypeStub().isAssignableTo(parameterTypes.get(2)));
                default:
                    if (!(JavaType.METHOD_HANDLES_LOOKUP.getTypeStub().isAssignableTo(parameterTypes.get(0))
                            && (parameterTypes.get(1).represents(Object.class) || parameterTypes.get(1).represents(String.class))
                            && (JavaType.METHOD_TYPE.getTypeStub().isAssignableTo(parameterTypes.get(2))))) {
                        return false;
                    }
                    int parameterIndex = 4;
                    for (TypeDescription parameterType : parameterTypes.subList(3, parameterTypes.size())) {
                        if (!parameterType.represents(Object.class) && !parameterType.isConstantPool()) {
                            return parameterType.represents(Object[].class) && parameterIndex == parameterTypes.size();
                        }
                        parameterIndex++;
                    }
                    return true;
            }
        }

        @Override
        public boolean isBootstrap(List<?> arguments) {
            if (!isBootstrap()) {
                return false;
            }
            for (Object argument : arguments) {
                Class<?> argumentType = argument.getClass();
                if (!(argumentType == String.class
                        || argumentType == Integer.class
                        || argumentType == Long.class
                        || argumentType == Float.class
                        || argumentType == Double.class
                        || TypeDescription.class.isAssignableFrom(argumentType)
                        || JavaInstance.MethodHandle.class.isAssignableFrom(argumentType)
                        || JavaInstance.MethodType.class.isAssignableFrom(argumentType))) {
                    throw new IllegalArgumentException("Not a bootstrap argument: " + argument);
                }
            }
            TypeList parameterTypes = getParameters().asTypeList().asErasures();
            // The following assumes that the bootstrap method is a valid one, as checked above.
            if (parameterTypes.size() < 4) {
                return arguments.isEmpty() || parameterTypes.get(parameterTypes.size() - 1).represents(Object[].class);
            } else {
                int index = 4;
                Iterator<?> argumentIterator = arguments.iterator();
                for (TypeDescription parameterType : parameterTypes.subList(3, parameterTypes.size())) {
                    boolean finalParameterCheck = !argumentIterator.hasNext();
                    if (!finalParameterCheck) {
                        Class<?> argumentType = argumentIterator.next().getClass();
                        finalParameterCheck = !(parameterType.represents(String.class) && argumentType == String.class)
                                && !(parameterType.represents(int.class) && argumentType == Integer.class)
                                && !(parameterType.represents(long.class) && argumentType == Long.class)
                                && !(parameterType.represents(float.class) && argumentType == Float.class)
                                && !(parameterType.represents(double.class) && argumentType == Double.class)
                                && !(parameterType.represents(Class.class) && TypeDescription.class.isAssignableFrom(argumentType))
                                && !(parameterType.isAssignableFrom(JavaType.METHOD_HANDLE.getTypeStub()) && JavaInstance.MethodHandle.class.isAssignableFrom(argumentType))
                                && !(parameterType.equals(JavaType.METHOD_TYPE.getTypeStub()) && JavaInstance.MethodType.class.isAssignableFrom(argumentType));
                    }
                    if (finalParameterCheck) {
                        return index == parameterTypes.size() && parameterType.represents(Object[].class);
                    }
                    index++;
                }
                return true;
            }
        }

        @Override
        public boolean isDefaultValue() {
            return !isConstructor()
                    && !isStatic()
                    && getReturnType().asErasure().isAnnotationReturnType()
                    && getParameters().isEmpty();
        }

        @Override
        public boolean isDefaultValue(Object value) {
            if (!isDefaultValue()) {
                return false;
            }
            TypeDescription returnType = getReturnType().asErasure();
            return (returnType.represents(boolean.class) && value instanceof Boolean)
                    || (returnType.represents(byte.class) && value instanceof Byte)
                    || (returnType.represents(char.class) && value instanceof Character)
                    || (returnType.represents(short.class) && value instanceof Short)
                    || (returnType.represents(int.class) && value instanceof Integer)
                    || (returnType.represents(long.class) && value instanceof Long)
                    || (returnType.represents(float.class) && value instanceof Float)
                    || (returnType.represents(long.class) && value instanceof Long)
                    || (returnType.represents(String.class) && value instanceof String)
                    || (returnType.isAssignableTo(Enum.class) && value instanceof EnumerationDescription)
                    || (returnType.isAssignableTo(Annotation.class) && value instanceof AnnotationDescription)
                    || (returnType.represents(Class.class) && value instanceof TypeDescription);
        }

        @Override
        public TypeVariableSource getEnclosingSource() {
            return getDeclaringType().asErasure();
        }

        @Override
        public GenericTypeDescription findVariable(String symbol) {
            GenericTypeList typeVariables = getTypeVariables().filter(named(symbol));
            return typeVariables.isEmpty()
                    ? getEnclosingSource().findVariable(symbol)
                    : typeVariables.getOnly();
        }

        @Override
        public <T> T accept(TypeVariableSource.Visitor<T> visitor) {
            return visitor.onMethod(this);
        }

        @Override
        public Token asToken() {
            return asToken(none());
        }

        @Override
        public Token asToken(ElementMatcher<? super GenericTypeDescription> targetTypeMatcher) {
            GenericTypeDescription.Visitor<GenericTypeDescription> visitor = new GenericTypeDescription.Visitor.Substitutor.ForDetachment(targetTypeMatcher);
            return new Token(getInternalName(),
                    getModifiers(),
                    getTypeVariables().accept(visitor),
                    getReturnType().accept(visitor),
                    getParameters().asTokenList(targetTypeMatcher),
                    getExceptionTypes().accept(visitor),
                    getDeclaredAnnotations(),
                    getDefaultValue());
        }

        @Override
        public TypeToken asTypeToken() {
            return new TypeToken(getReturnType().asErasure(), getParameters().asTypeList().asErasures());
        }

        @Override
        public boolean equals(Object other) {
            return other == this || other instanceof MethodDescription
                    && getInternalName().equals(((MethodDescription) other).getInternalName())
                    && getDeclaringType().equals(((MethodDescription) other).getDeclaringType())
                    && getReturnType().asErasure().equals(((MethodDescription) other).getReturnType().asErasure())
                    && getParameters().asTypeList().asErasures().equals(((MethodDescription) other).getParameters().asTypeList().asErasures());
        }

        @Override
        public int hashCode() {
            int hashCode = getDeclaringType().hashCode();
            hashCode = 31 * hashCode + getInternalName().hashCode();
            hashCode = 31 * hashCode + getReturnType().asErasure().hashCode();
            return 31 * hashCode + getParameters().asTypeList().asErasures().hashCode();
        }

        @Override
        public String toGenericString() {
            StringBuilder stringBuilder = new StringBuilder();
            int modifiers = getModifiers() & SOURCE_MODIFIERS;
            if (modifiers != EMPTY_MASK) {
                stringBuilder.append(Modifier.toString(modifiers)).append(" ");
            }
            if (isMethod()) {
                stringBuilder.append(getReturnType().getSourceCodeName()).append(" ");
                stringBuilder.append(getDeclaringType().asErasure().getSourceCodeName()).append(".");
            }
            stringBuilder.append(getName()).append("(");
            boolean first = true;
            for (GenericTypeDescription typeDescription : getParameters().asTypeList()) {
                if (!first) {
                    stringBuilder.append(",");
                } else {
                    first = false;
                }
                stringBuilder.append(typeDescription.getSourceCodeName());
            }
            stringBuilder.append(")");
            GenericTypeList exceptionTypes = getExceptionTypes();
            if (exceptionTypes.size() > 0) {
                stringBuilder.append(" throws ");
                first = true;
                for (GenericTypeDescription typeDescription : exceptionTypes) {
                    if (!first) {
                        stringBuilder.append(",");
                    } else {
                        first = false;
                    }
                    stringBuilder.append(typeDescription.getSourceCodeName());
                }
            }
            return stringBuilder.toString();
        }

        @Override
        public String toString() {
            StringBuilder stringBuilder = new StringBuilder();
            int modifiers = getModifiers() & SOURCE_MODIFIERS;
            if (modifiers != EMPTY_MASK) {
                stringBuilder.append(Modifier.toString(modifiers)).append(" ");
            }
            if (isMethod()) {
                stringBuilder.append(getReturnType().asErasure().getSourceCodeName()).append(" ");
                stringBuilder.append(getDeclaringType().asErasure().getSourceCodeName()).append(".");
            }
            stringBuilder.append(getName()).append("(");
            boolean first = true;
            for (TypeDescription typeDescription : getParameters().asTypeList().asErasures()) {
                if (!first) {
                    stringBuilder.append(",");
                } else {
                    first = false;
                }
                stringBuilder.append(typeDescription.getSourceCodeName());
            }
            stringBuilder.append(")");
            TypeList exceptionTypes = getExceptionTypes().asErasures();
            if (exceptionTypes.size() > 0) {
                stringBuilder.append(" throws ");
                first = true;
                for (TypeDescription typeDescription : exceptionTypes) {
                    if (!first) {
                        stringBuilder.append(",");
                    } else {
                        first = false;
                    }
                    stringBuilder.append(typeDescription.getSourceCodeName());
                }
            }
            return stringBuilder.toString();
        }
    }

    /**
     * An implementation of a method description for a loaded constructor.
     */
    class ForLoadedConstructor extends InDefinedShape.AbstractBase {

        /**
         * The loaded constructor that is represented by this instance.
         */
        private final Constructor<?> constructor;

        /**
         * Creates a new immutable method description for a loaded constructor.
         *
         * @param constructor The loaded constructor to be represented by this method description.
         */
        public ForLoadedConstructor(Constructor<?> constructor) {
            this.constructor = constructor;
        }

        @Override
        public TypeDescription getDeclaringType() {
            return new TypeDescription.ForLoadedType(constructor.getDeclaringClass());
        }

        @Override
        public GenericTypeDescription getReturnType() {
            return TypeDescription.VOID;
        }

        @Override
        public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
            return ParameterList.ForLoadedExecutable.of(constructor);
        }

        @Override
        public GenericTypeList getExceptionTypes() {
            return new GenericTypeList.LazyProjection.OfConstructorExceptionTypes(constructor);
        }

        @Override
        public boolean isConstructor() {
            return true;
        }

        @Override
        public boolean isTypeInitializer() {
            return false;
        }

        @Override
        public boolean represents(Method method) {
            return false;
        }

        @Override
        public boolean represents(Constructor<?> constructor) {
            return this.constructor.equals(constructor) || equals(new ForLoadedConstructor(constructor));
        }

        @Override
        public String getName() {
            return constructor.getName();
        }

        @Override
        public int getModifiers() {
            return constructor.getModifiers();
        }

        @Override
        public boolean isSynthetic() {
            return constructor.isSynthetic();
        }

        @Override
        public String getInternalName() {
            return CONSTRUCTOR_INTERNAL_NAME;
        }

        @Override
        public String getDescriptor() {
            return Type.getConstructorDescriptor(constructor);
        }

        @Override
        public Object getDefaultValue() {
            return NO_DEFAULT_VALUE;
        }

        @Override
        public AnnotationList getDeclaredAnnotations() {
            return new AnnotationList.ForLoadedAnnotation(constructor.getDeclaredAnnotations());
        }

        @Override
        public GenericTypeList getTypeVariables() {
            return new GenericTypeList.ForLoadedType(constructor.getTypeParameters());
        }
    }

    /**
     * An implementation of a method description for a loaded method.
     */
    class ForLoadedMethod extends InDefinedShape.AbstractBase {

        /**
         * The loaded method that is represented by this instance.
         */
        private final Method method;

        /**
         * Creates a new immutable method description for a loaded method.
         *
         * @param method The loaded method to be represented by this method description.
         */
        public ForLoadedMethod(Method method) {
            this.method = method;
        }

        @Override
        public TypeDescription getDeclaringType() {
            return new TypeDescription.ForLoadedType(method.getDeclaringClass());
        }

        @Override
        public GenericTypeDescription getReturnType() {
            return new GenericTypeDescription.LazyProjection.OfLoadedReturnType(method);
        }

        @Override
        public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
            return ParameterList.ForLoadedExecutable.of(method);
        }

        @Override
        public GenericTypeList getExceptionTypes() {
            return new GenericTypeList.LazyProjection.OfMethodExceptionTypes(method);
        }

        @Override
        public boolean isConstructor() {
            return false;
        }

        @Override
        public boolean isTypeInitializer() {
            return false;
        }

        @Override
        public boolean isBridge() {
            return method.isBridge();
        }

        @Override
        public boolean represents(Method method) {
            return this.method.equals(method) || equals(new ForLoadedMethod(method));
        }

        @Override
        public boolean represents(Constructor<?> constructor) {
            return false;
        }

        @Override
        public String getName() {
            return method.getName();
        }

        @Override
        public int getModifiers() {
            return method.getModifiers();
        }

        @Override
        public boolean isSynthetic() {
            return method.isSynthetic();
        }

        @Override
        public String getInternalName() {
            return method.getName();
        }

        @Override
        public String getDescriptor() {
            return Type.getMethodDescriptor(method);
        }

        /**
         * Returns the loaded method that is represented by this method description.
         *
         * @return The loaded method that is represented by this method description.
         */
        public Method getLoadedMethod() {
            return method;
        }

        @Override
        public AnnotationList getDeclaredAnnotations() {
            return new AnnotationList.ForLoadedAnnotation(method.getDeclaredAnnotations());
        }

        @Override
        public Object getDefaultValue() {
            Object value = method.getDefaultValue();
            return value == null
                    ? null
                    : AnnotationDescription.ForLoadedAnnotation.describe(value, new TypeDescription.ForLoadedType(method.getReturnType()));
        }

        @Override
        public GenericTypeList getTypeVariables() {
            return new GenericTypeList.ForLoadedType(method.getTypeParameters());
        }
    }

    /**
     * A latent method description describes a method that is not attached to a declaring
     * {@link TypeDescription}.
     */
    class Latent extends InDefinedShape.AbstractBase {

        /**
         * The type that is declaring this method.
         */
        private final TypeDescription declaringType;

        /**
         * The internal name of this method.
         */
        private final String internalName;

        /**
         * The modifiers of this method.
         */
        private final int modifiers;

        /**
         * The type variables of the described method.
         */
        private final List<? extends GenericTypeDescription> typeVariables;

        /**
         * The return type of this method.
         */
        private final GenericTypeDescription returnType;

        /**
         * The parameter tokens describing this method.
         */
        private final List<? extends ParameterDescription.Token> parameterTokens;

        /**
         * This method's exception types.
         */
        private final List<? extends GenericTypeDescription> exceptionTypes;

        /**
         * The annotations of this method.
         */
        private final List<? extends AnnotationDescription> declaredAnnotations;

        /**
         * The default value of this method or {@code null} if no default annotation value is defined.
         */
        private final Object defaultValue;

        /**
         * Creates a new latent method description. All provided types are attached to this instance before they are returned.
         *
         * @param declaringType The declaring type of the method.
         * @param token         A token representing the method's shape.
         */
        public Latent(TypeDescription declaringType, Token token) {
            this(declaringType,
                    token.getInternalName(),
                    token.getModifiers(),
                    token.getTypeVariables(),
                    token.getReturnType(),
                    token.getParameterTokens(),
                    token.getExceptionTypes(),
                    token.getAnnotations(),
                    token.getDefaultValue());
        }

        /**
         * Creates a new latent method description. All provided types are attached to this instance before they are returned.
         *
         * @param declaringType       The type that is declaring this method.
         * @param internalName        The internal name of this method.
         * @param modifiers           The modifiers of this method.
         * @param typeVariables       The type variables of the described method.
         * @param returnType          The return type of this method.
         * @param parameterTokens     The parameter tokens describing this method.
         * @param exceptionTypes      This method's exception types.
         * @param declaredAnnotations The annotations of this method.
         * @param defaultValue        The default value of this method or {@code null} if no default annotation value is defined.
         */
        public Latent(TypeDescription declaringType,
                      String internalName,
                      int modifiers,
                      List<? extends GenericTypeDescription> typeVariables,
                      GenericTypeDescription returnType,
                      List<? extends ParameterDescription.Token> parameterTokens,
                      List<? extends GenericTypeDescription> exceptionTypes,
                      List<? extends AnnotationDescription> declaredAnnotations,
                      Object defaultValue) {
            this.declaringType = declaringType;
            this.internalName = internalName;
            this.modifiers = modifiers;
            this.typeVariables = typeVariables;
            this.returnType = returnType;
            this.parameterTokens = parameterTokens;
            this.exceptionTypes = exceptionTypes;
            this.declaredAnnotations = declaredAnnotations;
            this.defaultValue = defaultValue;
        }

        @Override
        public GenericTypeList getTypeVariables() {
            return GenericTypeList.ForDetachedTypes.OfTypeVariable.attach(this, typeVariables);
        }

        @Override
        public GenericTypeDescription getReturnType() {
            return returnType.accept(GenericTypeDescription.Visitor.Substitutor.ForAttachment.of(this));
        }

        @Override
        public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
            return new ParameterList.ForTokens(this, parameterTokens);
        }

        @Override
        public GenericTypeList getExceptionTypes() {
            return GenericTypeList.ForDetachedTypes.attach(this, exceptionTypes);
        }

        @Override
        public AnnotationList getDeclaredAnnotations() {
            return new AnnotationList.Explicit(declaredAnnotations);
        }

        @Override
        public String getInternalName() {
            return internalName;
        }

        @Override
        public TypeDescription getDeclaringType() {
            return declaringType;
        }

        @Override
        public int getModifiers() {
            return modifiers;
        }

        @Override
        public Object getDefaultValue() {
            return defaultValue;
        }

        /**
         * A method description that represents the type initializer.
         */
        public static class TypeInitializer extends InDefinedShape.AbstractBase {

            /**
             * The type for which the type initializer should be represented.
             */
            private final TypeDescription typeDescription;

            /**
             * Creates a new method description representing the type initializer.
             *
             * @param typeDescription The type for which the type initializer should be represented.
             */
            public TypeInitializer(TypeDescription typeDescription) {
                this.typeDescription = typeDescription;
            }

            @Override
            public GenericTypeDescription getReturnType() {
                return TypeDescription.VOID;
            }

            @Override
            public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
                return new ParameterList.Empty();
            }

            @Override
            public GenericTypeList getExceptionTypes() {
                return new GenericTypeList.Empty();
            }

            @Override
            public Object getDefaultValue() {
                return NO_DEFAULT_VALUE;
            }

            @Override
            public GenericTypeList getTypeVariables() {
                return new GenericTypeList.Empty();
            }

            @Override
            public AnnotationList getDeclaredAnnotations() {
                return new AnnotationList.Empty();
            }

            @Override
            public TypeDescription getDeclaringType() {
                return typeDescription;
            }

            @Override
            public int getModifiers() {
                return TYPE_INITIALIZER_MODIFIER;
            }

            @Override
            public String getInternalName() {
                return MethodDescription.TYPE_INITIALIZER_INTERNAL_NAME;
            }
        }
    }

    /**
     * A method description that represents a given method but with substituted method types.
     */
    class TypeSubstituting extends AbstractBase {

        /**
         * The type that declares this type-substituted method.
         */
        private final GenericTypeDescription declaringType;

        /**
         * The represented method description.
         */
        private final MethodDescription methodDescription;

        /**
         * A visitor that is applied to the method type.
         */
        private final GenericTypeDescription.Visitor<? extends GenericTypeDescription> visitor;

        /**
         * Creates a method description with substituted method types.
         *
         * @param declaringType     The type that is declaring the substituted method.
         * @param methodDescription The represented method description.
         * @param visitor           A visitor that is applied to the method type.
         */
        public TypeSubstituting(GenericTypeDescription declaringType,
                                MethodDescription methodDescription,
                                GenericTypeDescription.Visitor<? extends GenericTypeDescription> visitor) {
            this.declaringType = declaringType;
            this.methodDescription = methodDescription;
            this.visitor = visitor;
        }

        @Override
        public GenericTypeList getTypeVariables() {
            return methodDescription.getTypeVariables().accept(new VariableRetainingDelegator());
        }

        @Override
        public GenericTypeDescription getReturnType() {
            return methodDescription.getReturnType().accept(new VariableRetainingDelegator());
        }

        @Override
        public ParameterList<?> getParameters() {
            return new ParameterList.TypeSubstituting(this, methodDescription.getParameters(), new VariableRetainingDelegator());
        }

        @Override
        public GenericTypeList getExceptionTypes() {
            return methodDescription.getExceptionTypes().accept(new VariableRetainingDelegator());
        }

        @Override
        public Object getDefaultValue() {
            return methodDescription.getDefaultValue();
        }

        @Override
        public AnnotationList getDeclaredAnnotations() {
            return methodDescription.getDeclaredAnnotations();
        }

        @Override
        public GenericTypeDescription getDeclaringType() {
            return declaringType;
        }

        @Override
        public int getModifiers() {
            return methodDescription.getModifiers();
        }

        @Override
        public String getInternalName() {
            return methodDescription.getInternalName();
        }

        @Override
        public InDefinedShape asDefined() {
            return methodDescription.asDefined();
        }

        /**
         * A visitor that only escalates to the actual visitor if a non-generic type is discovered or if a type variable
         * that is not declared by the represented method is discovered. This way, a method's type variables are never bound
         * by the supplied visitor as non-generic types never reference a method's type variables and since a type variable
         * that is not declared by the represented method can never reference a type variable of the represented method.
         */
        protected class VariableRetainingDelegator extends GenericTypeDescription.Visitor.Substitutor {

            @Override
            public GenericTypeDescription onParameterizedType(GenericTypeDescription parameterizedType) {
                List<GenericTypeDescription> parameters = new ArrayList<GenericTypeDescription>(parameterizedType.getParameters().size());
                for (GenericTypeDescription parameter : parameterizedType.getParameters()) {
                    if (parameter.getSort().isTypeVariable() && !methodDescription.getTypeVariables().contains(parameter)) {
                        return visitor.onParameterizedType(parameterizedType);
                    } else if (parameter.getSort().isWildcard()) {
                        GenericTypeList bounds = parameter.getLowerBounds();
                        bounds = bounds.isEmpty() ? parameter.getUpperBounds() : bounds;
                        if (bounds.getOnly().getSort().isTypeVariable() && !methodDescription.getTypeVariables().contains(parameter)) {
                            return visitor.onParameterizedType(parameterizedType);
                        }
                    }
                    parameters.add(parameter.accept(this));
                }
                GenericTypeDescription ownerType = parameterizedType.getOwnerType();
                return new GenericTypeDescription.ForParameterizedType.Latent(parameterizedType.asErasure(),
                        parameters,
                        ownerType == null
                                ? null
                                : ownerType.accept(this));
            }

            @Override
            public GenericTypeDescription onNonGenericType(GenericTypeDescription typeDescription) {
                return visitor.onNonGenericType(typeDescription);
            }

            @Override
            protected GenericTypeDescription onSimpleType(GenericTypeDescription typeDescription) {
                throw new UnsupportedOperationException();
            }

            @Override
            public GenericTypeDescription onTypeVariable(GenericTypeDescription typeVariable) {
                return methodDescription.getTypeVariables().contains(typeVariable)
                        ? new RetainedVariable(typeVariable)
                        : visitor.onTypeVariable(typeVariable);
            }

            @Override
            public int hashCode() {
                return TypeSubstituting.this.hashCode();
            }

            @Override
            public boolean equals(Object other) {
                return other != null && other.getClass() == this.getClass()
                        && TypeSubstituting.this.equals(((VariableRetainingDelegator) other).getOuter());
            }

            /**
             * Returns the outer instance.
             *
             * @return The outer instance.
             */
            private Object getOuter() {
                return TypeSubstituting.this;
            }

            @Override
            public String toString() {
                return "MethodDescription.TypeSubstituting.VariableRetainingDelegator{methodDescription=" + TypeSubstituting.this + '}';
            }

            /**
             * A retained type variable that is declared by the method.
             */
            protected class RetainedVariable extends GenericTypeDescription.ForTypeVariable {

                /**
                 * The type variable this retained variable represents.
                 */
                private final GenericTypeDescription typeVariable;

                /**
                 * Creates a new retained type variable.
                 *
                 * @param typeVariable The type variable this retained variable represents.
                 */
                protected RetainedVariable(GenericTypeDescription typeVariable) {
                    this.typeVariable = typeVariable;
                }

                @Override
                public GenericTypeList getUpperBounds() {
                    return typeVariable.getUpperBounds().accept(VariableRetainingDelegator.this);
                }

                @Override
                public TypeVariableSource getVariableSource() {
                    return TypeSubstituting.this;
                }

                @Override
                public String getSymbol() {
                    return typeVariable.getSymbol();
                }
            }
        }
    }

    /**
     * A token that represents a method's shape. A method token is equal to another token when the name, the raw return type
     * and the raw parameter types are equal to those of another method token.
     */
    class Token implements ByteCodeElement.Token<Token> {

        /**
         * The internal name of the represented method.
         */
        private final String internalName;

        /**
         * The modifiers of the represented method.
         */
        private final int modifiers;

        /**
         * The type variables of the the represented method.
         */
        private final List<GenericTypeDescription> typeVariables;

        /**
         * The return type of the represented method.
         */
        private final GenericTypeDescription returnType;

        /**
         * The parameter tokens of the represented method.
         */
        private final List<? extends ParameterDescription.Token> parameterTokens;

        /**
         * The exception types of the represented method.
         */
        private final List<? extends GenericTypeDescription> exceptionTypes;

        /**
         * The annotations of the represented method.
         */
        private final List<? extends AnnotationDescription> annotations;

        /**
         * The default value of the represented method or {@code null} if no such value exists.
         */
        private final Object defaultValue;

        /**
         * Creates a new method token with simple values.
         *
         * @param internalName   The internal name of the represented method.
         * @param modifiers      The modifiers of the represented method.
         * @param returnType     The return type of the represented method.
         * @param parameterTypes The parameter types of this method.
         */
        public Token(String internalName, int modifiers, GenericTypeDescription returnType, List<? extends GenericTypeDescription> parameterTypes) {
            this(internalName,
                    modifiers,
                    Collections.<GenericTypeDescription>emptyList(),
                    returnType,
                    new ParameterDescription.Token.TypeList(parameterTypes),
                    Collections.<GenericTypeDescription>emptyList(),
                    Collections.<AnnotationDescription>emptyList(),
                    NO_DEFAULT_VALUE);
        }

        /**
         * Creates a new token for a method description.
         *
         * @param internalName    The internal name of the represented method.
         * @param modifiers       The modifiers of the represented method.
         * @param typeVariables   The type variables of the the represented method.
         * @param returnType      The return type of the represented method.
         * @param parameterTokens The parameter tokens of the represented method.
         * @param exceptionTypes  The exception types of the represented method.
         * @param annotations     The annotations of the represented method.
         * @param defaultValue    The default value of the represented method or {@code null} if no such value exists.
         */
        public Token(String internalName,
                     int modifiers,
                     List<GenericTypeDescription> typeVariables,
                     GenericTypeDescription returnType,
                     List<? extends ParameterDescription.Token> parameterTokens,
                     List<? extends GenericTypeDescription> exceptionTypes,
                     List<? extends AnnotationDescription> annotations,
                     Object defaultValue) {
            this.internalName = internalName;
            this.modifiers = modifiers;
            this.typeVariables = typeVariables;
            this.returnType = returnType;
            this.parameterTokens = parameterTokens;
            this.exceptionTypes = exceptionTypes;
            this.annotations = annotations;
            this.defaultValue = defaultValue;
        }

        /**
         * Returns the internal name of the represented method.
         *
         * @return The internal name of the represented method.
         */
        public String getInternalName() {
            return internalName;
        }

        /**
         * Returns the modifiers of the represented method.
         *
         * @return The modifiers of the represented method.
         */
        public int getModifiers() {
            return modifiers;
        }

        /**
         * Returns the type variables of the the represented method.
         *
         * @return The type variables of the the represented method.
         */
        public GenericTypeList getTypeVariables() {
            return new GenericTypeList.Explicit(typeVariables);
        }

        /**
         * Returns the return type of the represented method.
         *
         * @return The return type of the represented method.
         */
        public GenericTypeDescription getReturnType() {
            return returnType;
        }

        /**
         * Returns the parameter tokens of the represented method.
         *
         * @return The parameter tokens of the represented method.
         */
        public TokenList<ParameterDescription.Token> getParameterTokens() {
            return new TokenList<ParameterDescription.Token>(parameterTokens);
        }

        /**
         * Returns the exception types of the represented method.
         *
         * @return The exception types of the represented method.
         */
        public GenericTypeList getExceptionTypes() {
            return new GenericTypeList.Explicit(exceptionTypes);
        }

        /**
         * Returns the annotations of the represented method.
         *
         * @return The annotations of the represented method.
         */
        public AnnotationList getAnnotations() {
            return new AnnotationList.Explicit(annotations);
        }

        /**
         * Returns the default value of the represented method.
         *
         * @return The default value of the represented method or {@code null} if no such value exists.
         */
        public Object getDefaultValue() {
            return defaultValue;
        }

        /**
         * Transforms this method token into a type token.
         *
         * @return A type token representing the type's of this method token.
         */
        public TypeToken asTypeToken() {
            List<TypeDescription> parameterTypes = new ArrayList<TypeDescription>(getParameterTokens().size());
            for (ParameterDescription.Token parameterToken : getParameterTokens()) {
                parameterTypes.add(parameterToken.getType().asErasure());
            }
            return new TypeToken(getReturnType().asErasure(), parameterTypes);
        }

        @Override
        public Token accept(GenericTypeDescription.Visitor<? extends GenericTypeDescription> visitor) {
            return new Token(getInternalName(),
                    getModifiers(),
                    getTypeVariables().accept(visitor),
                    getReturnType().accept(visitor),
                    getParameterTokens().accept(visitor),
                    getExceptionTypes().accept(visitor),
                    getAnnotations(),
                    getDefaultValue());
        }

        @Override
        public boolean isIdenticalTo(Token token) {
            return getInternalName().equals(token.getInternalName())
                    && getModifiers() == token.getModifiers()
                    && getTypeVariables().equals(token.getTypeVariables())
                    && getReturnType().equals(token.getReturnType())
                    && getParameterTokens().equals(token.getParameterTokens())
                    && getExceptionTypes().equals(token.getExceptionTypes())
                    && getAnnotations().equals(token.getAnnotations())
                    && ((getDefaultValue() == null && token.getDefaultValue() == null)
                    || (getDefaultValue() != null && token.getDefaultValue() != null && (getDefaultValue().equals(token.getDefaultValue()))));
        }

        @Override
        public boolean equals(Object other) {
            if (this == other) return true;
            if (!(other instanceof Token)) return false;
            Token token = (Token) other;
            if (!getInternalName().equals(token.getInternalName())) return false;
            if (!getReturnType().asErasure().equals(token.getReturnType().asErasure())) return false;
            List<ParameterDescription.Token> tokens = getParameterTokens(), otherTokens = token.getParameterTokens();
            if (tokens.size() != otherTokens.size()) return false;
            for (int index = 0; index < tokens.size(); index++) {
                if (!tokens.get(index).getType().asErasure().equals(otherTokens.get(index).getType().asErasure())) return false;
            }
            return true;
        }

        @Override
        public int hashCode() {
            int result = getInternalName().hashCode();
            result = 31 * result + getReturnType().asErasure().hashCode();
            for (ParameterDescription.Token parameterToken : getParameterTokens()) {
                result = 31 * result + parameterToken.getType().asErasure().hashCode();
            }
            return result;
        }

        @Override
        public String toString() {
            return "MethodDescription.Token{" +
                    "internalName='" + internalName + '\'' +
                    ", modifiers=" + modifiers +
                    ", typeVariables=" + typeVariables +
                    ", returnType=" + returnType +
                    ", parameterTokens=" + parameterTokens +
                    ", exceptionTypes=" + exceptionTypes +
                    ", annotations=" + annotations +
                    ", defaultValue=" + defaultValue +
                    '}';
        }
    }

    /**
     * A token representing a method's erased return and parameter types.
     */
    class TypeToken {

        /**
         * The represented method's raw return type.
         */
        private final TypeDescription returnType;

        /**
         * The represented method's raw parameter types.
         */
        private final List<? extends TypeDescription> parameterTypes;

        /**
         * Creates a new type token.
         *
         * @param returnType     The represented method's raw return type.
         * @param parameterTypes The represented method's raw parameter types.
         */
        public TypeToken(TypeDescription returnType, List<? extends TypeDescription> parameterTypes) {
            this.returnType = returnType;
            this.parameterTypes = parameterTypes;
        }

        /**
         * Returns this token's return type.
         *
         * @return This token's return type.
         */
        public TypeDescription getReturnType() {
            return returnType;
        }

        /**
         * Returns this token's parameter types.
         *
         * @return This token's parameter types.
         */
        public List<TypeDescription> getParameterTypes() {
            return new ArrayList<TypeDescription>(parameterTypes);
        }

        @Override
        public boolean equals(Object other) {
            if (this == other) return true;
            if (other == null || getClass() != other.getClass()) return false;
            TypeToken typeToken = (TypeToken) other;
            return returnType.equals(typeToken.returnType)
                    && parameterTypes.equals(typeToken.parameterTypes);
        }

        @Override
        public int hashCode() {
            int result = returnType.hashCode();
            result = 31 * result + parameterTypes.hashCode();
            return result;
        }

        @Override
        public String toString() {
            return "MethodDescription.TypeToken{" +
                    "returnType=" + returnType +
                    ", parameterTypes=" + parameterTypes +
                    '}';
        }
    }
}


text:
using System;
using Azure.Core;
using Azure.ResourceManager.MachineLearning.Models;
using Azure.ResourceManager.Models;

namespace Azure.ResourceManager.MachineLearning
{
    /// <summary> A class representing the DataVersion data model. </summary>
    public partial class DataVersionData : ResourceData
    {
        /// <summary> Initializes a new instance of DataVersionData. </summary>
        /// <param name="properties">
        /// [Required] Additional attributes of the entity.
        /// Please note <see cref="DataVersionProperties"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
        /// The available derived classes include <see cref="MLTableData"/>, <see cref="UriFileDataVersion"/> and <see cref="UriFolderDataVersion"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"> <paramref name="properties"/> is null. </exception>
        public DataVersionData(DataVersionProperties properties)
        {
            Argument.AssertNotNull(properties, nameof(properties));

            Properties = properties;
        }

        /// <summary> Initializes a new instance of DataVersionData. </summary>
        /// <param name="id"> The id. </param>
        /// <param name="name"> The name. </param>
        /// <param name="resourceType"> The resourceType. </param>
        /// <param name="systemData"> The systemData. </param>
        /// <param name="properties">
        /// [Required] Additional attributes of the entity.
        /// Please note <see cref="DataVersionProperties"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
        /// The available derived classes include <see cref="MLTableData"/>, <see cref="UriFileDataVersion"/> and <see cref="UriFolderDataVersion"/>.
        /// </param>
        internal DataVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataVersionProperties properties) : base(id, name, resourceType, systemData)
        {
            Properties = properties;
        }

        /// <summary>
        /// [Required] Additional attributes of the entity.
        /// Please note <see cref="DataVersionProperties"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
        /// The available derived classes include <see cref="MLTableData"/>, <see cref="UriFileDataVersion"/> and <see cref="UriFolderDataVersion"/>.
        /// </summary>
        public DataVersionProperties Properties { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<phpunit bootstrap="vendor/autoload.php">
    <testsuites>
        <testsuite name="All">
            <directory prefix="">tests</directory>
        </testsuite>
    </testsuites>
</phpunit>


text:
module.exports.BrowserFeat = {
    feat: {},

    // Return object with browser capabilities; return from cache if available
    getBrowserCaps: function (feat) {
        if (Object.keys(this.feat).length === 0) {
            // Detect SVG
            this.feat.svg = document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1');

            // Detect <canvas>
            this.feat.canvas = (function() {
                var elem = document.createElement('canvas');
                return !!(elem.getContext && elem.getContext('2d'));
            })();

            // Detect toDataURL
            this.feat.todataurlpng = (function() {
                var canvas = document.createElement('canvas');
                return !!(canvas && canvas.toDataURL && canvas.toDataURL('image/png').indexOf('data:image/png') === 0);
            })();

            // Detect CSS transforms
            this.feat.csstransforms = (function() {
                var elem = document.createElement('tspan');
                return 'transform' in elem.style;
            })();

            // Detect FlexBox
            this.feat.flexbox = (function() {
                var elem = document.createElement('tspan');
                return 'flexBasis' in elem.style;
            })();

            // UA checks; should be retired as soon as possible
            this.feat.uaEdge = (function() {
                return navigator.userAgent.indexOf('Edge') > 0;
            })();

            // UA checks; should be retired as soon as possible
            this.feat.uaTrident = (function() {
                return navigator.userAgent.indexOf('Trident') > 0;
            })();
        }
        return feat ? this.feat[feat] : this.feat;
    },

    setHtmlFeatClass: function() {
        var htmlclass = [];

        this.getBrowserCaps();

        // For each set feature, add to the <html> element's class
        var keys = Object.keys(this.feat);
        var i = keys.length;
        while (i--) {
            if (this.feat[keys[i]]) {
                htmlclass.push(keys[i]);
            } else {
                htmlclass.push('no-' + keys[i]);
            }
        }

        // Now write the classes to the <html> DOM element
        document.documentElement.className = htmlclass.join(' ');
    }
};


text:
<TITLE>Review for Once Upon a Forest (1993)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Once Upon a Forest (1993)

reviewed by
James Berardinelli

                               ONCE UPON A FOREST
                       A film review by James Berardinelli
                        Copyright 1993 James Berardinelli

Rating:  5.9 out of 10 (C, ** out of ****)

Date Released:  6/18/93
Running Length:  1:11
Rated:  G

Featuring the voices of Michael Crawford, Ben Vereen, Ellen Blain, and
     Paige Gosney
Director:  Charles Grosvenor
Producers:  David Kirschner and Jerry Mills
Screenplay:  Mark Young and Kelly Ward
Music:  James Horner
Released by Twentieth Century Fox

     A small group of forest critters goes on a quest to find herbs
with which to heal their friend after the local village has been
devastated as the result of a gas spill.  This is the premise of the
lackluster and very politically correct ONCE UPON A FOREST, the latest
subpar G-rated animated feature to go after the money of parents in
search of suitable entertainment for their young offspring.

     With its recent three animated features, Disney has proven that
animation capable of entertaining adults (as well as children) is not
dead.  I enjoyed THE LITTLE MERMAID, was enthralled by BEAUTY AND THE
BEAST, and had a lot of fun watching ALADDIN.  Other than those at
Disney, however, the only person around today capable of achieving a
high standard for animated features is Don Bluth, the driving force
behind AN AMERICAN TAIL.

     But wait--don't the ads for ONCE UPON A FOREST state that this
film comes from "the creator of AN AMERICAN TAIL"?  Yes, they do, but
the man they're referring to is David Kirschner, who served as
executive producer for TAIL.  Those going to this film expecting to see
a Bluth-quality motion picture are in for a rude surprise, although
it's a mistake Twentieth Century Fox would like to see repeated over
and over again.

     The story is pathetically thin, even by the limited standards of
an average five-year-old.  Children will enjoy this movie the way they
do Saturday morning cartoons, finding it mildly entertaining but
nothing special (does that make it worth an admission price?).
Mercifully, the running time is short, so parents accompanying their
children won't be bored to death.

     For the most part, the animation isn't worth mentioning.  The
characters move, but the background doesn't, and there are only a few
scenes where any real attention was paid to establishing some sort of
mood (those include a venture into a construction site and an adventure
involving a well-depicted owl).

     Remember last year's disappointing FERN GULLY: THE LAST
RAINFOREST?  Well, ONCE UPON A FOREST shares many of that movie's
traits, right down to the "don't destroy nature" theme.  However, while
FERN GULLY could at least claim the asset of Robin Williams' vocal
talents, ONCE UPON A FOREST is stuck.  It has Ben Vereen, but his voice
is used for maybe two minutes worth of screen time.

     There's not much else that I can say about ONCE UPON A FOREST.
Lackluster productions like this aren't worth additional words.  The
movie is dull and shows an obvious lack of innovation and creativity,
but for those desperate to take their kids to a "suitable" movie, this
one will fit the bill, although it might be better to wait a few weeks
for the re-release of SNOW WHITE AND THE SEVEN DWARVES.  If you go,
however, remember this: it's the adults, not the kids, who will have
trouble sitting through the movie.

- James Berardinelli (blake7@cc.bellcore.com)

.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=1024, user-scalable=no">

	<title>Selenium For Automation and Testing</title>

	<link rel="stylesheet" href="core/deck.core.css">

	<link rel="stylesheet" href="extensions/goto/deck.goto.css">
	<link rel="stylesheet" href="extensions/menu/deck.menu.css">
	<link rel="stylesheet" href="extensions/navigation/deck.navigation.css">
	<link rel="stylesheet" href="extensions/status/deck.status.css">
	<link rel="stylesheet" href="extensions/hash/deck.hash.css">
	<link rel="stylesheet" href="extensions/scale/deck.scale.css">

	<link rel="stylesheet" href="themes/style/web-2.0.css">

	<link rel="stylesheet" href="themes/transition/horizontal-slide.css">

	<link rel="stylesheet" href="custom.css">

Selenium For Automation and Testing

Table of Contents

Title

Alice, Bob, and Carol

The Meeting

Alice, Bob, and Carol

Alice works for a small company, and her boss just asked her to get a bunch of data from AliceBane.com.  She's becoming overwhelmed at the amount of data and how many times she's going to have to click to get all the data they need.

Bob works for a slightly larger company that makes a web application that keeps breaking.  He has been assigned to figure out how to test the site and keep it reliable, and is starting to feel bored going through the same steps over and over to test each iteration of the application.

Carol is friends with both Alice and Bob, and is about to help both of them out, but she doesn't know that yet.

The Meeting

Alice, Bob, and Carol go to lunch together one day, and Alice starts talking about her problem first.  Bob pipes up, and they go back and forth for a bit about how repetitive their tasks are and how long they'll take, until Carol manages to find a break in the conversation and says, "Have you considered Selenium?"

"What's Selenium?" they both replied in unison.

"Selenium is a tool for automating manual browser tasks.  You can use it from most popular programming languages, and it provides an API that you can use to automate your repetitive tasks, getting the information you need, Alice, and checking that the parts of your application are working properly, Bob."

A Simple Example

$ python
Python 3.2.3 (default, Jun  8 2012, 05:36:09)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> driver = webdriver.Firefox()
>>> driver.get('http://www.google.com/')
>>>

These three lines of code load the Selenium WebDriver interface, start Firefox, and ask Firefox to load google.com.

A Simple Example (2)

>>> from selenium import webdriver
>>> keys = webdriver.common.keys.Keys()
>>> driver = webdriver.Firefox()
>>> driver.get('http://www.google.com/')
>>> search_field = driver.find_element_by_name('q')
>>> search_field.send_keys('koala')
>>> search_field.send_keys(keys.ENTER)
>>> driver.find_element_by_link_text('Images').click()

Supported languages/platforms include:

C++

Dotnet

Java

Javascript

Python

Ruby

Supported browsers include:

Chrome

Firefox

Internet Explorer

Opera

PhantomJS

Ways to find elements

Class name

CSS selector

ID attribute

Link text

Name attribute

Partial link text

Tag name

XPath expression

How to choose

Interactions on elements

Check whether it is displayed, enabled, or selected

Clear

Click

Find the parent element or elements within it

Get attribute, CSS property, ID, size, tag name, text

Get location with or without scrolling into view

Send keys

Submit

More complex interaction, such as click and drag, can be performed using action chains.

About timing

Not all pages take the same amount of time to load, and interactions within a page can also take different amounts of time.

When finding an element, Selenium honours an implicit wait value that is set globally for the webdriver instance.  By default, it is set to three seconds, and you can set it differently if you expect that most of your element searches will take a different amount of time.

For finer control, you can use explicit waits, allowing you to specify timing for particular lookups without changing the global implicit wait time.

The maintainability problem

Elements change names, attributes

Whole workflows change

The maintainability solution

Page maps

Page objects

Finding more information

Official site: http://seleniumhq.org/

Official documentation: http://docs.seleniumhq.org/

Mailing list: http://groups.google.com/group/selenium-users

IRC channel: #selenium on irc.freenode.org

Google Code source: http://code.google.com/p/selenium/

Github source: http://github.com/SeleniumHQ/selenium/

Getting involved

│19:04:30 llaskin1 | "and after you have realized how
│                  | awesome Selenium is, get yourself
│                  | involved with the community, hop
│                  | in the chatroom, submit patches,
│                  | fix bugs, file bugs, etc."

#selenium on irc.freenode.org

Submit issues and patches via Google Code or Github

Help answer questions on the mailing list and on IRC

Contact info

Daniel Fackrell

Quality Assurance Developer for Bluehost

unlearned@gmail.com

@intchanter on Twitter

intchanter on irc.freenode.org

Meta

These slides: http://github.com/intchanter/2013-05-selenium/

In addition to Selenium, this presentation uses Python and deck.js

←
→

	/

<form action="." method="get" class="goto-form">
	Go to slide:
	<input type="text" name="slidenum" id="goto-slide" list="goto-datalist">
	<datalist id="goto-datalist"></datalist>
	<input type="submit" value="Go">
</form>

#


text:
describe Sigh do
  describe Sigh::Manager do
    before do
      ENV["DELIVER_USER"] = "test@fastlane.tools"
      ENV["DELIVER_PASSWORD"] = "123"
    end

    let(:mock_base_client) { "fake api base client" }

    before(:each) do
      allow(mock_base_client).to receive(:login)
      allow(mock_base_client).to receive(:team_id).and_return('')

      allow(Spaceship::ConnectAPI::Provisioning::Client).to receive(:instance).and_return(mock_base_client)
    end

    it "Successful run" do
      sigh_stub_spaceship_connect(inhouse: false, create_profile_app_identifier: "com.krausefx.app", all_app_identifiers: ["com.krausefx.app"])

      options = { app_identifier: "com.krausefx.app", skip_install: true, skip_certificate_verification: true }
      Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options)

      val = Sigh::Manager.start
      expect(val).to eq(File.expand_path("./AppStore_com.krausefx.app.mobileprovision"))
      File.delete(val)
    end

    it "Invalid profile not force run" do
      sigh_stub_spaceship_connect(inhouse: false, create_profile_app_identifier: "com.krausefx.app", all_app_identifiers: ["com.krausefx.app"], app_identifier_and_profile_names: { "com.krausefx.app" => ["No dupe here"] }, valid_profiles: false)

      options = { app_identifier: "com.krausefx.app", skip_install: true, skip_certificate_verification: true }
      Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options)

      val = Sigh::Manager.start
      expect(val).to eq(File.expand_path("./AppStore_com.krausefx.app.mobileprovision"))
      File.delete(val)
    end

    it "Invalid profile force run" do
      sigh_stub_spaceship_connect(inhouse: false, create_profile_app_identifier: "com.krausefx.app", all_app_identifiers: ["com.krausefx.app"], app_identifier_and_profile_names: { "com.krausefx.app" => ["No dupe here"] }, valid_profiles: false, expect_delete: true)

      options = { app_identifier: "com.krausefx.app", skip_install: true, skip_certificate_verification: true, force: true }
      Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options)

      val = Sigh::Manager.start
      expect(val).to eq(File.expand_path("./AppStore_com.krausefx.app.mobileprovision"))
      File.delete(val)
    end

    it "Existing profile fail on name taken" do
      sigh_stub_spaceship_connect(inhouse: false, create_profile_app_identifier: nil, all_app_identifiers: ["com.krausefx.app", "com.krausefx.app.other"], app_identifier_and_profile_names: { "com.krausefx.app.other" => ["com.krausefx.app AppStore"] })

      options = { app_identifier: "com.krausefx.app", skip_install: true, fail_on_name_taken: true, skip_certificate_verification: true, force: false }
      Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options)

      expect { Sigh::Manager.start }.to raise_error("The name 'com.krausefx.app AppStore' is already taken, and fail_on_name_taken is true")
    end
  end
end


text:
import PropTypes from 'prop-types';
import React from 'react';

import styles from './less/ProfileWidget.less';

export default class extends React.Component {
    static propTypes = {
        activeUser: PropTypes.object.isRequired,
    };

    render() {
        const activeUser = this.props.activeUser;

        const userId = activeUser.get('usr_id');
        const imgSrc = `/images/users/${userId}.jpg`;

        return (

                    {activeUser.get('usr_firstname')}
                    {activeUser.get('usr_lastname')}

        );
    }
}


text:
import React from 'react';
import SelectField from 'material-ui/lib/select-field';
import MenuItem from 'material-ui/lib/menus/menu-item';

import AppConstants from '../../constants/constants';

const LocationSelector = (props) => {
    return(
    <div>
        <SelectField disabled={!props.isEnabled}
                floatingLabelText='location'
                value={props.value}
                onChange={props.handler}
        >
        {AppConstants.locations.map((item,i) =>
            <MenuItem
                value={''+i}
                key={i}
                primaryText={item}
            />)
        }
        </SelectField>
    </div>
    )
};
export default LocationSelector;


text:
package gspelling;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

/**
 * Provides a spell check using the Google Spell.
 *
 * @author Otávio Scherer Garcia
 */
public final class GSpellingChecker {

    /**
     * The service URL for querying.
     */
    private static final String SERVICE_URL = "https://www.google.com/tbproxy/spell?lang=%s";

    private static final Logger logger = Logger.getLogger(GSpellingChecker.class.getName());

    private static final String UNKNOWN_ERROR = "Google API returns an unknown error.";

    /**
     * Search into the text and find spelling errors returning the bad words.
     *
     * @param text The text to spell.
     * @param lang The language. (optional)
     * @return The list of bad words in the input text or empty list if has no spelling errors.
     * @throws GSpellingException If an error occurs.
     */
    public static List<String> checkBadWords(String text, GSpellingLanguage lang)
        throws GSpellingException {
        final List<String> out = new LinkedList<String>();

        XmlResponse response = doSpelling(text, lang);
        for (XmlResponseItem item : response.getItems()) {
            out.add(text.substring(item.getOffset(), item.getOffset() + item.getLength()));
        }

        return out;
    }

    /**
     * Returns a list of suggestions for one or more words.
     *
     * @param word The input word (can be one or more).
     * @param lang The language. (optional)
     * @return The list of suggestions for the input word(s).
     * @throws GSpellingException If an error occurs.
     */
    public static List<String> getSuggestions(String word, GSpellingLanguage lang)
        throws GSpellingException {
        final List<String> out = new LinkedList<String>();

        XmlResponse response = doSpelling(word, lang);
        for (XmlResponseItem item : response.getItems()) {
            String[] items = item.getText().split("\\t");
            out.addAll(Arrays.asList(items));
        }

        return out;
    }

    /**
     * Returns a list of {@link Word} object that contains the bad words and spell suggestions for own.
     *
     * @param text The text to spell.
     * @param lang The language. (optional)
     * @return The list of bad words and spell suggestions for own.
     * @throws GSpellingException If an error occurs.
     */
    public static List<Word> checkWords(String text, GSpellingLanguage lang)
        throws GSpellingException {
        final List<Word> out = new LinkedList<Word>();

        XmlResponse response = doSpelling(text, lang);
        for (XmlResponseItem item : response.getItems()) {
            String key = text.substring(item.getOffset(), item.getOffset() + item.getLength());
            String[] suggestions = item.getText().split("\\t");

            out.add(new Word(key, Arrays.asList(suggestions)));
        }

        return out;
    }

    /**
     * Internal method that execute the remote query.
     *
     * @param str
     * @param lang
     * @return
     * @throws GSpellingException
     */
    private static XmlResponse doSpelling(String str, GSpellingLanguage lang)
        throws GSpellingException {

        final XmlRequest request = new XmlRequest(str);
        OutputStream out = null;
        InputStream in = null;

        try {
            final URL url = new URL(String.format(SERVICE_URL, lang));
            final URLConnection conn = url.openConnection();
            conn.setDoOutput(true);

            out = conn.getOutputStream();

            JAXBContext ctx = JAXBContext.newInstance(XmlRequest.class, XmlResponse.class);

            ctx.createMarshaller().marshal(request, out);

            // get the result from GSpell
            in = conn.getInputStream();
            XmlResponse response = (XmlResponse) ctx.createUnmarshaller().unmarshal(in);

            // check if has errors
            if (response.isError()) {
                logger.log(Level.SEVERE, UNKNOWN_ERROR);
                throw new GSpellingException(UNKNOWN_ERROR);
            }

            return response;
        } catch (JAXBException e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new GSpellingException(e);

        } catch (IOException e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new GSpellingException(e);

        } finally {
            // close streams
            closeQuietly(in);
            closeQuietly(out);
        }
    }

    /**
     * Close a {@link Closeable} resource ignoring if an error occurs.
     *
     * @param closeable The {@link Closeable} object to close.
     */
    private static void closeQuietly(Closeable closeable) {
        try {
            closeable.close();
        } catch (Exception e) {
            logger.log(Level.WARNING, "An exception occurs when closing resource", e);
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tesseract: Namespace Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

tesseract
    4.00.00dev

Here is a list of all namespace members with links to the namespace documentation for each member:

- u -

UNENCODABLE
: tesseract

UnicharAmbigsVector
: tesseract

UnicharIdVector
: tesseract

UnicodeFor()
: tesseract

UnicodeNormMode
: tesseract

UniLikelyListItem()
: tesseract

Generated on Wed Mar 28 2018 19:53:48 for tesseract by

     1.8.13


text:
import json
from websocket_server import WebsocketServer # pip package, in python 3.5 you may have to do `pip install -U websocket-server`
import http_server
import networktables_client

with open("config.json", "r") as config_file:
    config = json.load(config_file)

shared_dict = {
    "robot_status": "disconnected",
    "form": {}
}

http_server.setup(config["http_port"])

# Create a WS Server, this allows push/pull between the web-browsers (interfaces)

# Called for every client connecting (after handshake)
def new_client(client, server):
    print("New client connected and was given id %d" % client['id'])
    server.send_message(client, json.dumps(shared_dict))

# Called when a client sends a message
def message_received(client, server, message):
    if message != "PING":
        print("Client(%d) said: %s" % (client['id'], message))
        shared_dict["form"] = json.loads(message)
        server.send_message_to_all(json.dumps(shared_dict))

        for key, value in shared_dict["form"].items():
            networktable.putValue(key, value)

ws_server = WebsocketServer(config['ws_port'])
ws_server.set_fn_new_client(new_client)
ws_server.set_fn_message_received(message_received)

class ConnectionListener:
    def __init__(self):
        self._first_disconnect = True # we want to ignore the first disconnect event as it's always disconnected at init

    def connected(self, table):
        print("NetworksTables connected to", table)
        shared_dict["robot_status"] = "connected"
        ws_server.send_message_to_all(json.dumps(shared_dict))

        # we may have form data to send to the table while we were disconnected, so update it
        for key, value in shared_dict["form"].items():
            table.putValue(key, value)

    def disconnected(self, table):
        if self._first_disconnect:
            self._first_disconnect = False
            return

        print("NetworkTabes disconnected from", table)
        shared_dict["robot_status"] = "disconnected"
        ws_server.send_message_to_all(json.dumps(shared_dict))

networktable = networktables_client.setup(config["robot_ip"], config["networktable"], ConnectionListener)

ws_server.run_forever() # we could throw this off to a seperate thread too, but then the main thread would have nothing to do

print("Exiting")


text:
package ua.com.fielden.platform.web.action.post;

import static java.lang.String.format;

import ua.com.fielden.platform.web.centre.api.actions.IEntityActionBuilder2;
import ua.com.fielden.platform.web.minijs.JsCode;
import ua.com.fielden.platform.web.view.master.api.actions.post.IPostAction;

/**
 * In case if functional entity saves its master entity, it is necessary to bind saved instance to its respective entity master.
 * Use this {@link IPostAction} in {@link IEntityActionBuilder2#postActionSuccess(IPostAction)} call.
 *
 * @author TG Team
 *
 */
public class BindSavedPropertyPostActionSuccess implements IPostAction {
    private final String propertyName;

    /**
     * Creates {@link BindSavedPropertyPostActionSuccess} with {@code propertyName} indicating where master entity resides.
     *
     * @param propertyName
     */
    public BindSavedPropertyPostActionSuccess(final String propertyName) {
        this.propertyName = propertyName;
    }

    @Override
    public JsCode build() {
        return createPostAction(false, propertyName);
    }

    /**
     * Creates {@link IPostAction}. For {@code erroneous} one we also attaches 'exceptionOccured' to the master entity.
     *
     * @param erroneous
     * @return
     */
    static JsCode createPostAction(final boolean erroneous, final String propertyName) {
        return new JsCode(format(""
            + "const parentMasterName = `tg-${functionalEntity.type().prop('%s').type()._simpleClassName()}-master`;\n"
            + "const parentMaster = getParentAnd(self, parent => parent.matches(parentMasterName));\n"
            + "const masterEntity = functionalEntity.get('%s');\n"
            + (erroneous ? "parentMaster._provideExceptionOccured(masterEntity, functionalEntity.exceptionOccured());\n" : "")
            + "parentMaster._postSavedDefault(masterEntity);\n",
            propertyName, propertyName
        ));
    }

}


text:
/*===== CSS theme file for CalendarXP 9.0 (Totally configurable) =====*/
/* NOTE: Better use numbered color values instead of literal ones, because opera has problem with the latter in certain cases. */

/* Calendar Day Header - the cells showing "Sunday", "Monday" .... */
.CalHead {cursor:default; text-align:center;}
/* Day of Week - the Anchor inside CalHead showing the day of week */
.DoWAnchor {text-decoration:none; font:bold 7.5pt Tahoma, Verdana, sans-serif; color:white;}
/* Day Column Cell - the TD cell of each day */
.CalCol {}
/* Day Cell - the DIV cell inside TD */
.CalCell {cursor:pointer; text-align:center;}
/* Day Number - the Anchor inside DIV showing the day number  */
.CellAnchor {text-decoration:none; font:9pt verdana;}

/* WeekNo Header - the top header cell of the week number column */
.WeekHead {cursor:default; text-align:center; font:bold 10pt arial; color:white;}
/* WeekNo Column Cell - the cells of the week number column */
.WeekCol {cursor:default; text-align:center; background:#b0c4de;}
/* WeekNo Anchor style */
.WeekAnchor {text-decoration:none; font:bold 8pt arial; color:white;}

/* Month navigators - the "<" or ">" used to move to previous or next month */
.MonthNav {vertical-align:middle; height:22px; width:18px; font:bold 10pt arial bold; color:black;}
A.MonthNav:hover {color:yellow}
A.MonthNav:active {color:red}

/* styles for the 3 calendar sections (actually 3 table TDs) */
.CalTop {text-align:center;}
.CalMiddle {}
.CalBottom {text-align:center;}

/* Calendar title - showing year and month. when giDCStyle=0, it's the style of the year/month dropdowns; giDCStyle>0, it's the style to show gsCalTitle.  */
.CalTitle {vertical-align:middle; font:10pt arial; color:black;}

/* The style of internal floating div/layer tags, which are usually used to create the artificial dropdown selectors. */
.FreeDiv {}

/* The style of the outer TABLE tag which is the outer calendar panel. */
#outerTable {border:2px ridge #ffffff;}
/* The style of the inner DIV tag that holds the inner panel of all calendar cells. */
#innerDiv {border:1px solid #dcdcdc;}
/*===== Above CSS styles are commonly used in the script engine =====*/

/*====== Following are additional per-theme styles, e.g. the inner dropdown selectors and today etc. You may have your own defined. ======*/
.BottomAnchor {text-decoration:none; font:bold 9pt Tahoma, Verdana; color:white;}
A.BottomAnchor:hover {color:yellow;}
A.BottomAnchor:active {color:red;}