public FlavorIncludeDefImpl(Builder builder) throws InvalidDefinitionException { super(builder); this.source = builder.source; this.parentDescriptor = builder.parentDescriptor; String[] split = source.split(":"); if (split.length != 2) { throw new InvalidDefinitionException(ERROR_MSG, getLocation()); } namespace = split[0]; bundle = split[1]; String fmt = String.format("%s://%s:*", DefDescriptor.CUSTOM_FLAVOR_PREFIX, namespace); this.filter = new DescriptorFilter(fmt, DefType.FLAVORED_STYLE); this.hashCode = AuraUtil.hashCode(descriptor, location, source); }
protected FlavoredStyleDefImpl(Builder builder) { super(builder); this.flavorNames = AuraUtil.immutableSet(builder.flavorNames); }
protected JavaProviderDef(Builder builder) throws QuickFixException { super(builder); ComponentConfigProvider configProv = null; StaticComponentConfigProvider staticConfigProv = null; ComponentDescriptorProvider descriptorProv = null; List<Class<? extends Provider>> interfaces = AuraUtil.findInterfaces(builder.providerClass, Provider.class); if (!interfaces.isEmpty()) { try { for (Class<? extends Provider> theIfc : interfaces) { if (ComponentConfigProvider.class.isAssignableFrom(theIfc)) { configProv = (ComponentConfigProvider) builder.providerClass.newInstance(); } else if (ComponentDescriptorProvider.class.isAssignableFrom(theIfc)) { descriptorProv = (ComponentDescriptorProvider) builder.providerClass.newInstance(); } if (StaticComponentConfigProvider.class.isAssignableFrom(theIfc)) { staticConfigProv = (StaticComponentConfigProvider) builder.providerClass.newInstance(); } } } catch (InstantiationException ie) { throw new InvalidDefinitionException( "Cannot instantiate " + builder.providerClass.getName(), location); } catch (IllegalAccessException iae) { throw new InvalidDefinitionException( "Constructor is inaccessible for " + builder.providerClass.getName(), location); } catch (RuntimeException e) { throw new InvalidDefinitionException( "Failed to instantiate " + builder.providerClass.getName(), location, e); } } else { // // Compatibility mode. // FIXME: this code path should die W-1190554 // Method configMeth = null; Method descriptorMeth = null; Method attributeMeth = null; try { Method provideMeth = builder.providerClass.getMethod("provide"); Class<?> returnType = provideMeth.getReturnType(); if (Modifier.isStatic(provideMeth.getModifiers())) { if (ComponentConfig.class.isAssignableFrom(returnType)) { configMeth = provideMeth; } else if (DefDescriptor.class.isAssignableFrom(returnType)) { descriptorMeth = provideMeth; } } } catch (NoSuchMethodException e) { // That's ok. } catch (Exception e) { throw new AuraRuntimeException(e); } try { attributeMeth = builder.providerClass.getMethod("provideAttributes"); if (!Modifier.isStatic(attributeMeth.getModifiers())) { attributeMeth = null; } } catch (NoSuchMethodException e) { // That's ok. } catch (Exception e) { throw new AuraRuntimeException(e); } if (configMeth != null) { configProv = new ConfigMethodAdaptor(configMeth); } else if (descriptorMeth != null) { configProv = new DualMethodAdaptor(descriptorMeth, attributeMeth); } // // End of compatibility mode. // FIXME: this code path should die W-1190554 // } this.configProvider = configProv; this.descriptorProvider = descriptorProv; this.staticConfigProvider = staticConfigProv; // FIXME!!! W-1191791 if (configProvider == null && descriptorProvider == null) { throw new InvalidDefinitionException("@Provider must have a provider interface.", location); } }
protected NamespaceDefImpl(Builder builder) { super(builder); this.styleTokens = AuraUtil.immutableMap(builder.styleTokens); }