alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                  Sun Public License Notice
 *   
 *  The contents of this file are subject to the Sun Public License
 *  Version 1.0 (the "License"). You may not use this file except in
 *  compliance with the License. A copy of the License is available at
 *  http://www.sun.com/
 *    
 *  The Original Code is NetBeans. The Initial Developer of the Original
 *  Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
 *  Microsystems, Inc. All Rights Reserved.
 *  
 */

package org.netbeans.jmi.javamodel;

/**
 * PrimitiveTypeKind enumeration class implementation.
 * Enumeration of Java primitive type kinds.
 *  
 * 

Note: This type should not be subclassed or implemented by * clients. It is generated from a MOF metamodel and automatically implemented * by MDR (see mdr.netbeans.org) */ public final class PrimitiveTypeKindEnum implements PrimitiveTypeKind { /** * Enumeration constant corresponding to literal void. */ public static final PrimitiveTypeKindEnum VOID = new PrimitiveTypeKindEnum("void"); /** * Enumeration constant corresponding to literal int. */ public static final PrimitiveTypeKindEnum INT = new PrimitiveTypeKindEnum("int"); /** * Enumeration constant corresponding to literal char. */ public static final PrimitiveTypeKindEnum CHAR = new PrimitiveTypeKindEnum("char"); /** * Enumeration constant corresponding to literal boolean. */ public static final PrimitiveTypeKindEnum BOOLEAN = new PrimitiveTypeKindEnum("boolean"); /** * Enumeration constant corresponding to literal long. */ public static final PrimitiveTypeKindEnum LONG = new PrimitiveTypeKindEnum("long"); /** * Enumeration constant corresponding to literal double. */ public static final PrimitiveTypeKindEnum DOUBLE = new PrimitiveTypeKindEnum("double"); /** * Enumeration constant corresponding to literal float. */ public static final PrimitiveTypeKindEnum FLOAT = new PrimitiveTypeKindEnum("float"); /** * Enumeration constant corresponding to literal byte. */ public static final PrimitiveTypeKindEnum BYTE = new PrimitiveTypeKindEnum("byte"); /** * Enumeration constant corresponding to literal short. */ public static final PrimitiveTypeKindEnum SHORT = new PrimitiveTypeKindEnum("short"); private static final java.util.List typeName; private final java.lang.String literalName; static { java.util.ArrayList temp = new java.util.ArrayList(); temp.add("JavaModel"); temp.add("PrimitiveTypeKind"); typeName = java.util.Collections.unmodifiableList(temp); } private PrimitiveTypeKindEnum(java.lang.String literalName) { this.literalName = literalName; } /** * Returns fully qualified name of the enumeration type. * @return List containing all parts of the fully qualified name. */ public java.util.List refTypeName() { return typeName; } /** * Returns a string representation of the enumeration value. * @return A string representation of the enumeration value. */ public java.lang.String toString() { return literalName; } /** * Returns a hash code for this the enumeration value. * @return A hash code for this enumeration value. */ public int hashCode() { return literalName.hashCode(); } /** * Indicates whether some other object is equal to this enumeration value. * @param o The reference object with which to compare. * @return true if the other object is the enumeration of the same type and * of the same value. */ public boolean equals(java.lang.Object o) { if (o instanceof PrimitiveTypeKindEnum) return (o == this); else if (o instanceof PrimitiveTypeKind) return (o.toString().equals(literalName)); else return ((o instanceof javax.jmi.reflect.RefEnum) && ((javax.jmi.reflect.RefEnum) o).refTypeName().equals(typeName) && o.toString().equals(literalName)); } /** * Translates literal name to correspondent enumeration value. * @param name Enumeration literal. * @return Enumeration value corresponding to the passed literal. */ public static PrimitiveTypeKind forName(java.lang.String name) { if (name.equals("void")) return VOID; if (name.equals("int")) return INT; if (name.equals("char")) return CHAR; if (name.equals("boolean")) return BOOLEAN; if (name.equals("long")) return LONG; if (name.equals("double")) return DOUBLE; if (name.equals("float")) return FLOAT; if (name.equals("byte")) return BYTE; if (name.equals("short")) return SHORT; throw new java.lang.IllegalArgumentException("Unknown literal name '" + name + "' for enumeration 'JavaModel.PrimitiveTypeKind'"); } /** * Resolves serialized instance of enumeration value. * @return Resolved enumeration value. */ protected java.lang.Object readResolve() throws java.io.ObjectStreamException { try { return forName(literalName); } catch (java.lang.IllegalArgumentException e) { throw new java.io.InvalidObjectException(e.getMessage()); } } }

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.