All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dmd.dmv.shared.generated.dmo.PatternMatchRuleDataDMO Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.1.15
Show newest version
//	---------------------------------------------------------------------------
//	dark-matter-data
//	Copyright (c) 2010-2021 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.dmv.shared.generated.dmo;

// Generated from: org.dmd.dms.util.GenUtility.formatImports(GenUtility.java:408)
import java.io.Serializable;                                                // Always required - (GenUtility.java:227)
import java.util.*;                                                         // Always required if we have any MV attributes - (GenUtility.java:224)
import org.dmd.dmc.DmcAttribute;                                            // Named object - (GenUtility.java:388)
import org.dmd.dmc.DmcNamedObjectIF;                                        // Named object - (GenUtility.java:387)
import org.dmd.dmc.DmcOmni;                                                 // Lazy resolution - (GenUtility.java:331)
import org.dmd.dmc.DmcSliceInfo;                                            // Required for object slicing - (GenUtility.java:232)
import org.dmd.dmc.DmcValueException;                                       // Any attributes - (GenUtility.java:249)
import org.dmd.dmc.types.RuleName;                                          // Naming attribute type - (GenUtility.java:382)
import org.dmd.dms.generated.dmo.AttributeDefinitionDMO;                    // Type specific set/add - (GenUtility.java:318)
import org.dmd.dms.generated.dmo.MetaDMSAG;                                 // Required for MODREC constructor - (GenUtility.java:231)
import org.dmd.dms.generated.dmo.RuleDataDMO;                               // Base class - (GenUtility.java:367)
import org.dmd.dms.generated.types.AttributeDefinitionREF;                  // Helper class - (GenUtility.java:346)
import org.dmd.dms.generated.types.DmcTypeAttributeDefinitionREFSV;         // Reference type - (GenUtility.java:311)
import org.dmd.dms.generated.types.DmcTypeModifierMV;                       // Required for MODREC constructor - (GenUtility.java:230)
import org.dmd.dms.generated.types.DmcTypeRuleNameSV;                       // Required type - (GenUtility.java:339)
import org.dmd.dms.generated.types.DmcTypeStringMV;                         // Required type - (GenUtility.java:339)
import org.dmd.dms.generated.types.DmcTypeStringSV;                         // Required type - (GenUtility.java:339)

// Generated from: org.dmd.dms.util.DmoFormatter.getClassHeader(DmoFormatter.java:678)
/**
 * The PatternMatchRule allows you to validate that an attribute\n in an
 * object conforms to a regex pattern that you specify. If the pattern
 * match\n fails, the ruleTitle is used as the error message, so use a clear
 * rule title to\n indicate the intent of the pattern match. For instance the
 * following rule is \n applied to the names of EnumDefinitions:\n 
\n
 * PatternMatchRuleData\n ruleName          dmvEnumDefinitionNameCheck\n
 * ruleTitle         An EnumDefinition's name must end with Enum\n
 * matchesPattern    ^.*Enum\n applyToAttribute  name\n applyToClass     
 * EnumDefinition\n 
*

* Generated from the dmv schema at version 0.1 *

* This code was auto-generated by the dmogenerator utility and shouldn't be alterred manually! * Generated from: org.dmd.dms.util.DmoFormatter.dumpDMO(DmoFormatter.java:134) */ @SuppressWarnings("serial") public class PatternMatchRuleDataDMO extends RuleDataDMO implements DmcNamedObjectIF, Serializable { public final static String constructionClassName = "PatternMatchRuleData"; static { } public PatternMatchRuleDataDMO() { super("PatternMatchRuleData"); } protected PatternMatchRuleDataDMO(String oc) { super(oc); } @Override public PatternMatchRuleDataDMO getNew(){ PatternMatchRuleDataDMO rc = new PatternMatchRuleDataDMO(); return(rc); } @Override public PatternMatchRuleDataDMO getSlice(DmcSliceInfo info){ PatternMatchRuleDataDMO rc = new PatternMatchRuleDataDMO(); populateSlice(rc,info); return(rc); } public PatternMatchRuleDataDMO(DmcTypeModifierMV mods) { super("PatternMatchRuleData"); modrec(true); setModifier(mods); } public PatternMatchRuleDataDMO getModificationRecorder(){ PatternMatchRuleDataDMO rc = new PatternMatchRuleDataDMO(); rc.setRuleName(getRuleName()); rc.setModifier(new DmcTypeModifierMV(MetaDMSAG.__modify)); rc.modrec(true); return(rc); } // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:752) public RuleName getObjectName(){ DmcAttribute name = get(MetaDMSAG.__ruleName); if (name != null) return((RuleName)name.getSV()); return(null); } // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:769) public DmcAttribute getObjectNameAttribute(){ DmcAttribute name = get(MetaDMSAG.__ruleName); return(name); } // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:776) public boolean equals(Object obj){ if (obj instanceof PatternMatchRuleDataDMO){ return( getObjectName().equals( ((PatternMatchRuleDataDMO) obj).getObjectName()) ); } return(false); } // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:784) public int hashCode(){ RuleName objn = getObjectName(); if (objn == null) return(0); return(objn.hashCode()); } /** * @return An Iterator of String objects. */ @SuppressWarnings("unchecked") // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1289) public Iterator getDescription(){ DmcTypeStringMV attr = (DmcTypeStringMV) get(MetaDMSAG.__description); if (attr == null) return( ((List) Collections.EMPTY_LIST).iterator()); return(attr.getMV()); } /** * @param i the index * @return The nth String value. */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1302) public String getNthDescription(int i){ DmcTypeStringMV attr = (DmcTypeStringMV) get(MetaDMSAG.__description); if (attr == null) return(null); return(attr.getMVnth(i)); } /** * Adds another description to the specified value. * @param value String * @return the attribute instance */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1317) public DmcAttribute addDescription(String value) { DmcAttribute attr = get(MetaDMSAG.__description); if (attr == null) attr = new DmcTypeStringMV(MetaDMSAG.__description); try{ setLastValue(attr.add(value)); add(MetaDMSAG.__description,attr); } catch(DmcValueException ex){ throw(new IllegalStateException("The type specific add() method shouldn't throw exceptions!",ex)); } return(attr); } /** * @param value String * @return true if we contain a valued keyed by the specified String. */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1392) public boolean descriptionContains(String value) { DmcAttribute attr = get(MetaDMSAG.__description); if (attr == null) return(false); return(attr.contains(value)); } /** * Adds another description value. * @param value A value compatible with String * @return the attribute instance * @throws DmcValueException if value is not correct */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1426) public DmcAttribute addDescription(Object value) throws DmcValueException { DmcAttribute attr = get(MetaDMSAG.__description); if (attr == null) attr = new DmcTypeStringMV(MetaDMSAG.__description); setLastValue(attr.add(value)); add(MetaDMSAG.__description,attr); return(attr); } /** * @return the number of values in description */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1443) public int getDescriptionSize(){ DmcAttribute attr = get(MetaDMSAG.__description); if (attr == null){ if (MetaDMSAG.__description.indexSize == 0) return(0); else return(MetaDMSAG.__description.indexSize); } return(attr.getMVSize()); } /** * Deletes a description value. * @param value The String to be deleted from set of attribute values. * @return the deleted attribute instance * @throws DmcValueException if the value is incorrect */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1505) public DmcAttribute delDescription(Object value) throws DmcValueException { DmcAttribute attr = get(MetaDMSAG.__description); if ( (attr == null) && (getModifier()!= null)) delFromEmptyAttribute(new DmcTypeStringMV(MetaDMSAG.__description), value); else attr = del(MetaDMSAG.__description, value); return(attr); } /** * Deletes a description from the specified value. * @param value String * @return the deleted attribute instance */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1522) public DmcAttribute delDescription(String value) { DmcAttribute attr = get(MetaDMSAG.__description); if ( (attr == null) && (getModifier()!= null)) delFromEmptyAttribute(new DmcTypeStringMV(MetaDMSAG.__description), value); else attr = del(MetaDMSAG.__description, value); return(attr); } /** * Removes the description attribute value. */ // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1541) public void remDescription(){ rem(MetaDMSAG.__description); } // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:798) public RuleName getRuleName(){ DmcTypeRuleNameSV attr = (DmcTypeRuleNameSV) get(MetaDMSAG.__ruleName); if (attr == null) return(null); return(attr.getSV()); } /** * Sets ruleName to the specified value. * @param value RuleName */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:838) public void setRuleName(RuleName value) { DmcAttribute attr = get(MetaDMSAG.__ruleName); if (attr == null) attr = new DmcTypeRuleNameSV(MetaDMSAG.__ruleName); try{ attr.set(value); set(MetaDMSAG.__ruleName,attr); } catch(DmcValueException ex){ throw(new IllegalStateException("The type specific set() method shouldn't throw exceptions!",ex)); } } /** * Sets ruleName to the specified value. * @param value A value compatible with DmcTypeRuleNameSV * @throws DmcValueException if value is not correct */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:892) public void setRuleName(Object value) throws DmcValueException { DmcTypeRuleNameSV attr = (DmcTypeRuleNameSV) get(MetaDMSAG.__ruleName); if (attr == null) attr = new DmcTypeRuleNameSV(MetaDMSAG.__ruleName); attr.set(value); set(MetaDMSAG.__ruleName,attr); } /** * Removes the ruleName attribute value. */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:912) public void remRuleName(){ rem(MetaDMSAG.__ruleName); } // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:798) public String getRuleTitle(){ DmcTypeStringSV attr = (DmcTypeStringSV) get(MetaDMSAG.__ruleTitle); if (attr == null) return(null); return(attr.getSV()); } /** * Sets ruleTitle to the specified value. * @param value String */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:838) public void setRuleTitle(String value) { DmcAttribute attr = get(MetaDMSAG.__ruleTitle); if (attr == null) attr = new DmcTypeStringSV(MetaDMSAG.__ruleTitle); try{ attr.set(value); set(MetaDMSAG.__ruleTitle,attr); } catch(DmcValueException ex){ throw(new IllegalStateException("The type specific set() method shouldn't throw exceptions!",ex)); } } /** * Sets ruleTitle to the specified value. * @param value A value compatible with DmcTypeStringSV * @throws DmcValueException if value is not correct */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:892) public void setRuleTitle(Object value) throws DmcValueException { DmcTypeStringSV attr = (DmcTypeStringSV) get(MetaDMSAG.__ruleTitle); if (attr == null) attr = new DmcTypeStringSV(MetaDMSAG.__ruleTitle); attr.set(value); set(MetaDMSAG.__ruleTitle,attr); } /** * Removes the ruleTitle attribute value. */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:912) public void remRuleTitle(){ rem(MetaDMSAG.__ruleTitle); } // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:678) /** * @return the AttributeDefinitionREF */ public AttributeDefinitionREF getApplyToAttribute(){ DmcTypeAttributeDefinitionREFSV attr = (DmcTypeAttributeDefinitionREFSV) get(MetaDMSAG.__applyToAttribute); if (attr == null) return(null); if (DmcOmni.instance().lazyResolution()){ if (attr.doLazyResolution(this)){ rem(attr.getAttributeInfo()); return(null); } } return(attr.getSV()); } // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:700) /** * @return the reference to AttributeDefinition without attempting lazy resolution (if turned on). */ public AttributeDefinitionREF getApplyToAttributeREF(){ DmcTypeAttributeDefinitionREFSV attr = (DmcTypeAttributeDefinitionREFSV) get(MetaDMSAG.__applyToAttribute); if (attr == null) return(null); return(attr.getSV()); } // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:718) /** * Sets applyToAttribute to the specified value. * @param value AttributeDefinitionDMO */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:723) public void setApplyToAttribute(AttributeDefinitionDMO value) { DmcAttribute attr = get(MetaDMSAG.__applyToAttribute); if (attr == null) attr = new DmcTypeAttributeDefinitionREFSV(MetaDMSAG.__applyToAttribute); else ((DmcTypeAttributeDefinitionREFSV)attr).removeBackReferences(); try{ attr.set(value); set(MetaDMSAG.__applyToAttribute,attr); } catch(DmcValueException ex){ throw(new IllegalStateException("The type specific set() method shouldn't throw exceptions!",ex)); } } /** * Sets applyToAttribute to the specified value. * @param value A value compatible with DmcTypeAttributeDefinitionREFSV * @throws DmcValueException if value is not correct */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:892) public void setApplyToAttribute(Object value) throws DmcValueException { DmcTypeAttributeDefinitionREFSV attr = (DmcTypeAttributeDefinitionREFSV) get(MetaDMSAG.__applyToAttribute); if (attr == null) attr = new DmcTypeAttributeDefinitionREFSV(MetaDMSAG.__applyToAttribute); else attr.removeBackReferences(); attr.set(value); set(MetaDMSAG.__applyToAttribute,attr); } /** * Removes the applyToAttribute attribute value. */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:912) public void remApplyToAttribute(){ rem(MetaDMSAG.__applyToAttribute); } // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:798) public String getMatchesPattern(){ DmcTypeStringSV attr = (DmcTypeStringSV) get(DmvDMSAG.__matchesPattern); if (attr == null) return(null); return(attr.getSV()); } /** * Sets matchesPattern to the specified value. * @param value String */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:838) public void setMatchesPattern(String value) { DmcAttribute attr = get(DmvDMSAG.__matchesPattern); if (attr == null) attr = new DmcTypeStringSV(DmvDMSAG.__matchesPattern); try{ attr.set(value); set(DmvDMSAG.__matchesPattern,attr); } catch(DmcValueException ex){ throw(new IllegalStateException("The type specific set() method shouldn't throw exceptions!",ex)); } } /** * Sets matchesPattern to the specified value. * @param value A value compatible with DmcTypeStringSV * @throws DmcValueException if value is not correct */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:892) public void setMatchesPattern(Object value) throws DmcValueException { DmcTypeStringSV attr = (DmcTypeStringSV) get(DmvDMSAG.__matchesPattern); if (attr == null) attr = new DmcTypeStringSV(DmvDMSAG.__matchesPattern); attr.set(value); set(DmvDMSAG.__matchesPattern,attr); } /** * Removes the matchesPattern attribute value. */ // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:912) public void remMatchesPattern(){ rem(DmvDMSAG.__matchesPattern); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy