Package org.apache.isis.core.metamodel.exceptions

Examples of org.apache.isis.core.metamodel.exceptions.MetaModelException


    private static void invokeInjectorField(final Field field, final Object target, final Object parameter) {
        try {
            field.set(target, parameter);
        } catch (IllegalArgumentException e) {
            throw new MetaModelException(e);
        } catch (IllegalAccessException e) {
            throw new MetaModelException(String.format("Cannot access the %s field in %s", field.getName(), target.getClass().getName()));
        }
    }
View Full Code Here


        if (!indicatesOptional(optionalMethod)) {
            return;
        }
        if (returnType.isPrimitive()) {
            throw new MetaModelException(cls.getName() + "#" + capitalizedName + " cannot be an optional property as it is of a primitive type");
        }
        final FacetHolder property = processMethodContext.getFacetHolder();
        FacetUtil.addFacet(new MandatoryFacetOnPropertyStaticMethod(property));
    }
View Full Code Here

                optionalMethodReturnValue = (Boolean) MethodExtensions.invoke(method, new Object[0]);
            } catch (final ClassCastException ex) {
                // ignore
            }
            if (optionalMethodReturnValue == null) {
                throw new MetaModelException("method " + method + " should return a boolean");
            }
            return optionalMethodReturnValue.booleanValue();
        }
        return false;
    }
View Full Code Here

    private static void invokeMethod(final Method method, final Object target, final Object[] parameters) {
        try {
            method.invoke(target, parameters);
        } catch (final SecurityException e) {
            throw new MetaModelException(String.format("Cannot access the %s method in %s", method.getName(), target.getClass().getName()));
        } catch (final IllegalArgumentException e1) {
            throw new MetaModelException(e1);
        } catch (final IllegalAccessException e1) {
            throw new MetaModelException(String.format("Cannot access the %s method in %s", method.getName(), target.getClass().getName()));
        } catch (final InvocationTargetException e) {
            final Throwable targetException = e.getTargetException();
            if (targetException instanceof RuntimeException) {
                throw (RuntimeException) targetException;
            } else {
                throw new MetaModelException(targetException);
            }
        }
    }
View Full Code Here

    private static void invokeInjectorField(final Field field, final Object target, final Object parameter) {
        try {
            field.set(target, parameter);
        } catch (IllegalArgumentException e) {
            throw new MetaModelException(e);
        } catch (IllegalAccessException e) {
            throw new MetaModelException(String.format("Cannot access the %s field in %s", field.getName(), target.getClass().getName()));
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("injected " + parameter + " into " + new ToString(target));
        }
    }
View Full Code Here

            processMethodContext.removeMethod(defaultMethod);

            final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
            if (facetedMethod.containsDoOpFacet(ActionDefaultsFacet.class)) {
                final Class<?> cls2 = processMethodContext.getCls();
                throw new MetaModelException(cls2 + " uses both old and new default syntax for " + actionMethod.getName() + "(...) - must use one or other");
            }

            // add facets directly to parameters, not to actions
            final FacetedMethodParameter paramAsHolder = parameters.get(i);
            FacetUtil.addFacet(new ActionParameterDefaultsFacetViaMethod(defaultMethod, paramAsHolder, getAdapterManager()));
View Full Code Here

            alwaysHideMethodReturnValue = (Boolean) MethodExtensions.invokeStatic(alwaysHideMethod);
        } catch (final ClassCastException ex) {
            // ignore
        }
        if (alwaysHideMethodReturnValue == null) {
            throw new MetaModelException("method " + alwaysHideMethod + "must return a boolean");
        }
        return alwaysHideMethodReturnValue;
    }
View Full Code Here

            description = (String) MethodExtensions.invokeStatic(descriptionMethod);
        } catch (final ClassCastException ex) {
            // ignore
        }
        if (description == null) {
            throw new MetaModelException("method " + descriptionMethod + "must return a string");
        }
        return description;
    }
View Full Code Here

            protectMethodReturnValue = (Boolean) MethodExtensions.invokeStatic(protectMethod);
        } catch (final ClassCastException ex) {
            // ignore
        }
        if (protectMethodReturnValue == null) {
            throw new MetaModelException("method " + protectMethod + "must return a boolean");
        }
        return protectMethodReturnValue;
    }
View Full Code Here

            name = (String) MethodExtensions.invokeStatic(nameMethod);
        } catch (final ClassCastException e) {
            // ignore
        }
        if (name == null) {
            throw new MetaModelException("method " + nameMethod + "must return a string");
        }
        return name;
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.exceptions.MetaModelException

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.