Package org.apache.isis.core.metamodel.facets.object.parseable

Examples of org.apache.isis.core.metamodel.facets.object.parseable.InvalidEntryException


        if (entry == null) {
            throw new IllegalArgumentException();
        }
        if (entry.trim().equals("")) {
            if (mustHaveEntry()) {
                throw new InvalidEntryException("An entry is required");
            } else {
                return null;
            }
        }
        return doParse(context, entry);
View Full Code Here


    @Override
    public void parseTextEntry(final String entryText) {
        object = parse(entryText);
        final String reason = parameter.isValid(object, AdapterUtils.unwrap(object));
        if (reason != null) {
            throw new InvalidEntryException(reason);
        } else if (!parameter.isOptional() && object == null) {
            throw new InvalidEntryException("Mandatory parameter cannot be empty");
        }
        invocation.setParameter(index, object);
    }
View Full Code Here

        final ObjectSpecification parameterSpecification = parameter.getSpecification();
        final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
        try {
            return p.parseTextEntry(object, entryText);
        } catch (final IllegalArgumentException ex) {
            throw new InvalidEntryException(ex.getMessage(), ex);
        }
    }
View Full Code Here

    private ObjectAdapter validateAndParse(final String entryText) {
        final ObjectAdapter newValue = parse(entryText);
        final OneToOneAssociation objectAssociation = (OneToOneAssociation) field.getObjectAssociation();
        final Consent valid = objectAssociation.isAssociationValid(parent, newValue);
        if (valid.isVetoed()) {
            throw new InvalidEntryException(valid.getReason());
        }
        return newValue;
    }
View Full Code Here

        final ObjectSpecification fieldSpecification = field.getSpecification();
        final ParseableFacet p = fieldSpecification.getFacet(ParseableFacet.class);
        try {
            return p.parseTextEntry(object, entryText);
        } catch (final IllegalArgumentException ex) {
            throw new InvalidEntryException(ex.getMessage(), ex);
        }
    }
View Full Code Here

    @Override
    public void parseTextEntry(final String entryText) {
        object = validateAndParse(entryText);
        final Consent valid = ((OneToOneAssociation) getField()).isAssociationValid(getParent(), object);
        if (valid.isVetoed()) {
            throw new InvalidEntryException(valid.getReason());
        }
        if (getValueAssociation().isMandatory() && object == null) {
            throw new InvalidEntryException("Mandatory field cannot be empty");
        }
    }
View Full Code Here

        return formats;
    }

    @Override
    protected TimeStamp now() {
        throw new InvalidEntryException("Can't change a timestamp.");
    }
View Full Code Here

        return formats;
    }

    @Override
    protected Timestamp now() {
        throw new InvalidEntryException("Can't change a timestamp.");
    }
View Full Code Here

    // //////////////////////////////////////////////////////////////////

    @Override
    public Character doParse(final Object context, final String entry) {
        if (entry.length() > 1) {
            throw new InvalidEntryException("Only a single character is required");
        } else {
            return Character.valueOf(entry.charAt(0));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.object.parseable.InvalidEntryException

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.