Package org.apache.tapestry5.internal.plastic.asm.xml

Examples of org.apache.tapestry5.internal.plastic.asm.xml.ASMContentHandler$Opcode


        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, 5, formatter, inputValue);

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here


        train_getContainerMessages(resources, containerMessages);

        train_contains(containerMessages, "myform-fred-minlength", false);
        train_contains(containerMessages, "fred-minlength", false);

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void simple_macro_expansion() throws Exception
    {

        ValidatorMacro macro = mockValidatorMacro();
        expect(macro.valueForMacro("combo")).andReturn("required,minlength=5");
        expect(macro.valueForMacro("required")).andReturn(null);
        expect(macro.valueForMacro("minlength")).andReturn(null);

        replay();

        FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void macros_can_not_have_constraints() throws Exception
    {

        ValidatorMacro macro = mockValidatorMacro();
        expect(macro.valueForMacro("combo")).andReturn("required,minlength=5");

        replay();

        FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro);
View Full Code Here

    @Test
    public void recursive_macros_are_caught()
    {

        ValidatorMacro macro = mockValidatorMacro();
        expect(macro.valueForMacro("combo")).andReturn("required,combo");
        expect(macro.valueForMacro("required")).andReturn(null);
        expect(macro.valueForMacro("combo")).andReturn("required,combo");

        replay();

        FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro);
View Full Code Here

        train_isRequired(minLength, false);
        train_getValueType(minLength, String.class);
        minLength.validate(field, fifteen, minLengthFormatter, inputValue);

        ValidatorMacro macro = mockValidatorMacro();
        train_alwaysNull(macro);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, macro);
View Full Code Here

        List<Task> switchPayloadTasks = Lists.newArrayList();
        index = 0;
        for (final Instruction instruction: methodImplementation.getInstructions()) {
            final MethodLocation location = instructionList.get(index);
            final Opcode opcode = instruction.getOpcode();
            if (opcode == Opcode.PACKED_SWITCH_PAYLOAD || opcode == Opcode.SPARSE_SWITCH_PAYLOAD) {
                switchPayloadTasks.add(new Task() {
                    @Override public void perform() {
                        convertAndSetInstruction(location, codeAddressToIndex, instruction);
                    }
View Full Code Here

            opcode == Opcode.THROW_VERIFICATION_ERROR;
    }

    @Override
    public boolean writeTo(IndentingWriter writer) throws IOException {
        Opcode opcode = instruction.getOpcode();
        String verificationErrorName = null;
        String referenceString = null;

        boolean commentOutInstruction = false;

        if (instruction instanceof Instruction20bc) {
            int verificationError = ((Instruction20bc)instruction).getVerificationError();
            verificationErrorName = VerificationError.getVerificationErrorName(verificationError);
            if (verificationErrorName == null) {
                writer.write("#was invalid verification error type: ");
                writer.printSignedIntAsDec(verificationError);
                writer.write("\n");
                verificationErrorName = "generic-error";
            }
        }

        if (instruction instanceof ReferenceInstruction) {
            ReferenceInstruction referenceInstruction = (ReferenceInstruction)instruction;
            try {
                Reference reference = referenceInstruction.getReference();

                String classContext = null;
                if (methodDef.classDef.options.useImplicitReferences) {
                    classContext = methodDef.method.getDefiningClass();
                }

                referenceString = ReferenceUtil.getReferenceString(reference, classContext);
                assert referenceString != null;
            } catch (InvalidItemIndex ex) {
                writer.write("#");
                writer.write(ex.getMessage());
                writer.write("\n");
                commentOutInstruction = true;

                referenceString = String.format("%s@%d",
                    ReferenceType.toString(referenceInstruction.getReferenceType()),
                    ex.getInvalidIndex());
            } catch (ReferenceType.InvalidReferenceTypeException ex) {
                writer.write("#invalid reference type: ");
                writer.printSignedIntAsDec(ex.getReferenceType());
                commentOutInstruction = true;

                referenceString = "invalid_reference";
            }
        }

        if (instruction instanceof Instruction31t) {
            Opcode payloadOpcode;
            switch (instruction.getOpcode()) {
                case PACKED_SWITCH:
                    payloadOpcode = Opcode.PACKED_SWITCH_PAYLOAD;
                    break;
                case SPARSE_SWITCH:
View Full Code Here

    public LabelMethodItem getLabel() {
        return label;
    }

    private String getLabelPrefix() {
        Opcode opcode = instruction.getOpcode();
        switch (opcode.format) {
            case Format10t:
            case Format20t:
            case Format30t:
                return "goto_";
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.internal.plastic.asm.xml.ASMContentHandler$Opcode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.