Examples of ExecutableElement


Examples of javax.lang.model.element.ExecutableElement

   *
   * @return A possibly non-empty set of constraint check errors, never null.
   */
  private Set<ConstraintCheckError> checkMessageAttribute(TypeElement element) {

    ExecutableElement messageMethod = getMethod( element, "message" );

    if ( messageMethod == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( element, null, "CONSTRAINT_TYPE_MUST_DECLARE_MESSAGE_MEMBER" )
      );
    }

    if ( !typeUtils.isSameType(
        annotationApiHelper.getMirrorForType( String.class ), messageMethod.getReturnType()
    ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( messageMethod, null, "RETURN_TYPE_MUST_BE_STRING" )
      );
    }
View Full Code Here

Examples of javax.lang.model.element.ExecutableElement

   *
   * @return A possibly non-empty set of constraint check errors, never null.
   */
  private Set<ConstraintCheckError> checkGroupsAttribute(TypeElement element) {

    ExecutableElement groupsMethod = getMethod( element, "groups" );

    if ( groupsMethod == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( element, null, "CONSTRAINT_TYPE_MUST_DECLARE_GROUPS_MEMBER" )
      );
    }

    DeclaredType type = getComponentTypeOfArrayReturnType( groupsMethod );

    if ( type == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsUnboundWildcard = validateWildcardBounds( type.getTypeArguments().get( 0 ), null, null );

    if ( !( typeHasNameClass && typeHasExactlyOneTypeArgument && typeArgumentIsUnboundWildcard ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    if ( !isEmptyArray( groupsMethod.getDefaultValue() ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "DEFAULT_VALUE_MUST_BE_EMPTY_ARRAY" )
      );
    }

View Full Code Here

Examples of javax.lang.model.element.ExecutableElement

   *
   * @return A possibly non-empty set of constraint check errors, never null.
   */
  private Set<ConstraintCheckError> checkPayloadAttribute(TypeElement element) {

    ExecutableElement payloadMethod = getMethod( element, "payload" );

    if ( payloadMethod == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( element, null, "CONSTRAINT_TYPE_MUST_DECLARE_PAYLOAD_MEMBER" )
      );
    }

    DeclaredType type = getComponentTypeOfArrayReturnType( payloadMethod );

    if ( type == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsWildcardWithPayloadExtendsBound = validateWildcardBounds(
        type.getTypeArguments().get( 0 ), annotationApiHelper.getMirrorForType( Payload.class ), null
    );

    if ( !( typeHasNameClass && typeHasExactlyOneTypeArgument && typeArgumentIsWildcardWithPayloadExtendsBound ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    if ( !isEmptyArray( payloadMethod.getDefaultValue() ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_DEFAULT_VALUE_MUST_BE_EMPTY_ARRAY" )
      );
    }

View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

      }
      else {
        alreadyProcessedMethods.add( method );
      }

      ExecutableElement methodExecutableElement = ExecutableElement.forMethod( method );

      // ignore annotations
      boolean ignoreConstructorAnnotations = methodType.getIgnoreAnnotations() == null ? false : methodType
          .getIgnoreAnnotations();
      if ( ignoreConstructorAnnotations ) {
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

      }
      else {
        alreadyProcessedConstructors.add( constructor );
      }

      ExecutableElement constructorExecutableElement = ExecutableElement.forConstructor( constructor );

      // ignore annotations
      boolean ignoreConstructorAnnotations = constructorType.getIgnoreAnnotations() == null ? false : constructorType
          .getIgnoreAnnotations();
      if ( ignoreConstructorAnnotations ) {
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

    public boolean accepts(ConstrainedElement constrainedElement) {
      if ( kind != constrainedElement.getKind() ) {
        return false;
      }

      ExecutableElement executableElement = ( (ConstrainedExecutable) constrainedElement ).getLocation()
          .getExecutableElement();

      //are the locations equal (created by different builders) or
      //does one of the executables override the other one?
      return
          location.getExecutableElement().equals( executableElement ) ||
              location.getExecutableElement().overrides( executableElement ) ||
              executableElement.overrides(
                  location.getExecutableElement()
              );
    }
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

      crossParameterConstraints.addAll( constrainedExecutable.getCrossParameterConstraints() );
    }

    @Override
    public ExecutableMetaData build() {
      ExecutableElement executableElement = location.getExecutableElement();

      ConstraintDeclarationException constraintDeclarationException = checkParameterConstraints();
      if ( constraintDeclarationException == null ) {
        constraintDeclarationException = checkReturnValueConfiguration();
      }

      return new ExecutableMetaData(
          executableElement.getSimpleName(),
          executableElement.getReturnType(),
          executableElement.getParameterTypes(),
          kind == ConstrainedElement.ConstrainedElementKind.CONSTRUCTOR ? ElementKind.CONSTRUCTOR : ElementKind.METHOD,
          adaptOriginsAndImplicitGroups( getConstraints() ),
          findParameterMetaData(),
          adaptOriginsAndImplicitGroups( crossParameterConstraints ),
          constraintDeclarationException,
          getGroupConversions(),
          isCascading(),
          isConstrained,
          executableElement.isGetterMethod()
      );
    }
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

  }

  private <T> int validateParametersForGroup(ValidationContext<T> validationContext, T object, Object[] parameterValues, Group group) {
    int numberOfViolationsBefore = validationContext.getFailingConstraints().size();

    ExecutableElement executable = validationContext.getExecutable();

    BeanMetaData<T> beanMetaData = beanMetaDataManager.getBeanMetaData( validationContext.getRootBeanClass() );
    ExecutableMetaData executableMetaData = beanMetaData.getMetaDataFor( executable );

    // TODO GM: define behavior with respect to redefined default sequences. Should only the
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

    public boolean accepts(ConstrainedElement constrainedElement) {
      if ( kind != constrainedElement.getKind() ) {
        return false;
      }

      ExecutableElement executableElement = ( (ConstrainedExecutable) constrainedElement ).getLocation()
          .getExecutableElement();

      //does one of the executables override the other one?
      return location.getExecutableElement()
          .overrides( executableElement ) || executableElement.overrides(
          location.getExecutableElement()
      );
    }
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.raw.ExecutableElement

    }

    @Override
    public ExecutableMetaData build() {

      ExecutableElement executableElement = location.getExecutableElement();

      return new ExecutableMetaData(
          executableElement.getSimpleName(),
          executableElement.getReturnType(),
          executableElement.getParameterTypes(),
          kind == ConstrainedElementKind.CONSTRUCTOR ? ConstraintMetaDataKind.CONSTRUCTOR : ConstraintMetaDataKind.METHOD,
          adaptOriginsAndImplicitGroups( getConstraints() ),
          findParameterMetaData(),
          adaptOriginsAndImplicitGroups( crossParameterConstraints ),
          checkParameterConstraints(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.