本文整理汇总了Java中org.mybatis.generator.config.PropertyRegistry类的典型用法代码示例。如果您正苦于以下问题:Java PropertyRegistry类的具体用法?Java PropertyRegistry怎么用?Java PropertyRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyRegistry类属于org.mybatis.generator.config包,在下文中一共展示了PropertyRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testThatFilesAreTheSameAfterMerge
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
@Test
public void testThatFilesAreTheSameAfterMerge() throws Exception {
DefaultXmlFormatter xmlFormatter = new DefaultXmlFormatter();
Properties p = new Properties();
p.setProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE, "true");
CommentGenerator commentGenerator = new DefaultCommentGenerator();
commentGenerator.addConfigurationProperties(p);
Document document = new Document(XmlConstants.MYBATIS3_MAPPER_PUBLIC_ID,
XmlConstants.MYBATIS3_MAPPER_SYSTEM_ID);
document.setRootElement(getSqlMapElement(commentGenerator));
GeneratedXmlFile generatedFile1 = new GeneratedXmlFile(document, "TestMapper.xml", "org.mybatis.test", "src",
true, xmlFormatter);
InputSource is1 = new InputSource(new StringReader(generatedFile1.getFormattedContent()));
GeneratedXmlFile generatedFile2 = new GeneratedXmlFile(document, "TestMapper.xml", "org.mybatis.test", "src",
true, xmlFormatter);
InputSource is2 = new InputSource(new StringReader(generatedFile2.getFormattedContent()));
String mergedSource = XmlFileMergerJaxp.getMergedSource(is1, is2, "TestMapper.xml");
assertEquals(generatedFile1.getFormattedContent(), mergedSource);
}
示例2: isConstructorBased
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
/**
* Checks if is constructor based.
*
* @return true, if is constructor based
*/
public boolean isConstructorBased() {
if (isImmutable()) {
return true;
}
Properties properties;
if (tableConfiguration.getProperties().containsKey(PropertyRegistry.ANY_CONSTRUCTOR_BASED)) {
properties = tableConfiguration.getProperties();
} else {
properties = context.getJavaModelGeneratorConfiguration().getProperties();
}
return isTrue(properties.getProperty(PropertyRegistry.ANY_CONSTRUCTOR_BASED));
}
示例3: addConfigurationProperties
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
public void addConfigurationProperties(Properties properties) {
this.properties.putAll(properties);
suppressDate = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
suppressAllComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
addRemarkComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS));
String dateFormatString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_DATE_FORMAT);
if (StringUtility.stringHasValue(dateFormatString)) {
dateFormat = new SimpleDateFormat(dateFormatString);
}
}
示例4: getExampleMethodVisibility
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
public JavaVisibility getExampleMethodVisibility() {
if (exampleMethodVisibility == null) {
String type = context
.getJavaClientGeneratorConfiguration()
.getProperty(PropertyRegistry.DAO_EXAMPLE_METHOD_VISIBILITY);
if (stringHasValue(type)) {
if ("public".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.PUBLIC;
} else if ("private".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.PRIVATE;
} else if ("protected".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.PROTECTED;
} else if ("default".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.DEFAULT;
} else {
exampleMethodVisibility = JavaVisibility.PUBLIC;
warnings.add(getString("Warning.16", type)); //$NON-NLS-1$
}
} else {
exampleMethodVisibility = JavaVisibility.PUBLIC;
}
}
return exampleMethodVisibility;
}
示例5: addConfigurationProperties
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
public void addConfigurationProperties(Properties properties) {
this.properties.putAll(properties);
suppressDate = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
suppressAllComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
addRemarkComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS));
String dateFormatString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_DATE_FORMAT);
if (StringUtility.stringHasValue(dateFormatString)) {
dateFormat = new SimpleDateFormat(dateFormatString);
}
}
示例6: addConfigurationProperties
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
public void addConfigurationProperties(Properties properties) {
this.properties.putAll(properties);
suppressDate = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
suppressAllComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
addRemarkComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS));
String dateFormatString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_DATE_FORMAT);
if (StringUtility.stringHasValue(dateFormatString)) {
dateFormat = new SimpleDateFormat(dateFormatString);
}
//添加作者配置
String authorString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_AUTHOR);
if (StringUtility.stringHasValue(authorString)) {
author = authorString;
}
}
示例7: addConfigurationProperties
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
@Override
public void addConfigurationProperties(Properties properties) {
this.properties.putAll(properties);
suppressDate = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
suppressAllComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
addRemarkComments = isTrue(properties
.getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS));
String dateFormatString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_DATE_FORMAT);
if (StringUtility.stringHasValue(dateFormatString)) {
dateFormat = new SimpleDateFormat(dateFormatString);
}
}
示例8: getExtraCompilationUnits
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
@Override
public List<CompilationUnit> getExtraCompilationUnits() {
boolean useLegacyBuilder = false;
String prop = context.getJavaClientGeneratorConfiguration().getProperty(PropertyRegistry.CLIENT_USE_LEGACY_BUILDER);
if (StringUtility.stringHasValue(prop)) {
useLegacyBuilder = Boolean.valueOf(prop);
}
SqlProviderGenerator sqlProviderGenerator = new SqlProviderGenerator(useLegacyBuilder);
sqlProviderGenerator.setContext(context);
sqlProviderGenerator.setIntrospectedTable(introspectedTable);
sqlProviderGenerator.setProgressCallback(progressCallback);
sqlProviderGenerator.setWarnings(warnings);
return sqlProviderGenerator.getCompilationUnits();
}
示例9: isImmutable
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
/**
* Checks if is immutable.
*
* @return true, if is immutable
*/
public boolean isImmutable() {
Properties properties;
if (tableConfiguration.getProperties().containsKey(PropertyRegistry.ANY_IMMUTABLE)) {
properties = tableConfiguration.getProperties();
} else {
properties = context.getJavaModelGeneratorConfiguration().getProperties();
}
return isTrue(properties.getProperty(PropertyRegistry.ANY_IMMUTABLE));
}
示例10: BaseRules
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
/**
* Instantiates a new base rules.
*
* @param introspectedTable
* the introspected table
*/
public BaseRules(IntrospectedTable introspectedTable) {
super();
this.introspectedTable = introspectedTable;
this.tableConfiguration = introspectedTable.getTableConfiguration();
String modelOnly = tableConfiguration.getProperty(PropertyRegistry.TABLE_MODEL_ONLY);
isModelOnly = StringUtility.isTrue(modelOnly);
}
示例11: isTrimStringsEnabled
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
/**
* Checks if is trim strings enabled.
*
* @param context
* the context
* @return true, if is trim strings enabled
*/
private static boolean isTrimStringsEnabled(Context context) {
Properties properties = context
.getJavaModelGeneratorConfiguration().getProperties();
boolean rc = isTrue(properties
.getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS));
return rc;
}
示例12: getRootClass
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
public String getRootClass() {
String rootClass = introspectedTable
.getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_CLASS);
if (rootClass == null) {
Properties properties = context
.getJavaModelGeneratorConfiguration().getProperties();
rootClass = properties.getProperty(PropertyRegistry.ANY_ROOT_CLASS);
}
return rootClass;
}
示例13: createJavaFormatter
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
/**
* Creates a new Object object.
*
* @param context
* the context
* @return the java formatter
*/
public static JavaFormatter createJavaFormatter(Context context) {
String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER);
if (!stringHasValue(type)) {
type = DefaultJavaFormatter.class.getName();
}
JavaFormatter answer = (JavaFormatter) createInternalObject(type);
answer.setContext(context);
return answer;
}
示例14: isTrimStringsEnabled
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
/**
* Checks if is trim strings enabled.
*
* @param column
* the column
* @return true, if is trim strings enabled
*/
private static boolean isTrimStringsEnabled(IntrospectedColumn column) {
String trimSpaces = column.getProperties().getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS);
if (trimSpaces != null) {
return isTrue(trimSpaces);
}
return isTrimStringsEnabled(column.getIntrospectedTable());
}
示例15: getModelPackage
import org.mybatis.generator.config.PropertyRegistry; //导入依赖的package包/类
private String getModelPackage( IntrospectedTable introspectedTable,Context context){
StringBuilder sb = new StringBuilder();
sb.append(context.getJavaModelGeneratorConfiguration().getTargetPackage());
sb.append(introspectedTable.getFullyQualifiedTable().getSubPackageForModel(StringUtility.isTrue(context.getJavaModelGeneratorConfiguration().getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))));
String pakkage = sb.toString();
return pakkage;
}