org.dmd.dms.generated.enums.RuleScopeEnum Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dark-matter-data Show documentation
Show all versions of dark-matter-data Show documentation
The dark-matter project provides mechanism to define concepts associated with Domain Specific Languages (DSLs) and generate code that can be extended with business logic that supports the given DSL purpose.
// ---------------------------------------------------------------------------
// dark-matter-data
// Copyright (c) 2012 dark-matter-data committers
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
// more details.
// You should have received a copy of the GNU Lesser General Public License along
// with this program; if not, see .
// ---------------------------------------------------------------------------
package org.dmd.dms.generated.enums;
import java.util.*;
/**
* The RuleScopeEnum enumeration.
* This code was auto-generated by the createmeta utility and shouldn't be alterred
* manually.
* Generated from: org.dmd.dms.meta.MetaGenerator.dumpEnumClass(MetaGenerator.java:945)
*/
public enum RuleScopeEnum
{
/**
* Indicates the rule is applied within the scope of a class.
*/
PERCLASS(0),
/**
* Indicates the rule is global in scope.
*/
GLOBAL(1);
// Maps our integer value to the enumeration value
private static final Map lookup = new HashMap();
static {
for(RuleScopeEnum s : EnumSet.allOf(RuleScopeEnum.class))
lookup.put(s.intValue(), s);
}
// Maps our enumeration (string) value to the enumeration value
private static final Map lookupString = new HashMap();
static {
for(RuleScopeEnum s : EnumSet.allOf(RuleScopeEnum.class))
lookupString.put(s.name(), s);
}
// Our current value as an int - normally, this isn't available in an enum
private int ival;
/**
* This private constructor allows us to access our int value when required.
*/
private RuleScopeEnum(int i){
ival = i;
}
/**
* Returns the value of this enum value as an int.
*/
public int intValue(){
return(ival);
}
/**
* Returns the enum value of the specified int or null if it's not valid.
*/
public static RuleScopeEnum get(int code) {
return(lookup.get(code));
}
/**
* Returns a value for this enum or throws an exception if the String value isn't
* a valid member of this enum.
*/
public static RuleScopeEnum get(String str) {
return(lookupString.get(str));
}
}