@Override public String toString() { return MoreObjects.toStringHelper(this) .add("actions", getActions()) .toString(); }
/** * Sets a copy of actions for this entry. * * @param actions the actions to be copied from * @return the builder */ public Builder setActions(AclActions actions) { for (AclAction action : actions.getActions()) { mActions.add(action); } return this; }
/** * @param actions the {@link AclActions} * @return the protobuf representation of {@link AclActions} */ public static Acl.AclActions toProto(AclActions actions) { Acl.AclActions.Builder builder = Acl.AclActions.newBuilder(); for (AclAction action : actions.getActions()) { Acl.AclAction pAction = toProto(action); builder.addActions(pAction); } return builder.build(); }
/** * Tests constructor contract. */ @Test public void constructor() { AclActions actions = new AclActions(); Assert.assertTrue(actions.getActions().isEmpty()); AclActions copiedActions = new AclActions(actions); copiedActions.add(AclAction.READ); Assert.assertEquals(1, copiedActions.getActions().size()); Assert.assertEquals(0, actions.getActions().size()); }
/** * @param aclEntry the acl entry to convert * @return the proto representation of AclEntry instance */ public static PAclEntry toProto(AclEntry aclEntry) { PAclEntry.Builder pAclEntry = PAclEntry.newBuilder(); pAclEntry.setType(toProto(aclEntry.getType())); pAclEntry.setSubject(aclEntry.getSubject()); pAclEntry.setIsDefault(aclEntry.isDefault()); for (AclAction action : aclEntry.getActions().getActions()) { pAclEntry.addActions(toProto(action)); } return pAclEntry.build(); }
/** * @param aclEntry the acl entry * @return the proto representation of instance */ public static Acl.AclEntry toProto(AclEntry aclEntry) { Acl.AclEntry.Builder builder = Acl.AclEntry.newBuilder(); builder.setType(toProto(aclEntry.getType())); builder.setSubject(aclEntry.getSubject()); builder.setIsDefault(aclEntry.isDefault()); for (AclAction action : aclEntry.getActions().getActions()) { builder.addActions(toProto(action)); } return builder.build(); }