Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.helix.model.builder;
  
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
  * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

Specify a ConstraintItem based on a message (commonly used for transition constraints)
 
 public class MessageConstraintItemBuilder {
   private ConstraintItemBuilder _builder;

  
Instantiate the builder
 
      = new ConstraintItemBuilder();
   }

  
Set the message type of the constraint

Parameters:
messageType message type
Returns:
MessageConstraintItemBuilder
 
         messageType.toString());
     return this;
   }

  
Set a participant as part of the constraint scope

Parameters:
participantId the participant to constrain
Returns:
MessageConstraintItemBuilder
 
   public MessageConstraintItemBuilder participant(ParticipantId participantId) {
         participantId.stringify());
     return this;
   }

  
Set a resource as part of the constraint scope

Parameters:
resourceId the resource to constrain
Returns:
MessageConstraintItemBuilder
 
   public MessageConstraintItemBuilder resource(ResourceId resourceId) {
     
     return this;
   }

  
Set the transition to constrain for transition message types

Parameters:
transition the transition to constrain
Returns:
MessageConstraintItemBuilder
 
     // if this is a transition constraint, the message type must be STATE_TRANSITION
         transition.toString());
     return this;
   }

  
Set the value of the constraint

Parameters:
value constraint value
Returns:
MessageConstraintItemBuilder
 
     return this;
   }

  
Get the ConstraintItem instance that is built

Returns:
ConstraintItem
  public ConstraintItem build() {
    return .build();
  }
New to GrepCode? Check out our FAQ X