text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/spanner/admin/database/v1/spanner_database_admin.proto

package com.google.spanner.admin.database.v1;

public final class SpannerDatabaseAdminProto {
  private SpannerDatabaseAdminProto() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_Database_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_Database_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_ListDatabasesRequest_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_ListDatabasesRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_ListDatabasesResponse_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_ListDatabasesResponse_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_CreateDatabaseRequest_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_CreateDatabaseRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_CreateDatabaseMetadata_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_CreateDatabaseMetadata_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_GetDatabaseRequest_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_GetDatabaseRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlRequest_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlMetadata_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlMetadata_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_DropDatabaseRequest_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_DropDatabaseRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_GetDatabaseDdlRequest_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_GetDatabaseDdlRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_spanner_admin_database_v1_GetDatabaseDdlResponse_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_spanner_admin_database_v1_GetDatabaseDdlResponse_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static  com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n=google/spanner/admin/database/v1/spann" +
      "er_database_admin.proto\022 google.spanner." +
      "admin.database.v1\032\034google/api/annotation" +
      "s.proto\032\025google/api/auth.proto\032\036google/i" +
      "am/v1/iam_policy.proto\032\032google/iam/v1/po" +
      "licy.proto\032#google/longrunning/operation" +
      "s.proto\032\033google/protobuf/empty.proto\032\037go" +
      "ogle/protobuf/timestamp.proto\"\222\001\n\010Databa" +
      "se\022\014\n\004name\030\001 \001(\t\022?\n\005state\030\002 \001(\01620.google" +
      ".spanner.admin.database.v1.Database.Stat",
      "e\"7\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010CRE" +
      "ATING\020\001\022\t\n\005READY\020\002\"M\n\024ListDatabasesReque" +
      "st\022\016\n\006parent\030\001 \001(\t\022\021\n\tpage_size\030\003 \001(\005\022\022\n" +
      "\npage_token\030\004 \001(\t\"o\n\025ListDatabasesRespon" +
      "se\022=\n\tdatabases\030\001 \003(\0132*.google.spanner.a" +
      "dmin.database.v1.Database\022\027\n\017next_page_t" +
      "oken\030\002 \001(\t\"[\n\025CreateDatabaseRequest\022\016\n\006p" +
      "arent\030\001 \001(\t\022\030\n\020create_statement\030\002 \001(\t\022\030\n" +
      "\020extra_statements\030\003 \003(\t\"*\n\026CreateDatabas" +
      "eMetadata\022\020\n\010database\030\001 \001(\t\"\"\n\022GetDataba",
      "seRequest\022\014\n\004name\030\001 \001(\t\"V\n\030UpdateDatabas" +
      "eDdlRequest\022\020\n\010database\030\001 \001(\t\022\022\n\nstateme" +
      "nts\030\002 \003(\t\022\024\n\014operation_id\030\003 \001(\t\"x\n\031Updat" +
      "eDatabaseDdlMetadata\022\020\n\010database\030\001 \001(\t\022\022" +
      "\n\nstatements\030\002 \003(\t\0225\n\021commit_timestamps\030" +
      "\003 \003(\0132\032.google.protobuf.Timestamp\"\'\n\023Dro" +
      "pDatabaseRequest\022\020\n\010database\030\001 \001(\t\")\n\025Ge" +
      "tDatabaseDdlRequest\022\020\n\010database\030\001 \001(\t\",\n" +
      "\026GetDatabaseDdlResponse\022\022\n\nstatements\030\001 " +
      "\003(\t2\225\014\n\rDatabaseAdmin\022\267\001\n\rListDatabases\022",
      "6.google.spanner.admin.database.v1.ListD" +
      "atabasesRequest\0327.google.spanner.admin.d" +
      "atabase.v1.ListDatabasesResponse\"5\202\323\344\223\002/" +
      "\022-/v1/{parent=projects/*/instances/*}/da" +
      "tabases\022\242\001\n\016CreateDatabase\0227.google.span" +
      "ner.admin.database.v1.CreateDatabaseRequ" +
      "est\032\035.google.longrunning.Operation\"8\202\323\344\223" +
      "\0022\"-/v1/{parent=projects/*/instances/*}/" +
      "databases:\001*\022\246\001\n\013GetDatabase\0224.google.sp" +
      "anner.admin.database.v1.GetDatabaseReque",
      "st\032*.google.spanner.admin.database.v1.Da" +
      "tabase\"5\202\323\344\223\002/\022-/v1/{name=projects/*/ins" +
      "tances/*/databases/*}\022\260\001\n\021UpdateDatabase" +
      "Ddl\022:.google.spanner.admin.database.v1.U" +
      "pdateDatabaseDdlRequest\032\035.google.longrun" +
      "ning.Operation\"@\202\323\344\223\002:25/v1/{database=pr" +
      "ojects/*/instances/*/databases/*}/ddl:\001*" +
      "\022\230\001\n\014DropDatabase\0225.google.spanner.admin" +
      ".database.v1.DropDatabaseRequest\032\026.googl" +
      "e.protobuf.Empty\"9\202\323\344\223\0023*1/v1/{database=",
      "projects/*/instances/*/databases/*}\022\302\001\n\016" +
      "GetDatabaseDdl\0227.google.spanner.admin.da" +
      "tabase.v1.GetDatabaseDdlRequest\0328.google" +
      ".spanner.admin.database.v1.GetDatabaseDd" +
      "lResponse\"=\202\323\344\223\0027\0225/v1/{database=project" +
      "s/*/instances/*/databases/*}/ddl\022\224\001\n\014Set" +
      "IamPolicy\022\".google.iam.v1.SetIamPolicyRe" +
      "quest\032\025.google.iam.v1.Policy\"I\202\323\344\223\002C\">/v" +
      "1/{resource=projects/*/instances/*/datab" +
      "ases/*}:setIamPolicy:\001*\022\224\001\n\014GetIamPolicy",
      "\022\".google.iam.v1.GetIamPolicyRequest\032\025.g" +
      "oogle.iam.v1.Policy\"I\202\323\344\223\002C\">/v1/{resour" +
      "ce=projects/*/instances/*/databases/*}:g" +
      "etIamPolicy:\001*\022\272\001\n\022TestIamPermissions\022(." +
      "google.iam.v1.TestIamPermissionsRequest\032" +
      ").google.iam.v1.TestIamPermissionsRespon" +
      "se\"O\202\323\344\223\002I\"D/v1/{resource=projects/*/ins" +
      "tances/*/databases/*}:testIamPermissions" +
      ":\001*B\266\001\n$com.google.spanner.admin.databas" +
      "e.v1B\031SpannerDatabaseAdminProtoP\001ZHgoogl",
      "e.golang.org/genproto/googleapis/spanner" +
      "/admin/database/v1;database\252\002&Google.Clo" +
      "ud.Spanner.Admin.Database.V1b\006proto3"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
          public com.google.protobuf.ExtensionRegistry assignDescriptors(
              com.google.protobuf.Descriptors.FileDescriptor root) {
            descriptor = root;
            return null;
          }
        };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
          com.google.api.AnnotationsProto.getDescriptor(),
          com.google.api.AuthProto.getDescriptor(),
          com.google.iam.v1.IamPolicyProto.getDescriptor(),
          com.google.iam.v1.PolicyProto.getDescriptor(),
          com.google.longrunning.OperationsProto.getDescriptor(),
          com.google.protobuf.EmptyProto.getDescriptor(),
          com.google.protobuf.TimestampProto.getDescriptor(),
        }, assigner);
    internal_static_google_spanner_admin_database_v1_Database_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_google_spanner_admin_database_v1_Database_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_Database_descriptor,
        new java.lang.String[] { "Name", "State", });
    internal_static_google_spanner_admin_database_v1_ListDatabasesRequest_descriptor =
      getDescriptor().getMessageTypes().get(1);
    internal_static_google_spanner_admin_database_v1_ListDatabasesRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_ListDatabasesRequest_descriptor,
        new java.lang.String[] { "Parent", "PageSize", "PageToken", });
    internal_static_google_spanner_admin_database_v1_ListDatabasesResponse_descriptor =
      getDescriptor().getMessageTypes().get(2);
    internal_static_google_spanner_admin_database_v1_ListDatabasesResponse_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_ListDatabasesResponse_descriptor,
        new java.lang.String[] { "Databases", "NextPageToken", });
    internal_static_google_spanner_admin_database_v1_CreateDatabaseRequest_descriptor =
      getDescriptor().getMessageTypes().get(3);
    internal_static_google_spanner_admin_database_v1_CreateDatabaseRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_CreateDatabaseRequest_descriptor,
        new java.lang.String[] { "Parent", "CreateStatement", "ExtraStatements", });
    internal_static_google_spanner_admin_database_v1_CreateDatabaseMetadata_descriptor =
      getDescriptor().getMessageTypes().get(4);
    internal_static_google_spanner_admin_database_v1_CreateDatabaseMetadata_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_CreateDatabaseMetadata_descriptor,
        new java.lang.String[] { "Database", });
    internal_static_google_spanner_admin_database_v1_GetDatabaseRequest_descriptor =
      getDescriptor().getMessageTypes().get(5);
    internal_static_google_spanner_admin_database_v1_GetDatabaseRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_GetDatabaseRequest_descriptor,
        new java.lang.String[] { "Name", });
    internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlRequest_descriptor =
      getDescriptor().getMessageTypes().get(6);
    internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlRequest_descriptor,
        new java.lang.String[] { "Database", "Statements", "OperationId", });
    internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlMetadata_descriptor =
      getDescriptor().getMessageTypes().get(7);
    internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlMetadata_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_UpdateDatabaseDdlMetadata_descriptor,
        new java.lang.String[] { "Database", "Statements", "CommitTimestamps", });
    internal_static_google_spanner_admin_database_v1_DropDatabaseRequest_descriptor =
      getDescriptor().getMessageTypes().get(8);
    internal_static_google_spanner_admin_database_v1_DropDatabaseRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_DropDatabaseRequest_descriptor,
        new java.lang.String[] { "Database", });
    internal_static_google_spanner_admin_database_v1_GetDatabaseDdlRequest_descriptor =
      getDescriptor().getMessageTypes().get(9);
    internal_static_google_spanner_admin_database_v1_GetDatabaseDdlRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_GetDatabaseDdlRequest_descriptor,
        new java.lang.String[] { "Database", });
    internal_static_google_spanner_admin_database_v1_GetDatabaseDdlResponse_descriptor =
      getDescriptor().getMessageTypes().get(10);
    internal_static_google_spanner_admin_database_v1_GetDatabaseDdlResponse_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_spanner_admin_database_v1_GetDatabaseDdlResponse_descriptor,
        new java.lang.String[] { "Statements", });
    com.google.protobuf.ExtensionRegistry registry =
        com.google.protobuf.ExtensionRegistry.newInstance();
    registry.add(com.google.api.AnnotationsProto.http);
    com.google.protobuf.Descriptors.FileDescriptor
        .internalUpdateFileDescriptor(descriptor, registry);
    com.google.api.AnnotationsProto.getDescriptor();
    com.google.api.AuthProto.getDescriptor();
    com.google.iam.v1.IamPolicyProto.getDescriptor();
    com.google.iam.v1.PolicyProto.getDescriptor();
    com.google.longrunning.OperationsProto.getDescriptor();
    com.google.protobuf.EmptyProto.getDescriptor();
    com.google.protobuf.TimestampProto.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
package com.rexsl.page;

import com.jcabi.log.Logger;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javassist.CannotCompileException;
import javassist.CtClass;
import javassist.NotFoundException;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
import javassist.bytecode.annotation.Annotation;
import javassist.bytecode.annotation.ArrayMemberValue;
import javassist.bytecode.annotation.ClassMemberValue;
import javassist.bytecode.annotation.StringMemberValue;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import lombok.ToString;

/**
 * JAXB group of elements.
 *
 *
A convenient utility class that enables on-fly creation of JAXB annotated
 * collections of elements, for example:
 *
 *
 @XmlRootElement
 * public class Page {
 *   @XmlElement
 *   public Object getEmployees() {
 *     Collection<Employee> employees = this.retrieve();
 *     return JaxbGroup.build(employees, "employee");
 *   }
 * }

 *
 *
It's even more convenient in combination with {@link JaxbBundle}, for
 * example:
 *
 *
 @XmlRootElement
 * public class Page {
 *   @XmlElement
 *   public Object getEmployee() {
 *     return new JaxbBundle("employee")
 *       .attr("age", "45")
 *       .add("depts", JaxbGroup.build(this.depts(), "dept"))
 *       .up()
 *       .element();
 *   }
 * }

 *
 *
The class is immutable and thread-safe.
 *
 * @author Yegor Bugayenko (yegor@tpc2.com)
 * @version $Id$
 * @since 0.3.7
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@ToString
public final class JaxbGroup {

    /**
     * Classes already created before.
     */
    private static final ConcurrentMap<String, Class<?>> READY =
        new ConcurrentHashMap<String, Class<?>>(0);

    /**
     * Collection of elements.
     */
    @NotNull
    private final transient Collection<?> group;

    /**
     * Public ctor, for JAXB (always throws a runtime exception).
     */
    public JaxbGroup() {
        throw new IllegalStateException(
            // @checkstyle LineLength (1 line)
            "JaxbGroup can't be instantiated with default ctor, use JaxbGroup#build(..) instead"
        );
    }

    /**
     * Protected ctor, for on-fly instantiating (you're not supposed to use it).
     * @param grp Group of elements
     */
    JaxbGroup(final Collection<?> grp) {
        this.group = grp;
    }

    /**
     * Creates a new JAXB-annotated collection of elements.
     * @param grp Group of elements (JAXB-annotated)
     * @param name Name of parent XML element
     * @return JAXB-annotated object, just created
     */
    @NotNull
    public static Object build(
        @NotNull(message = "group can't be NULL") final Collection<?> grp,
        @NotNull(message = "name can't be NULL") final String name) {
        synchronized (JaxbGroup.class) {
            final String mnemo = JaxbGroup.mnemo(grp.isEmpty(), name);
            if (!JaxbGroup.READY.containsKey(mnemo)) {
                JaxbGroup.READY.put(
                    mnemo,
                    JaxbGroup.construct(JaxbGroup.types(grp), name)
                );
            }
            try {
                return JaxbGroup.READY.get(mnemo)
                    .getDeclaredConstructor(Collection.class)
                    .newInstance(grp);
            } catch (final NoSuchMethodException ex) {
                throw new IllegalStateException(ex);
            } catch (final InstantiationException ex) {
                throw new IllegalStateException(ex);
            } catch (final IllegalAccessException ex) {
                throw new IllegalStateException(ex);
            } catch (final InvocationTargetException ex) {
                throw new IllegalStateException(ex);
            }
        }
    }

    /**
     * Get group of elements.
     * @return The collection
     */
    @XmlAnyElement(lax = true)
    @XmlMixed
    @NotNull(message = "collection is never NULL")
    public Collection<?> getGroup() {
        return Collections.unmodifiableCollection(this.group);
    }

    /**
     * Create NEW class name.
     * @param empty Is it an empty group?
     * @param name Name of root element
     * @return The name
     */
    private static String mnemo(final boolean empty, final String name) {
        return String.format(
            "%s$%s$%s",
            JaxbGroup.class.getName(),
            name,
            // @checkstyle AvoidInlineConditionals (1 line)
            empty ? "empty" : "full"
        );
    }

    /**
     * Construct new class.
     * @param types Types used in the collection
     * @param name Name of root element
     * @return Class just created
     */
    private static Class<?> construct(final Collection<Class<?>> types,
        final String name) {
        try {
            final CtClass ctc = PageBuilder.POOL.getAndRename(
                JaxbGroup.class.getName(),
                JaxbGroup.mnemo(types.isEmpty(), name)
            );
            final ClassFile file = ctc.getClassFile();
            final AnnotationsAttribute attribute =
                AnnotationsAttribute.class.cast(
                    file.getAttribute(
                        AnnotationsAttribute.visibleTag
                    )
                );
            attribute.addAnnotation(JaxbGroup.xmlRootElement(file, name));
            if (!types.isEmpty()) {
                attribute.addAnnotation(JaxbGroup.xmlSeeAlso(file, types));
            }
            final Class<?> cls = ctc.toClass();
            ctc.defrost();
            Logger.debug(
                JaxbGroup.class,
                "#construct('%s'): class %s constructed",
                name,
                cls.getName()
            );
            return cls;
        } catch (final NotFoundException ex) {
            throw new IllegalStateException(ex);
        } catch (final CannotCompileException ex) {
            throw new IllegalStateException(ex);
        }
    }

    /**
     * Find all types used in the collection.
     * @param grp The collection
     * @return List of types used there
     */
    private static Collection<Class<?>> types(final Collection<?> grp) {
        final Collection<Class<?>> types = new HashSet<Class<?>>(grp.size());
        for (final Object element : grp) {
            types.add(element.getClass());
        }
        return types;
    }

    /**
     * Create new <tt>XmlRootElement</tt> annotation.
     * @param file Javassist file to work with
     * @param name Name of root element
     * @return The annotation
     */
    private static Annotation xmlRootElement(final ClassFile file,
        final String name) {
        final AnnotationsAttribute attribute = AnnotationsAttribute.class.cast(
            file.getAttribute(AnnotationsAttribute.visibleTag)
        );
        final Annotation annotation = attribute.getAnnotation(
            XmlRootElement.class.getName()
        );
        annotation.addMemberValue(
            "name",
            new StringMemberValue(name, file.getConstPool())
        );
        Logger.debug(
            JaxbGroup.class,
            "#xmlRootElement(.., '%s'): annotation created",
            name
        );
        return annotation;
    }

    /**
     * Create new <tt>XmlSeeAlso</tt> annotation.
     * @param file Javassist file to work with
     * @param types The class to refer to
     * @return The annotation
     */
    @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
    private static Annotation xmlSeeAlso(final ClassFile file,
        final Collection<Class<?>> types) {
        final Annotation annotation = new Annotation(
            XmlSeeAlso.class.getName(),
            file.getConstPool()
        );
        final ArrayMemberValue member = new ArrayMemberValue(
            file.getConstPool()
        );
        final ClassMemberValue[] values = new ClassMemberValue[types.size()];
        int pos = 0;
        for (final Class<?> type : types) {
            values[pos] = new ClassMemberValue(
                type.getName(),
                file.getConstPool()
            );
            pos += 1;
        }
        member.setValue(values);
        annotation.addMemberValue("value", member);
        Logger.debug(
            JaxbGroup.class,
            "#xmlSeeAlso(.., %d classes): annotation created",
            types.size()
        );
        return annotation;
    }

}

redpajama_set_name: RedPajamaGithub


text:
class UserActionsUIHandler : public content::WebUIMessageHandler {
 public:
  UserActionsUIHandler();
  ~UserActionsUIHandler() override;

  // WebUIMessageHandler implementation:
  // Does nothing for now.
  void RegisterMessages() override;

 private:
  void OnUserAction(const std::string& action);

  base::ActionCallback action_callback_;

  DISALLOW_COPY_AND_ASSIGN(UserActionsUIHandler);
};

#endif  // CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_


text:
const assert = require("assert");
const should = require("should");
const shape_factory = require("../lib/shapeFactory");
const occ = require("../lib/occ");
const fs = require("fs");

const getTemporaryFilePath = require("./helpers").getTemporaryFilePath;
const remove_file = require("./helpers").remove_file;

describe("testing BREP input output ", function () {

    let b1_brep, b2_brep, b3_brep;
    let b1_volume = 0;
    let b1_area = 0;
    before(function () {

        b1_brep = getTemporaryFilePath({prefix: "b1_", suffix: ".brep"});
        b2_brep = getTemporaryFilePath({prefix: "b2_", suffix: ".brep"});
        b3_brep = getTemporaryFilePath({prefix: "b3_", suffix: ".brep"});

        create_shapes();

    });
    after(function (done) {
        remove_file(b1_brep);
        remove_file(b2_brep);
        remove_file(b3_brep);
        done();
    });

    function create_shapes() {

        let box = occ.makeBox([0, 0, 0], [100, 200, 300]);
        let b1_result = occ.writeBREP(b1_brep, box);
        b1_volume = box.volume;
        b1_area = box.area;

        let cyl = occ.makeCylinder([0, 0, 0], [0, 0, 10], 5);
        let b2_result = occ.writeBREP(b2_brep, cyl);

        let b3_result = occ.writeBREP(b3_brep, [box, cyl]);

        b1_result.should.eql(true);
        b2_result.should.eql(true);
        b3_result.should.eql(true);

    }

    it("should write a simple shape", function () {
        create_shapes();
    });

    describe(" readBREP ", function () {

        it("ZZ1 - should throw an error  if used with no argument", function () {

            should(function () {
                occ.readBREP(null, function (err, shapes) {
                    err.message.should.match(/expecting a filename/);
                });
            }).throwError();
        });

        it("ZZ2 - should call the callback method with an error if used with an invalid arguments", function (done) {

            occ.readBREP("||this is a invalid filename||",  (err, shapes)  => {
                err.message.should.match(/cannot read/);
                done();
            });
        });

        it("ZZ3 - should call the callback with an error if the file doesn't exist", function (done) {
            occ.readBREP("invalid file name", function (err, shapes) {
                console.log(" intercepting error ", err);
                assert(err !== undefined);
                done();
            });
        });

        it("ZZ4 - should read the shape back", function (done) {

            occ.readBREP(b1_brep,  (err, shapes) => {

                should(err).eql(null);

                if (!err) {
                    shapes.length.should.equal(1);
                    shapes[0].numFaces.should.equal(6);

                    shapes[0].volume.should.equal(b1_volume);
                    shapes[0].area.should.equal(b1_area);
                }
                done(err);
            });
        });

        it("ZZ5 - should read the shape back", function (done) {

            occ.readBREP(b2_brep, function (err, shapes) {
                if (!err) {
                    shapes.length.should.equal(1);
                    shapes[0].numFaces.should.equal(3);
                }
                done(err);
            });

        });
        it("ZZ6 - should read the shape back", function (done) {
            occ.readBREP(b3_brep, function (err, shapes) {
                if (!err) {
                    shapes.length.should.equal(2);
                    shapes[0].numFaces.should.equal(6);
                    shapes[1].numFaces.should.equal(3);
                }
                done();
            });
        });
    });
});

function build_large_part() {

    let lego_filename = getTemporaryFilePath({prefix: "legoPlate3x2_2x2", suffix: ""});

    let legoPlate = shape_factory.makeLegoBrick(occ, 3, 2, "thin");
    let solids = [];
    for (let x = 0; x < 100; x += 50) {
        for (let y = 0; y < 100; y += 50) {
            solids.push(legoPlate.translate([x, y, 0]));
        }
    }
    occ.writeBREP(lego_filename + ".brep", solids);

    /*
     occ.writeSTL(lego_filename + ".stl", solids);

     let obj = {solids: []};
     let counter = 0;
     solids.forEach(function (solid) {
     solid.name = "S" + counter;
     counter++;
     obj.solids.push(occ.buildSolidMesh(solid));
     });
     fs.writeFile(lego_filename + ".3js", JSON.stringify(obj, null, ""), function (err) {
     console.log("OK");
     });

     */
    return lego_filename;
}

describe("it should write and read a large brep file", function () {

    this.timeout(15000);

    let filename = build_large_part();

    it("should read a large BREP file quickly", function (done) {

        console.log(" lego file ", filename);

        occ.readBREP(filename + ".brep", function (err, solids) {

            console.log(" read !!!");

            if (!err) {
                console.log(" num Faces = ", solids[0].numFaces);
            }
            done(err);
        });

    });

});


text:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="com.mycompany_Persistencia_war_1.0-SNAPSHOTPU" transaction-type="JTA">
    <jta-data-source>jdbc/__default</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
  </persistence-unit>
</persistence>


text:
<sequence name="_api_blocked_sequence_" xmlns="http://ws.apache.org/ns/synapse">
    <payloadFactory media-type="json">
        <format>{"code":"700700","type":"API blocked","description":"This API has been blocked temporarily. Please try again later or contact the system administrators."}
        </format>
        <args/>
    </payloadFactory>
    <property name="HTTP_SC" value="503" scope="axis2"/>
    <property name="RESPONSE" value="true"/>
    <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
    <header name="To" action="remove"/>

</sequence>


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using OpenCvSharp;

namespace MotionTracker
{
    public partial class LiveCamSetupForm : Form
    {
        private CvCapture cap; // camera capture
        private String vidsaveloc = ""; // place to save video file
        private Thread _camThread; // camera thread
        private int camIndex = -1; // camera index
        private bool okflag = false; // ok flag

        /// <summary>
        /// constructor
        /// </summary>
        public LiveCamSetupForm()
        {
            InitializeComponent();

            ConfigureComponent();
        }

        /// <summary>
        /// Configure component
        /// </summary>
        private void ConfigureComponent()
        {
            try
            {
                this._testButton.Text = Constants.TEST_CAM_START;
            }
            catch
            {
            }

            this.FormClosed += new FormClosedEventHandler(LiveCamSetupForm_FormClosed);
            this.FormClosing += new FormClosingEventHandler(LiveCamSetupForm_FormClosing);
        }

        /// <summary>
        /// form closing event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LiveCamSetupForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (this._camThread != null && this._camThread.IsAlive)
                {
                    this.cap.Dispose();
                    this._camThread.Abort();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
            }
        }

        /// <summary>
        /// form close event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LiveCamSetupForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                if (this.okflag)
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
            }
        }

        /// <summary>
        /// Select save location button click handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _selectLocButton_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.DefaultExt = ".avi";
                sfd.ValidateNames = true;
                sfd.OverwritePrompt = true;
                sfd.Title = "Choose where to save video file";
                DialogResult res = sfd.ShowDialog();

                if (res == System.Windows.Forms.DialogResult.OK
                    && Directory.Exists(Path.GetDirectoryName(sfd.FileName)))
                {
                    this.vidsaveloc = Path.GetFileNameWithoutExtension(sfd.FileName) + ".avi";

                    this._selectLocButton.Text = Constants.SAVE_FILE_SELECTED;
                    this._selectLocButton.ForeColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
            }
        }

        /// <summary>
        /// Cancel button click handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _cancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// cam index up down value changed event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _camIndexUpDown_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                this.camIndex = (int)this._camIndexUpDown.Value;
            }
            catch
            {
            }
        }

        /// <summary>
        /// save settings for later on ok button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _okButton_Click(object sender, EventArgs e)
        {
            // save values for later (available through public property)
            // make sure camera in box is stopped (in onformclosing)
            this.okflag = true;

            // and close form
            this.Close();
        }

        /// <summary>
        /// test camera capture
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _testButton_Click(object sender, EventArgs e)
        {
            if (this._testButton == null) return;

            if (this._testButton.Text.Equals(Constants.TEST_CAM_START))
            {
                // start camera in box
                CaptureFromCamera();
                this._testButton.Text = Constants.TEST_CAM_STOP;
            }
            else
            {
                this._pictureBox.Image = null;
                this.cap.Dispose();
                this._camThread.Abort();
                this._testButton.Text = Constants.TEST_CAM_START;
            }

        }

        /// <summary>
        /// capture from camera
        /// </summary>
        private void CaptureFromCamera()
        {
            _camThread = new Thread(new ThreadStart(CaptureCamCallback));
            _camThread.Start();
        }

        /// <summary>
        /// capture cam callback
        /// </summary>
        private void CaptureCamCallback()
        {
            try
            {
                this.cap = CvCapture.FromCamera(
                    CaptureDevice.Any,
                    this.camIndex);

                while (true)
                {
                    Bitmap imgb = BitmapConverter.ToBitmap(cap.QueryFrame());
                    imgb.SetResolution(this._pictureBox.Width, this._pictureBox.Height);

                    if (imgb.Size.Width > this._pictureBox.Size.Width
                        || imgb.Size.Height > this._pictureBox.Size.Height)
                        this._pictureBox.Image = MotionTrackerUI.resizeImage(
                            imgb, this._pictureBox.Size);
                    else
                        this._pictureBox.Image = imgb;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
            }
        }

        /// <summary>
        /// get save video file location
        /// </summary>
        /// <returns></returns>
        public String GetSaveVideoFileLocation()
        {
            return this.vidsaveloc;
        }

        /// <summary>
        /// get camera index
        /// </summary>
        /// <returns></returns>
        public int GetCameraIndex()
        {
            return this.camIndex;
        }

    }
}


text:
<?php

namespace BD\Subber\Release;

interface Release
{
    /**
     * @return string
     */
    public function getName();

    /**
     * @param string $name
     */
    public function setName($name);

    /**
     * @return bool
     */
    public function isRepack();

    /**
     * @param bool $isRepack
     */
    public function setIsRepack($isRepack);

    /**
     * @return bool
     */
    public function isProper();

    /**
     * @param bool $isProper
     */
    public function setIsProper($isProper);

    /**
     * @return string
     */
    public function getGroup();

    /**
     * @return string
     */
    public function getSource();

    /**
     * @param string $source
     */
    public function setSource($source);

    /**
     * @return string
     */
    public function getResolution();

    /**
     * @param string $resolution
     */
    public function setResolution($resolution);

    /**
     * @return string
     */
    public function getFormat();

    /**
     * @param string $format
     */
    public function setFormat($format);

    /**
     * @param string $group
     */
    public function setGroup($group);

    public function toArray();
}


text:
var PassThrough = require('stream').PassThrough;
var objectAssign = require('object-assign');

module.exports = function (opts) {
	opts = objectAssign({}, opts);

	var array = opts.array;
	var encoding = opts.encoding;

	var buffer = encoding === 'buffer';
	var objectMode = false;

	if (array) {
		objectMode = !(encoding || buffer);
	} else {
		encoding = encoding || 'utf8';
	}

	if (buffer) {
		encoding = null;
	}

	var len = 0;
	var ret = [];

	var stream = new PassThrough({objectMode: objectMode});

	if (encoding) {
		stream.setEncoding(encoding);
	}

	stream.on('data', function (chunk) {
		ret.push(chunk);

		if (objectMode) {
			len = ret.length;
		} else {
			len += chunk.length;
		}
	});

	stream.getBufferedValue = function () {
		if (array) {
			return ret;
		}
		return buffer ? Buffer.concat(ret, len) : ret.join('');
	};

	stream.getBufferedLength = function () {
		return len;
	};

	return stream;
};


text:
package load

import (
	"bytes"
	"io/ioutil"
	"os"
	"reflect"
	"strings"
	"testing"

	"github.com/google/go-cmp/cmp"

	"k8s.io/pod-security-admission/admission/api"
)

var defaultConfig = &api.PodSecurityConfiguration{
	Defaults: api.PodSecurityDefaults{
		Enforce: "privileged", EnforceVersion: "latest",
		Warn: "privileged", WarnVersion: "latest",
		Audit: "privileged", AuditVersion: "latest",
	},
}

func writeTempFile(t *testing.T, content string) string {
	t.Helper()
	file, err := ioutil.TempFile("", "podsecurityconfig")
	if err != nil {
		t.Fatal(err)
	}
	t.Cleanup(func() {
		os.Remove(file.Name())
	})
	if err := ioutil.WriteFile(file.Name(), []byte(content), 0600); err != nil {
		t.Fatal(err)
	}
	return file.Name()
}

func TestLoadFromFile(t *testing.T) {
	// no file
	{
		config, err := LoadFromFile("")
		if err != nil {
			t.Fatalf("unexpected err: %v", err)
		}
		if !reflect.DeepEqual(config, defaultConfig) {
			t.Fatalf("unexpected config:\n%s", cmp.Diff(defaultConfig, config))
		}
	}

	// empty file
	{
		config, err := LoadFromFile(writeTempFile(t, ``))
		if err != nil {
			t.Fatalf("unexpected err: %v", err)
		}
		if !reflect.DeepEqual(config, defaultConfig) {
			t.Fatalf("unexpected config:\n%s", cmp.Diff(defaultConfig, config))
		}
	}

	// valid file
	{
		input := `{
			"apiVersion":"pod-security.admission.config.k8s.io/v1alpha1",
			"kind":"PodSecurityConfiguration",
			"defaults":{"enforce":"baseline"}}`
		expect := &api.PodSecurityConfiguration{
			Defaults: api.PodSecurityDefaults{
				Enforce: "baseline", EnforceVersion: "latest",
				Warn: "privileged", WarnVersion: "latest",
				Audit: "privileged", AuditVersion: "latest",
			},
		}

		config, err := LoadFromFile(writeTempFile(t, input))
		if err != nil {
			t.Fatalf("unexpected err: %v", err)
		}
		if !reflect.DeepEqual(config, expect) {
			t.Fatalf("unexpected config:\n%s", cmp.Diff(expect, config))
		}
	}

	// missing file
	{
		_, err := LoadFromFile(`bogus-missing-pod-security-policy-config-file`)
		if err == nil {
			t.Fatalf("expected err, got none")
		}
		if !strings.Contains(err.Error(), "bogus-missing-pod-security-policy-config-file") {
			t.Fatalf("expected missing file error, got %v", err)
		}
	}

	// invalid content file
	{
		input := `{
			"apiVersion":"pod-security.admission.config.k8s.io/v99",
			"kind":"PodSecurityConfiguration",
			"defaults":{"enforce":"baseline"}}`

		_, err := LoadFromFile(writeTempFile(t, input))
		if err == nil {
			t.Fatalf("expected err, got none")
		}
		if !strings.Contains(err.Error(), "pod-security.admission.config.k8s.io/v99") {
			t.Fatalf("expected apiVersion error, got %v", err)
		}
	}
}

func TestLoadFromReader(t *testing.T) {
	// no reader
	{
		config, err := LoadFromReader(nil)
		if err != nil {
			t.Fatalf("unexpected err: %v", err)
		}
		if !reflect.DeepEqual(config, defaultConfig) {
			t.Fatalf("unexpected config:\n%s", cmp.Diff(defaultConfig, config))
		}
	}

	// empty reader
	{
		config, err := LoadFromReader(&bytes.Buffer{})
		if err != nil {
			t.Fatalf("unexpected err: %v", err)
		}
		if !reflect.DeepEqual(config, defaultConfig) {
			t.Fatalf("unexpected config:\n%s", cmp.Diff(defaultConfig, config))
		}
	}

	// valid reader
	{
		input := `{
			"apiVersion":"pod-security.admission.config.k8s.io/v1alpha1",
			"kind":"PodSecurityConfiguration",
			"defaults":{"enforce":"baseline"}}`
		expect := &api.PodSecurityConfiguration{
			Defaults: api.PodSecurityDefaults{
				Enforce: "baseline", EnforceVersion: "latest",
				Warn: "privileged", WarnVersion: "latest",
				Audit: "privileged", AuditVersion: "latest",
			},
		}

		config, err := LoadFromReader(bytes.NewBufferString(input))
		if err != nil {
			t.Fatalf("unexpected err: %v", err)
		}
		if !reflect.DeepEqual(config, expect) {
			t.Fatalf("unexpected config:\n%s", cmp.Diff(expect, config))
		}
	}

	// invalid reader
	{
		input := `{
			"apiVersion":"pod-security.admission.config.k8s.io/v99",
			"kind":"PodSecurityConfiguration",
			"defaults":{"enforce":"baseline"}}`

		_, err := LoadFromReader(bytes.NewBufferString(input))
		if err == nil {
			t.Fatalf("expected err, got none")
		}
		if !strings.Contains(err.Error(), "pod-security.admission.config.k8s.io/v99") {
			t.Fatalf("expected apiVersion error, got %v", err)
		}
	}
}

func TestLoadFromData(t *testing.T) {
	testcases := []struct {
		name         string
		data         []byte
		expectErr    string
		expectConfig *api.PodSecurityConfiguration
	}{
		{
			name:         "nil",
			data:         nil,
			expectConfig: defaultConfig,
		},
		{
			name:         "nil",
			data:         []byte{},
			expectConfig: defaultConfig,
		},
		{
			name: "v1alpha1 - json",
			data: []byte(`{
"apiVersion":"pod-security.admission.config.k8s.io/v1alpha1",
"kind":"PodSecurityConfiguration",
"defaults":{"enforce":"baseline"}}`),
			expectConfig: &api.PodSecurityConfiguration{
				Defaults: api.PodSecurityDefaults{
					Enforce: "baseline", EnforceVersion: "latest",
					Warn: "privileged", WarnVersion: "latest",
					Audit: "privileged", AuditVersion: "latest",
				},
			},
		},
		{
			name: "v1alpha1 - yaml",
			data: []byte(`
apiVersion: pod-security.admission.config.k8s.io/v1alpha1
kind: PodSecurityConfiguration
defaults:
  enforce: baseline
  enforce-version: v1.7
exemptions:
  usernames: ["alice","bob"]
  namespaces: ["kube-system"]
  runtimeClasses: ["special"]
`),
			expectConfig: &api.PodSecurityConfiguration{
				Defaults: api.PodSecurityDefaults{
					Enforce: "baseline", EnforceVersion: "v1.7",
					Warn: "privileged", WarnVersion: "latest",
					Audit: "privileged", AuditVersion: "latest",
				},
				Exemptions: api.PodSecurityExemptions{
					Usernames:      []string{"alice", "bob"},
					Namespaces:     []string{"kube-system"},
					RuntimeClasses: []string{"special"},
				},
			},
		},
		{
			name:      "missing apiVersion",
			data:      []byte(`{"kind":"PodSecurityConfiguration"}`),
			expectErr: `'apiVersion' is missing`,
		},
		{
			name:      "missing kind",
			data:      []byte(`{"apiVersion":"pod-security.admission.config.k8s.io/v1alpha1"}`),
			expectErr: `'Kind' is missing`,
		},
		{
			name:      "unknown group",
			data:      []byte(`{"apiVersion":"apps/v1alpha1","kind":"PodSecurityConfiguration"}`),
			expectErr: `apps/v1alpha1`,
		},
		{
			name:      "unknown version",
			data:      []byte(`{"apiVersion":"pod-security.admission.config.k8s.io/v99","kind":"PodSecurityConfiguration"}`),
			expectErr: `pod-security.admission.config.k8s.io/v99`,
		},
		{
			name:      "unknown kind",
			data:      []byte(`{"apiVersion":"pod-security.admission.config.k8s.io/v1alpha1","kind":"SomeConfiguration"}`),
			expectErr: `SomeConfiguration`,
		},
		{
			name: "unknown field",
			data: []byte(`{
"apiVersion":"pod-security.admission.config.k8s.io/v1alpha1",
"kind":"PodSecurityConfiguration",
"deflaults":{"enforce":"baseline"}}`),
			expectErr: `unknown field "deflaults"`,
		},
	}

	for _, tc := range testcases {
		t.Run(tc.name, func(t *testing.T) {
			config, err := LoadFromData(tc.data)
			if err != nil {
				if len(tc.expectErr) == 0 {
					t.Fatalf("unexpected error: %v", err)
				}
				if !strings.Contains(err.Error(), tc.expectErr) {
					t.Fatalf("unexpected error: %v", err)
				}
				return
			}
			if len(tc.expectErr) > 0 {
				t.Fatalf("expected err, got none")
			}

			if !reflect.DeepEqual(config, tc.expectConfig) {
				t.Fatalf("unexpected config:\n%s", cmp.Diff(tc.expectConfig, config))
			}
		})
	}
}


text:
package version2

import (
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	runtime "k8s.io/apimachinery/pkg/runtime"
	schema "k8s.io/apimachinery/pkg/runtime/schema"
)

var (
	// Package-wide variables from generator "register".
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "version2"}
	SchemeBuilder      = runtime.NewSchemeBuilder(addKnownTypes)
	localSchemeBuilder = &SchemeBuilder
	AddToScheme        = localSchemeBuilder.AddToScheme
)

const (
	// Package-wide consts from generator "register".
	GroupName = "group2"
)

func Resource(resource string) schema.GroupResource {
	return SchemeGroupVersion.WithResource(resource).GroupResource()
}

func addKnownTypes(scheme *runtime.Scheme) error {
	scheme.AddKnownTypes(SchemeGroupVersion,
		&AllOverridden{},
		&AllOverriddenList{},
	)
	v1.AddToGroupVersion(scheme, SchemeGroupVersion)
	return nil
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Tyvj.DataModels;

namespace Tyvj.ViewModels
{
    public class vProblemStatus
    {
        public vProblemStatus() { }
        public vProblemStatus(Status Status)
        {
            ID = Status.ID;
            Result = Status.Result.ToString();
            ResultAsInt = Status.ResultAsInt;
            Time = Status.Time.ToString("MM-dd");
        }
        public int ID { get; set; }
        public string Result { get; set; }
        public int ResultAsInt { get; set; }
        public string Time { get; set; }
    }
}


text:
define( [ "jquery", "../jquery.mobile.core" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

$.mobile.behaviors.optionDemultiplexer = {
	_setOption: function( key, value ) {
		var setter = "_set" + key.charAt( 0 ).toUpperCase() + key.slice( 1 );

		if ( this[ setter ] !== undefined ) {
			this[ setter ]( value );
		}

		this._super( key, value );
	}
};

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");


text:
// 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.

using System;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Wake.Time.Event;
using Org.Apache.REEF.Wake.Time.Runtime;

namespace Org.Apache.REEF.Wake.Time
{
    [DefaultImplementation(typeof(RuntimeClock))]
    public interface IClock : IDisposable
    {
        /// <summary>
        /// Schedule a TimerEvent at the given future offset
        /// </summary>
        /// <param name="offset">The offset in the future to schedule the alarm</param>
        /// <param name="handler">The IObserver to to be called</param>
        void ScheduleAlarm(long offset, IObserver<Alarm> handler);

        /// <summary>
        /// Clock is idle if it has no future alarms set
        /// </summary>
        /// <returns>True if no future alarms are set, otherwise false</returns>
        bool IsIdle();

        /// <summary>
        /// Start the Clock.
        /// </summary>
        /// <remarks>
        /// The clock will continue to run and handle events until it has been disposed.
        /// </remarks>
        void Run();
    }
}


text:
import logging
import datetime
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import View
from django.core.exceptions import PermissionDenied
from windyer_comments.models import Comment
from windyer_system.models import Notification
from blog.models import Article

ArticleModel = Article
# logger
logger = logging.getLogger(__name__)

# Create your views here.

class CommentControl(View):
    def post(self, request, *args, **kwargs):
        # 获取当前用户
        user = self.request.user
        # 获取评论
        text = self.request.POST.get("comment", "")
        # 判断当前用户是否是活动的用户
        if not user.is_authenticated():
            logger.error(
                u'[CommentControl]当前用户非活动用户:[{}]'.format(
                    user.username
                )
            )
            return HttpResponse(u"请登陆!", status=403)

        en_title = self.kwargs.get('slug', '')
        try:
            # 默认使用pk来索引(也可根据需要使用title,en_title在索引
            article = ArticleModel.objects.get(en_title=en_title)
        except ArticleModel.DoesNotExist:
            logger.error(u'[CommentControl]此文章不存在:[%s]' % en_title)
            raise PermissionDenied

        # 保存评论
        parent = None
        if text.startswith('@['):
            import ast
            parent_str = text[1:text.find(':')]
            parent_id = ast.literal_eval(parent_str)[1]
            text = text[text.find(':')+2:]
            try:
                parent = Comment.objects.get(pk=parent_id)
                info = u'{}回复了你在 {} 的评论'.format(
                    user.username,
                    parent.article.title
                )
                Notification.objects.create(
                    title=info,
                    text=text,
                    from_user=user,
                    to_user=parent.user,
                    url='/article/'+en_title+'.html'
                )
            except Comment.DoesNotExist:
                logger.error(u'[CommentControl]评论引用错误:%s' % parent_str)
                return HttpResponse(u"请勿修改评论代码!", status=403)

        if not text:
            logger.error(
                u'[CommentControl]当前用户输入空评论:[{}]'.format(
                    user.username
                )
            )
            return HttpResponse(u"请输入评论内容!", status=403)

        comment = Comment.objects.create(
                user=user,
                article=article,
                text=text,
                parent=parent
                )

        try:
            img = comment.user.img
        except Exception as e:
            img = "http://windyer.qiniudn.com/image/tx/tx-default.jpg"

        print_comment = u"
评论:{}
".format(text)
        if parent:
            print_comment = u"
\

\
                                      @{}\
                                      {}\

\

".format(
                                  parent.user.username,
                                  parent.text
                              ) + print_comment
        # 返回当前评论
        html = u"
\

\
                        \

\

\

{}
\
                        {}\

{}
\

\

".format(
                    img,
                    comment.user.username,
                    print_comment,
                    datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
                )

        return HttpResponse(html)


text:
from django.conf import settings
from django.contrib.auth import (
    get_user, get_user_model, logout)
from django.contrib.auth.decorators import \
    login_required
from django.contrib.auth.tokens import \
    default_token_generator as token_generator
from django.contrib.messages import error, success
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.template.response import \
    TemplateResponse
from django.utils.decorators import \
    method_decorator
from django.utils.encoding import force_text
from django.utils.http import \
    urlsafe_base64_decode
from django.views.decorators.cache import \
    never_cache
from django.views.decorators.csrf import \
    csrf_protect
from django.views.decorators.debug import \
    sensitive_post_parameters
from django.views.generic import DetailView, View

from core.utils import UpdateView

from .decorators import class_login_required
from .forms import (
    ResendActivationEmailForm, UserCreationForm)
from .models import Profile
from .utils import (
    MailContextViewMixin, ProfileGetObjectMixin)

class ActivateAccount(View):
    success_url = reverse_lazy('dj-auth:login')
    template_name = 'user/user_activate.html'

    @method_decorator(never_cache)
    def get(self, request, uidb64, token):
        User = get_user_model()
        try:
            # urlsafe_base64_decode()
            #     -> bytestring in Py3
            uid = force_text(
                urlsafe_base64_decode(uidb64))
            user = User.objects.get(pk=uid)
        except (TypeError, ValueError,
                OverflowError, User.DoesNotExist):
            user = None
        if (user is not None
                and token_generator
                .check_token(user, token)):
            user.is_active = True
            user.save()
            success(
                request,
                'User Activated! '
                'You may now login.')
            return redirect(self.success_url)
        else:
            return TemplateResponse(
                request,
                self.template_name)

class CreateAccount(MailContextViewMixin, View):
    form_class = UserCreationForm
    success_url = reverse_lazy(
        'dj-auth:create_done')
    template_name = 'user/user_create.html'

    @method_decorator(csrf_protect)
    def get(self, request):
        return TemplateResponse(
            request,
            self.template_name,
            {'form': self.form_class()})

    @method_decorator(csrf_protect)
    @method_decorator(sensitive_post_parameters(
        'password1', 'password2'))
    def post(self, request):
        bound_form = self.form_class(request.POST)
        if bound_form.is_valid():
            # not catching returned user
            bound_form.save(
                **self.get_save_kwargs(request))
            if bound_form.mail_sent:  # mail sent?
                return redirect(self.success_url)
            else:
                errs = (
                    bound_form.non_field_errors())
                for err in errs:
                    error(request, err)
                return redirect(
                    'dj-auth:resend_activation')
        return TemplateResponse(
            request,
            self.template_name,
            {'form': bound_form})

class DisableAccount(View):
    success_url = settings.LOGIN_REDIRECT_URL
    template_name = (
        'user/user_confirm_delete.html')

    @method_decorator(csrf_protect)
    @method_decorator(login_required)
    def get(self, request):
        return TemplateResponse(
            request,
            self.template_name)

    @method_decorator(csrf_protect)
    @method_decorator(login_required)
    def post(self, request):
        user = get_user(request)
        user.set_unusable_password()
        user.is_active = False
        user.save()
        logout(request)
        return redirect(self.success_url)

@class_login_required
class ProfileDetail(
        ProfileGetObjectMixin, DetailView):
    model = Profile

class PublicProfileDetail(DetailView):
    model = Profile

@class_login_required
class ProfileUpdate(
        ProfileGetObjectMixin, UpdateView):
    fields = ('about',)
    model = Profile

class ResendActivationEmail(
        MailContextViewMixin, View):
    form_class = ResendActivationEmailForm
    success_url = reverse_lazy('dj-auth:login')
    template_name = 'user/resend_activation.html'

    @method_decorator(csrf_protect)
    def get(self, request):
        return TemplateResponse(
            request,
            self.template_name,
            {'form': self.form_class()})

    @method_decorator(csrf_protect)
    def post(self, request):
        bound_form = self.form_class(request.POST)
        if bound_form.is_valid():
            user = bound_form.save(
                **self.get_save_kwargs(request))
            if (user is not None
                    and not bound_form.mail_sent):
                errs = (
                    bound_form.non_field_errors())
                for err in errs:
                    error(request, err)
                if errs:
                    bound_form.errors.pop(
                        '__all__')
                return TemplateResponse(
                    request,
                    self.template_name,
                    {'form': bound_form})
        success(
            request,
            'Activation Email Sent!')
        return redirect(self.success_url)


text:
package com.morgan.server.game;

import java.util.function.Function;

import javax.annotation.Nullable;

import com.google.inject.Inject;
import com.morgan.server.game.modules.GamePortal;
import com.morgan.shared.game.modules.GameDescriptor;

/**
 * {@link Function} that converts {@link GamePortal} instances into {@link GameDescriptor}
 * instances.
 *
 * @author mark@mark-morgan.net (Mark Morgan)
 */
class GamePortalToGameDescriptorFunction
    implements Function<GamePortal, GameDescriptor> {

  private final GameStaticResources gameStaticResources;

  @Inject GamePortalToGameDescriptorFunction(GameStaticResources gameStaticResources) {
    this.gameStaticResources = gameStaticResources;
  }

  @Override
  @Nullable public GameDescriptor apply(@Nullable GamePortal input) {
    if (input == null) {
      return null;
    }

    return GameDescriptor.builderFor(input.getGameIdentifier())
        .setDescription(input.getDescription())
        .setName(input.getName())
        .setIcon(input.getGameIcon().or(gameStaticResources.defaultGameIcon()))
        .build();
  }
}


text:
package model.basetype;

import model.Item;

import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Created by Kang on 7/7/2017.
 */
public class Bow extends Item {

    public Bow() {
        this(null);
    }

    public Bow(ArrayList<String> strArr) {
        if (strArr == null) {
            Logger logger = Logger.getLogger(getClass().getName());
            logger.log(Level.SEVERE, "Received null string in Item Parser.");
        } else {

        }
    }
}


text:
var vivasvg = require('../../vivasvg');
var svgApp = vivasvg.createApp(document.getElementById('scene'), createViewModel(4));
svgApp.run();

function createViewModel(count) {
  var viewModels = [];
  for (var i = 0; i < count; ++i) {
    viewModels.push(
      vivasvg.viewModel({ x: Math.random() * 640, y: Math.random() * 480, dx: Math.random() * 10 - 5 , dy: Math.random() * 10 - 5 })
    );
  }

  // Start animation loop (yes, outside of RAF, this is totally OK):
  setInterval(function () {
    for (var i = 0; i < viewModels.length; ++i) {
      model = viewModels[i];
      model.x += model.dx; if (model.x < 0 || model.x > 640 ) { model.dx *= -1; model.x += model.dx; }
      model.y += model.dy; if (model.y < 0 || model.y > 480 ) { model.dy *= -1; model.y += model.dy; }
      model.invalidate('x', 'y');
    }
  }, 1000/60);

  return vivasvg.viewModel({
    circles: viewModels
  });
}


text:
package zeroturnaround.org.jrebel4androidgettingstarted.service;

import java.util.List;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.GET;
import retrofit2.http.Path;

/**
 * Created by shelajev on 16/12/15.
 */
interface GitHubService {
    @GET("repos/{owner}/{repo}/contributors")
    Call<List<Contributor>> repoContributors(
            @Path("owner") String owner,
            @Path("repo") String repo);

    HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
    OkHttpClient okHttpClient = new OkHttpClient.Builder().addInterceptor(httpLoggingInterceptor).build();

    public static final Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("https://api.github.com/")
            .addConverterFactory(GsonConverterFactory.create()).client(okHttpClient)
            .build();

    @GET("/users/{username}")
    Call<Contributor>user(
            @Path("username")String login);
}


text:
require "active_record"

ActiveRecord::Base.establish_connection(
  :adapter  => "sqlite3",
  :database => ":memory:"
)

ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
  create_table :users
  add_column :users, :avatar_file_name, :string
  add_column :users, :avatar_content_type, :string
  add_column :users, :avatar_file_size, :integer
  add_column :users, :avatar_updated_at, :datetime
end

class UserBase < ActiveRecord::Base
  include Paperclip::Glue
  self.table_name = "users"

  def self.avatar_options
    {
      :storage  => :ftp,
      :styles   => { :medium => "50x50>", :thumb => "10x10>" },
      :path     => "/:style/:filename",
      :ftp_servers => [
        {
          :host     => "127.0.0.1",
          :user     => "user1",
          :password => "secret1",
          :port     => 2121
        },
        {
          :host     => "127.0.0.1",
          :user     => "user2",
          :password => "secret2",
          :port     => 2121
        }
      ]
    }
  end

  def self.setup_avatar_attachment(options = avatar_options)
    has_attached_file :avatar, options
    validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
  end
end

class User < UserBase
  setup_avatar_attachment
end

class UserWithConnectTimeout < UserBase
  TIMEOUT = 0.1

  setup_avatar_attachment(avatar_options.merge(
    :ftp_servers => [
      {
        :host => "127.0.0.2" # should raise Errno::ETIMEDOUT
      }
    ],
    :ftp_connect_timeout => TIMEOUT
  ))
end

class UserWithInvalidPort < UserBase
  def self.avatar_options
    super.merge(
      :ftp_servers => [
        {
          :host     => "127.0.0.1",
          :user     => "user1",
          :password => "secret1",
          :port     => 2121
        },
        {
          :host     => "127.0.0.1",
          :user     => "user2",
          :password => "secret2",
          :port     => 2122 # should raise Errno::ECONNREFUSED
        }
      ]
    )
  end
end

class UserWithOneServerAndDeepPath < UserBase
  setup_avatar_attachment(avatar_options.merge(
    :path     => "/img/:class/:attachment/:id_partition/:style/:filename",
    :ftp_servers => [
      {
        :host     => "127.0.0.1",
        :user     => "user1",
        :password => "secret1",
        :port     => 2121
      }
    ]
  ))
end

class UserIgnoringFailingConnection < UserWithInvalidPort
  setup_avatar_attachment(avatar_options.merge(
    :ftp_ignore_failing_connections => true
  ))
end

class UserNotIgnoringFailingConnection < UserWithInvalidPort
  setup_avatar_attachment(avatar_options.merge(
    :ftp_ignore_failing_connections => false
  ))
end

class UserDisablingEmptyDirectoryRemoval < User
  setup_avatar_attachment(avatar_options.merge(
    :ftp_keep_empty_directories => true
  ))
end


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto

package com.google.devtools.clouderrorreporting.v1beta1;

/**
 *

 * A request for reporting an individual error event.
 *

 *
 * Protobuf type {@code google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest}
 */
public  final class ReportErrorEventRequest extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest)
    ReportErrorEventRequestOrBuilder {
  // Use ReportErrorEventRequest.newBuilder() to construct.
  private ReportErrorEventRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private ReportErrorEventRequest() {
    projectName_ = "";
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
  }
  private ReportErrorEventRequest(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    int mutable_bitField0_ = 0;
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!input.skipField(tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            projectName_ = s;
            break;
          }
          case 18: {
            com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.Builder subBuilder = null;
            if (event_ != null) {
              subBuilder = event_.toBuilder();
            }
            event_ = input.readMessage(com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(event_);
              event_ = subBuilder.buildPartial();
            }

            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceProto.internal_static_google_devtools_clouderrorreporting_v1beta1_ReportErrorEventRequest_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceProto.internal_static_google_devtools_clouderrorreporting_v1beta1_ReportErrorEventRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.class, com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.Builder.class);
  }

  public static final int PROJECT_NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object projectName_;
  /**
   *

   * [Required] The resource name of the Google Cloud Platform project. Written
   * as `projects/` plus the
   * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
   * Example: `projects/my-project-123`.
   *

   *
   * string project_name = 1;
   */
  public java.lang.String getProjectName() {
    java.lang.Object ref = projectName_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs =
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      projectName_ = s;
      return s;
    }
  }
  /**
   *

   * [Required] The resource name of the Google Cloud Platform project. Written
   * as `projects/` plus the
   * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
   * Example: `projects/my-project-123`.
   *

   *
   * string project_name = 1;
   */
  public com.google.protobuf.ByteString
      getProjectNameBytes() {
    java.lang.Object ref = projectName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      projectName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int EVENT_FIELD_NUMBER = 2;
  private com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event_;
  /**
   *

   * [Required] The error event to be reported.
   *

   *
   * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
   */
  public boolean hasEvent() {
    return event_ != null;
  }
  /**
   *

   * [Required] The error event to be reported.
   *

   *
   * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
   */
  public com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent getEvent() {
    return event_ == null ? com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.getDefaultInstance() : event_;
  }
  /**
   *

   * [Required] The error event to be reported.
   *

   *
   * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
   */
  public com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEventOrBuilder getEventOrBuilder() {
    return getEvent();
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getProjectNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, projectName_);
    }
    if (event_ != null) {
      output.writeMessage(2, getEvent());
    }
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!getProjectNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, projectName_);
    }
    if (event_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, getEvent());
    }
    memoizedSize = size;
    return size;
  }

  private static final long serialVersionUID = 0L;
  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest)) {
      return super.equals(obj);
    }
    com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest other = (com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest) obj;

    boolean result = true;
    result = result && getProjectName()
        .equals(other.getProjectName());
    result = result && (hasEvent() == other.hasEvent());
    if (hasEvent()) {
      result = result && getEvent()
          .equals(other.getEvent());
    }
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + PROJECT_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getProjectName().hashCode();
    if (hasEvent()) {
      hash = (37 * hash) + EVENT_FIELD_NUMBER;
      hash = (53 * hash) + getEvent().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *

   * A request for reporting an individual error event.
   *

   *
   * Protobuf type {@code google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest)
      com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceProto.internal_static_google_devtools_clouderrorreporting_v1beta1_ReportErrorEventRequest_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceProto.internal_static_google_devtools_clouderrorreporting_v1beta1_ReportErrorEventRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.class, com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.Builder.class);
    }

    // Construct using com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    public Builder clear() {
      super.clear();
      projectName_ = "";

      if (eventBuilder_ == null) {
        event_ = null;
      } else {
        event_ = null;
        eventBuilder_ = null;
      }
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceProto.internal_static_google_devtools_clouderrorreporting_v1beta1_ReportErrorEventRequest_descriptor;
    }

    public com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest getDefaultInstanceForType() {
      return com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.getDefaultInstance();
    }

    public com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest build() {
      com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest buildPartial() {
      com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest result = new com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest(this);
      result.projectName_ = projectName_;
      if (eventBuilder_ == null) {
        result.event_ = event_;
      } else {
        result.event_ = eventBuilder_.build();
      }
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest) {
        return mergeFrom((com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest other) {
      if (other == com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest.getDefaultInstance()) return this;
      if (!other.getProjectName().isEmpty()) {
        projectName_ = other.projectName_;
        onChanged();
      }
      if (other.hasEvent()) {
        mergeEvent(other.getEvent());
      }
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private java.lang.Object projectName_ = "";
    /**
     *

     * [Required] The resource name of the Google Cloud Platform project. Written
     * as `projects/` plus the
     * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
     * Example: `projects/my-project-123`.
     *

     *
     * string project_name = 1;
     */
    public java.lang.String getProjectName() {
      java.lang.Object ref = projectName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        projectName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *

     * [Required] The resource name of the Google Cloud Platform project. Written
     * as `projects/` plus the
     * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
     * Example: `projects/my-project-123`.
     *

     *
     * string project_name = 1;
     */
    public com.google.protobuf.ByteString
        getProjectNameBytes() {
      java.lang.Object ref = projectName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        projectName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *

     * [Required] The resource name of the Google Cloud Platform project. Written
     * as `projects/` plus the
     * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
     * Example: `projects/my-project-123`.
     *

     *
     * string project_name = 1;
     */
    public Builder setProjectName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }

      projectName_ = value;
      onChanged();
      return this;
    }
    /**
     *

     * [Required] The resource name of the Google Cloud Platform project. Written
     * as `projects/` plus the
     * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
     * Example: `projects/my-project-123`.
     *

     *
     * string project_name = 1;
     */
    public Builder clearProjectName() {

      projectName_ = getDefaultInstance().getProjectName();
      onChanged();
      return this;
    }
    /**
     *

     * [Required] The resource name of the Google Cloud Platform project. Written
     * as `projects/` plus the
     * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
     * Example: `projects/my-project-123`.
     *

     *
     * string project_name = 1;
     */
    public Builder setProjectNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);

      projectName_ = value;
      onChanged();
      return this;
    }

    private com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent, com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.Builder, com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEventOrBuilder> eventBuilder_;
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public boolean hasEvent() {
      return eventBuilder_ != null || event_ != null;
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent getEvent() {
      if (eventBuilder_ == null) {
        return event_ == null ? com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.getDefaultInstance() : event_;
      } else {
        return eventBuilder_.getMessage();
      }
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public Builder setEvent(com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent value) {
      if (eventBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        event_ = value;
        onChanged();
      } else {
        eventBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public Builder setEvent(
        com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.Builder builderForValue) {
      if (eventBuilder_ == null) {
        event_ = builderForValue.build();
        onChanged();
      } else {
        eventBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public Builder mergeEvent(com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent value) {
      if (eventBuilder_ == null) {
        if (event_ != null) {
          event_ =
            com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.newBuilder(event_).mergeFrom(value).buildPartial();
        } else {
          event_ = value;
        }
        onChanged();
      } else {
        eventBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public Builder clearEvent() {
      if (eventBuilder_ == null) {
        event_ = null;
        onChanged();
      } else {
        event_ = null;
        eventBuilder_ = null;
      }

      return this;
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.Builder getEventBuilder() {

      onChanged();
      return getEventFieldBuilder().getBuilder();
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    public com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEventOrBuilder getEventOrBuilder() {
      if (eventBuilder_ != null) {
        return eventBuilder_.getMessageOrBuilder();
      } else {
        return event_ == null ?
            com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.getDefaultInstance() : event_;
      }
    }
    /**
     *

     * [Required] The error event to be reported.
     *

     *
     * .google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent event = 2;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent, com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.Builder, com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEventOrBuilder>
        getEventFieldBuilder() {
      if (eventBuilder_ == null) {
        eventBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent, com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent.Builder, com.google.devtools.clouderrorreporting.v1beta1.ReportedErrorEventOrBuilder>(
                getEvent(),
                getParentForChildren(),
                isClean());
        event_ = null;
      }
      return eventBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

    public final Builder setProjectNameWithProjectName(com.google.devtools.clouderrorreporting.v1beta1.ProjectName value) {
      if (value == null) {
        return setProjectName("");
      }
      return setProjectName(value.toString());
    }

    public final com.google.devtools.clouderrorreporting.v1beta1.ProjectName getProjectNameAsProjectName() {
      java.lang.String str = getProjectName();
      if (str.isEmpty()) {
        return null;
      }
      return com.google.devtools.clouderrorreporting.v1beta1.ProjectName.parse(str);
    }
    // @@protoc_insertion_point(builder_scope:google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest)
  }

  public final com.google.devtools.clouderrorreporting.v1beta1.ProjectName getProjectNameAsProjectName() {
    java.lang.String str = getProjectName();
    if (str.isEmpty()) {
      return null;
    }
    return com.google.devtools.clouderrorreporting.v1beta1.ProjectName.parse(str);
  }
  // @@protoc_insertion_point(class_scope:google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest)
  private static final com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest();
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<ReportErrorEventRequest>
      PARSER = new com.google.protobuf.AbstractParser<ReportErrorEventRequest>() {
    public ReportErrorEventRequest parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return new ReportErrorEventRequest(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<ReportErrorEventRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<ReportErrorEventRequest> getParserForType() {
    return PARSER;
  }

  public com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}